< prev index next >

src/hotspot/share/gc/g1/g1AllocRegion.cpp

Print this page
rev 56448 : imported patch 8220310.mut.0
rev 56449 : imported patch 8220310.mut.1
   1 /*
   2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 233     } else {
 234       out->print(HR_FORMAT, HR_FORMAT_PARAMS(_alloc_region));
 235     }
 236 
 237     out->print(" : %s", str);
 238 
 239     if (detailed_info) {
 240       if (result != NULL) {
 241         out->print(" min " SIZE_FORMAT " desired " SIZE_FORMAT " actual " SIZE_FORMAT " " PTR_FORMAT,
 242                      min_word_size, desired_word_size, actual_word_size, p2i(result));
 243       } else if (min_word_size != 0) {
 244         out->print(" min " SIZE_FORMAT " desired " SIZE_FORMAT, min_word_size, desired_word_size);
 245       }
 246     }
 247     out->cr();
 248   }
 249 }
 250 #endif // PRODUCT
 251 
 252 G1AllocRegion::G1AllocRegion(const char* name,
 253                              bool bot_updates)

 254   : _alloc_region(NULL),
 255     _count(0),
 256     _used_bytes_before(0),
 257     _bot_updates(bot_updates),
 258     _name(name)

 259  { }
 260 
 261 HeapRegion* MutatorAllocRegion::allocate_new_region(size_t word_size,
 262                                                     bool force) {
 263   return _g1h->new_mutator_alloc_region(word_size, force);
 264 }
 265 
 266 void MutatorAllocRegion::retire_region(HeapRegion* alloc_region,
 267                                        size_t allocated_bytes) {
 268   _g1h->retire_mutator_alloc_region(alloc_region, allocated_bytes);
 269 }
 270 
 271 void MutatorAllocRegion::init() {
 272   assert(_retained_alloc_region == NULL, "Pre-condition");
 273   G1AllocRegion::init();
 274   _wasted_bytes = 0;
 275 }
 276 
 277 bool MutatorAllocRegion::should_retain(HeapRegion* region) {
 278   size_t free_bytes = region->free();
 279   if (free_bytes < MinTLABSize) {
 280     return false;
 281   }
 282 
 283   if (_retained_alloc_region != NULL &&


   1 /*
   2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 233     } else {
 234       out->print(HR_FORMAT, HR_FORMAT_PARAMS(_alloc_region));
 235     }
 236 
 237     out->print(" : %s", str);
 238 
 239     if (detailed_info) {
 240       if (result != NULL) {
 241         out->print(" min " SIZE_FORMAT " desired " SIZE_FORMAT " actual " SIZE_FORMAT " " PTR_FORMAT,
 242                      min_word_size, desired_word_size, actual_word_size, p2i(result));
 243       } else if (min_word_size != 0) {
 244         out->print(" min " SIZE_FORMAT " desired " SIZE_FORMAT, min_word_size, desired_word_size);
 245       }
 246     }
 247     out->cr();
 248   }
 249 }
 250 #endif // PRODUCT
 251 
 252 G1AllocRegion::G1AllocRegion(const char* name,
 253                              bool bot_updates,
 254                              uint node_index)
 255   : _alloc_region(NULL),
 256     _count(0),
 257     _used_bytes_before(0),
 258     _bot_updates(bot_updates),
 259     _name(name),
 260     _node_index(node_index)
 261  { }
 262 
 263 HeapRegion* MutatorAllocRegion::allocate_new_region(size_t word_size,
 264                                                     bool force) {
 265   return _g1h->new_mutator_alloc_region(word_size, force, _node_index);
 266 }
 267 
 268 void MutatorAllocRegion::retire_region(HeapRegion* alloc_region,
 269                                        size_t allocated_bytes) {
 270   _g1h->retire_mutator_alloc_region(alloc_region, allocated_bytes);
 271 }
 272 
 273 void MutatorAllocRegion::init() {
 274   assert(_retained_alloc_region == NULL, "Pre-condition");
 275   G1AllocRegion::init();
 276   _wasted_bytes = 0;
 277 }
 278 
 279 bool MutatorAllocRegion::should_retain(HeapRegion* region) {
 280   size_t free_bytes = region->free();
 281   if (free_bytes < MinTLABSize) {
 282     return false;
 283   }
 284 
 285   if (_retained_alloc_region != NULL &&


< prev index next >