--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Fri Mar 02 10:09:08 2018 +0100
@@ -237,8 +237,7 @@
HeapWord*
G1CollectedHeap::humongous_obj_allocate_initialize_regions(uint first,
uint num_regions,
- size_t word_size,
- AllocationContext_t context) {
+ size_t word_size) {
assert(first != G1_NO_HRM_INDEX, "pre-condition");
assert(is_humongous(word_size), "word_size should be humongous");
assert(num_regions * HeapRegion::GrainWords >= word_size, "pre-condition");
@@ -302,14 +301,12 @@
// that there is a single object that starts at the bottom of the
// first region.
first_hr->set_starts_humongous(obj_top, word_fill_size);
- first_hr->set_allocation_context(context);
// Then, if there are any, we will set up the "continues
// humongous" regions.
HeapRegion* hr = NULL;
for (uint i = first + 1; i <= last; ++i) {
hr = region_at(i);
hr->set_continues_humongous(first_hr);
- hr->set_allocation_context(context);
}
// Up to this point no concurrent thread would have been able to
@@ -362,7 +359,7 @@
// If could fit into free regions w/o expansion, try.
// Otherwise, if can expand, do so.
// Otherwise, if using ex regions might help, try with ex given back.
-HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size, AllocationContext_t context) {
+HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) {
assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
_verifier->verify_region_sets_optional();
@@ -428,8 +425,7 @@
HeapWord* result = NULL;
if (first != G1_NO_HRM_INDEX) {
- result = humongous_obj_allocate_initialize_regions(first, obj_regions,
- word_size, context);
+ result = humongous_obj_allocate_initialize_regions(first, obj_regions, word_size);
assert(result != NULL, "it should always return a valid result");
// A successful humongous object allocation changes the used space
@@ -461,8 +457,7 @@
return attempt_allocation(word_size);
}
-HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size,
- AllocationContext_t context) {
+HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) {
ResourceMark rm; // For retrieving the thread names in log messages.
// Make sure you read the note in attempt_allocation_humongous().
@@ -485,7 +480,7 @@
{
MutexLockerEx x(Heap_lock);
- result = _allocator->attempt_allocation_locked(word_size, context);
+ result = _allocator->attempt_allocation_locked(word_size);
if (result != NULL) {
return result;
}
@@ -496,7 +491,7 @@
if (GCLocker::is_active_and_needs_gc() && g1_policy()->can_expand_young_list()) {
// No need for an ergo message here, can_expand_young_list() does this when
// it returns true.
- result = _allocator->attempt_allocation_force(word_size, context);
+ result = _allocator->attempt_allocation_force(word_size);
if (result != NULL) {
return result;
}
@@ -553,7 +548,7 @@
// follow-on attempt will be at the start of the next loop
// iteration (after taking the Heap_lock).
- result = _allocator->attempt_allocation(word_size, context);
+ result = _allocator->attempt_allocation(word_size);
if (result != NULL) {
return result;
}
@@ -685,7 +680,7 @@
}
// Mark each G1 region touched by the range as archive, add it to
- // the old set, and set the allocation context and top.
+ // the old set, and set top.
HeapRegion* curr_region = _hrm.addr_to_region(start_address);
HeapRegion* last_region = _hrm.addr_to_region(last_address);
prev_last_region = last_region;
@@ -693,7 +688,6 @@
while (curr_region != NULL) {
assert(curr_region->is_empty() && !curr_region->is_pinned(),
"Region already in use (index %u)", curr_region->hrm_index());
- curr_region->set_allocation_context(AllocationContext::system());
if (open) {
curr_region->set_open_archive();
} else {
@@ -788,11 +782,10 @@
assert(!is_humongous(word_size), "attempt_allocation() should not "
"be called for humongous allocation requests");
- AllocationContext_t context = AllocationContext::current();
- HeapWord* result = _allocator->attempt_allocation(word_size, context);
+ HeapWord* result = _allocator->attempt_allocation(word_size);
if (result == NULL) {
- result = attempt_allocation_slow(word_size, context);
+ result = attempt_allocation_slow(word_size);
}
assert_heap_not_locked();
if (result != NULL) {
@@ -917,7 +910,7 @@
// Given that humongous objects are not allocated in young
// regions, we'll first try to do the allocation without doing a
// collection hoping that there's enough space in the heap.
- result = humongous_obj_allocate(word_size, AllocationContext::current());
+ result = humongous_obj_allocate(word_size);
if (result != NULL) {
size_t size_in_regions = humongous_obj_size_in_regions(word_size);
g1_policy()->add_bytes_allocated_in_old_since_last_gc(size_in_regions * HeapRegion::GrainBytes);
@@ -989,16 +982,15 @@
}
HeapWord* G1CollectedHeap::attempt_allocation_at_safepoint(size_t word_size,
- AllocationContext_t context,
bool expect_null_mutator_alloc_region) {
assert_at_safepoint(true /* should_be_vm_thread */);
- assert(!_allocator->has_mutator_alloc_region(context) || !expect_null_mutator_alloc_region,
+ assert(!_allocator->has_mutator_alloc_region() || !expect_null_mutator_alloc_region,
"the current alloc region was unexpectedly found to be non-NULL");
if (!is_humongous(word_size)) {
- return _allocator->attempt_allocation_locked(word_size, context);
+ return _allocator->attempt_allocation_locked(word_size);
} else {
- HeapWord* result = humongous_obj_allocate(word_size, context);
+ HeapWord* result = humongous_obj_allocate(word_size);
if (result != NULL && g1_policy()->need_to_start_conc_mark("STW humongous allocation")) {
collector_state()->set_initiate_conc_mark_if_possible(true);
}
@@ -1270,7 +1262,6 @@
}
HeapWord* G1CollectedHeap::satisfy_failed_allocation_helper(size_t word_size,
- AllocationContext_t context,
bool do_gc,
bool clear_all_soft_refs,
bool expect_null_mutator_alloc_region,
@@ -1279,7 +1270,6 @@
// Let's attempt the allocation first.
HeapWord* result =
attempt_allocation_at_safepoint(word_size,
- context,
expect_null_mutator_alloc_region);
if (result != NULL) {
return result;
@@ -1289,7 +1279,7 @@
// incremental pauses. Therefore, at least for now, we'll favor
// expansion over collection. (This might change in the future if we can
// do something smarter than full collection to satisfy a failed alloc.)
- result = expand_and_allocate(word_size, context);
+ result = expand_and_allocate(word_size);
if (result != NULL) {
return result;
}
@@ -1304,14 +1294,12 @@
}
HeapWord* G1CollectedHeap::satisfy_failed_allocation(size_t word_size,
- AllocationContext_t context,
bool* succeeded) {
assert_at_safepoint(true /* should_be_vm_thread */);
// Attempts to allocate followed by Full GC.
HeapWord* result =
satisfy_failed_allocation_helper(word_size,
- context,
true, /* do_gc */
false, /* clear_all_soft_refs */
false, /* expect_null_mutator_alloc_region */
@@ -1323,7 +1311,6 @@
// Attempts to allocate followed by Full GC that will collect all soft references.
result = satisfy_failed_allocation_helper(word_size,
- context,
true, /* do_gc */
true, /* clear_all_soft_refs */
true, /* expect_null_mutator_alloc_region */
@@ -1335,7 +1322,6 @@
// Attempts to allocate, no GC
result = satisfy_failed_allocation_helper(word_size,
- context,
false, /* do_gc */
false, /* clear_all_soft_refs */
true, /* expect_null_mutator_alloc_region */
@@ -1360,7 +1346,7 @@
// successful, perform the allocation and return the address of the
// allocated block, or else "NULL".
-HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size, AllocationContext_t context) {
+HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) {
assert_at_safepoint(true /* should_be_vm_thread */);
_verifier->verify_region_sets_optional();
@@ -1374,7 +1360,6 @@
_hrm.verify_optional();
_verifier->verify_region_sets_optional();
return attempt_allocation_at_safepoint(word_size,
- context,
false /* expect_null_mutator_alloc_region */);
}
return NULL;
@@ -2025,8 +2010,7 @@
for (uintx i = 0; i < G1DummyRegionsPerGC; ++i) {
// Let's use the existing mechanism for the allocation
- HeapWord* dummy_obj = humongous_obj_allocate(word_size,
- AllocationContext::system());
+ HeapWord* dummy_obj = humongous_obj_allocate(word_size);
if (dummy_obj != NULL) {
MemRegion mr(dummy_obj, word_size);
CollectedHeap::fill_with_object(mr);
@@ -2124,8 +2108,7 @@
gc_count_before,
cause,
true, /* should_initiate_conc_mark */
- g1_policy()->max_pause_time_ms(),
- AllocationContext::current());
+ g1_policy()->max_pause_time_ms());
VMThread::execute(&op);
if (!op.pause_succeeded()) {
if (old_marking_count_before == _old_marking_cycles_started) {
@@ -2152,8 +2135,7 @@
gc_count_before,
cause,
false, /* should_initiate_conc_mark */
- g1_policy()->max_pause_time_ms(),
- AllocationContext::current());
+ g1_policy()->max_pause_time_ms());
VMThread::execute(&op);
} else {
// Schedule a Full GC.
@@ -2266,8 +2248,7 @@
}
size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const {
- AllocationContext_t context = AllocationContext::current();
- return _allocator->unsafe_max_tlab_alloc(context);
+ return _allocator->unsafe_max_tlab_alloc();
}
size_t G1CollectedHeap::max_capacity() const {
@@ -2371,7 +2352,6 @@
st->print_cr("Heap Regions: E=young(eden), S=young(survivor), O=old, "
"HS=humongous(starts), HC=humongous(continues), "
"CS=collection set, F=free, A=archive, TS=gc time stamp, "
- "AC=allocation context, "
"TAMS=top-at-mark-start (previous, next)");
PrintRegionClosure blk(st);
heap_region_iterate(&blk);
@@ -2566,8 +2546,7 @@
gc_count_before,
gc_cause,
false, /* should_initiate_conc_mark */
- g1_policy()->max_pause_time_ms(),
- AllocationContext::current());
+ g1_policy()->max_pause_time_ms());
VMThread::execute(&op);
HeapWord* result = op.result();
@@ -5075,7 +5054,6 @@
if (r->is_empty()) {
// Add free regions to the free list
r->set_free();
- r->set_allocation_context(AllocationContext::system());
_hrm->insert_into_free_list(r);
} else if (!_free_list_only) {