8155082: Refactor mutator region restriction

Reviewed-by: mgerdin, tschatzl
This commit is contained in:
Stefan Johansson 2016-04-27 16:02:02 +02:00
parent 7597372ba5
commit b2c560bc98
4 changed files with 7 additions and 7 deletions

View file

@ -5318,14 +5318,14 @@ HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size,
assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
assert(!force || g1_policy()->can_expand_young_list(), assert(!force || g1_policy()->can_expand_young_list(),
"if force is true we should be able to expand the young list"); "if force is true we should be able to expand the young list");
bool young_list_full = g1_policy()->is_young_list_full(); bool should_allocate = g1_policy()->should_allocate_mutator_region();
if (force || !young_list_full) { if (force || should_allocate) {
HeapRegion* new_alloc_region = new_region(word_size, HeapRegion* new_alloc_region = new_region(word_size,
false /* is_old */, false /* is_old */,
false /* do_expand */); false /* do_expand */);
if (new_alloc_region != NULL) { if (new_alloc_region != NULL) {
set_region_short_lived_locked(new_alloc_region); set_region_short_lived_locked(new_alloc_region);
_hr_printer.alloc(new_alloc_region, young_list_full); _hr_printer.alloc(new_alloc_region, !should_allocate);
_verifier->check_bitmaps("Mutator Region Allocation", new_alloc_region); _verifier->check_bitmaps("Mutator Region Allocation", new_alloc_region);
return new_alloc_region; return new_alloc_region;
} }

View file

@ -911,10 +911,10 @@ void G1DefaultPolicy::print_yg_surv_rate_info() const {
#endif // PRODUCT #endif // PRODUCT
} }
bool G1DefaultPolicy::is_young_list_full() const { bool G1DefaultPolicy::should_allocate_mutator_region() const {
uint young_list_length = _g1->young_list()->length(); uint young_list_length = _g1->young_list()->length();
uint young_list_target_length = _young_list_target_length; uint young_list_target_length = _young_list_target_length;
return young_list_length >= young_list_target_length; return young_list_length < young_list_target_length;
} }
bool G1DefaultPolicy::can_expand_young_list() const { bool G1DefaultPolicy::can_expand_young_list() const {

View file

@ -384,7 +384,7 @@ public:
size_t young_list_target_length() const { return _young_list_target_length; } size_t young_list_target_length() const { return _young_list_target_length; }
bool is_young_list_full() const; bool should_allocate_mutator_region() const;
bool can_expand_young_list() const; bool can_expand_young_list() const;

View file

@ -162,7 +162,7 @@ public:
virtual size_t young_list_target_length() const = 0; virtual size_t young_list_target_length() const = 0;
virtual bool is_young_list_full() const = 0; virtual bool should_allocate_mutator_region() const = 0;
virtual bool can_expand_young_list() const = 0; virtual bool can_expand_young_list() const = 0;