# HG changeset patch # User pliden # Date 1428674866 -7200 # Fri Apr 10 16:07:46 2015 +0200 # Node ID b5ae41e00f3e1835f399929ac65f7810cc21fb49 # Parent dd7763176efa977a2befd0f99d3283f40a10f75c imported patch g1_cleanup diff --git a/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/src/share/vm/gc_implementation/g1/concurrentMark.cpp --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -1326,7 +1326,7 @@ if (VerifyDuringGC) { HandleMark hm; // handle scope - Universe::heap()->prepare_for_verify(); + g1h->prepare_for_verify(); Universe::verify(VerifyOption_G1UsePrevMarking, " VerifyDuringGC:(before)"); } @@ -1353,7 +1353,7 @@ // Verify the heap w.r.t. the previous marking bitmap. if (VerifyDuringGC) { HandleMark hm; // handle scope - Universe::heap()->prepare_for_verify(); + g1h->prepare_for_verify(); Universe::verify(VerifyOption_G1UsePrevMarking, " VerifyDuringGC:(overflow)"); } @@ -1379,7 +1379,7 @@ if (VerifyDuringGC) { HandleMark hm; // handle scope - Universe::heap()->prepare_for_verify(); + g1h->prepare_for_verify(); Universe::verify(VerifyOption_G1UseNextMarking, " VerifyDuringGC:(after)"); } @@ -1987,13 +1987,13 @@ if (VerifyDuringGC) { HandleMark hm; // handle scope - Universe::heap()->prepare_for_verify(); + g1h->prepare_for_verify(); Universe::verify(VerifyOption_G1UsePrevMarking, " VerifyDuringGC:(before)"); } g1h->check_bitmaps("Cleanup Start"); - G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); + G1CollectorPolicy* g1p = g1h->g1_policy(); g1p->record_concurrent_mark_cleanup_start(); double start = os::elapsedTime(); @@ -2098,7 +2098,7 @@ if (VerifyDuringGC) { HandleMark hm; // handle scope - Universe::heap()->prepare_for_verify(); + g1h->prepare_for_verify(); Universe::verify(VerifyOption_G1UsePrevMarking, " VerifyDuringGC:(after)"); } diff --git a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp --- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp +++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "gc_implementation/g1/g1CollectedHeap.hpp" #include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp" #include "gc_implementation/g1/heapRegion.hpp" #include "memory/space.hpp" @@ -303,9 +304,9 @@ assert(blk_start <= threshold, "blk_start should be at or before threshold"); assert(pointer_delta(threshold, blk_start) <= N_words, "offset should be <= BlockOffsetSharedArray::N"); - assert(Universe::heap()->is_in_reserved(blk_start), + assert(G1CollectedHeap::heap()->is_in_reserved(blk_start), "reference must be into the heap"); - assert(Universe::heap()->is_in_reserved(blk_end-1), + assert(G1CollectedHeap::heap()->is_in_reserved(blk_end-1), "limit must be within the heap"); assert(threshold == _array->_reserved.start() + index*N_words, "index must agree with threshold"); @@ -458,7 +459,7 @@ } HeapWord* G1BlockOffsetArrayContigSpace::initialize_threshold_raw() { - assert(!Universe::heap()->is_in_reserved(_array->_offset_array), + assert(!G1CollectedHeap::heap()->is_in_reserved(_array->_offset_array), "just checking"); _next_offset_index = _array->index_for_raw(_bottom); _next_offset_index++; @@ -468,7 +469,7 @@ } void G1BlockOffsetArrayContigSpace::zero_bottom_entry_raw() { - assert(!Universe::heap()->is_in_reserved(_array->_offset_array), + assert(!G1CollectedHeap::heap()->is_in_reserved(_array->_offset_array), "just checking"); size_t bottom_index = _array->index_for_raw(_bottom); assert(_array->address_for_index_raw(bottom_index) == _bottom, @@ -477,7 +478,7 @@ } HeapWord* G1BlockOffsetArrayContigSpace::initialize_threshold() { - assert(!Universe::heap()->is_in_reserved(_array->_offset_array), + assert(!G1CollectedHeap::heap()->is_in_reserved(_array->_offset_array), "just checking"); _next_offset_index = _array->index_for(_bottom); _next_offset_index++; diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -3317,6 +3317,8 @@ #endif // PRODUCT G1CollectedHeap* G1CollectedHeap::heap() { + assert(_g1h != NULL, "Uninitialized access to G1CollectedHeap::heap()"); + assert(_g1h->kind() == CollectedHeap::G1CollectedHeap, "Not a G1 heap"); return _g1h; } diff --git a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp --- a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp +++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @@ -101,11 +101,6 @@ BiasedLocking::restore_marks(); GenMarkSweep::deallocate_stacks(); - // "free at last gc" is calculated from these. - // CHF: cheating for now!!! - // Universe::set_heap_capacity_at_last_gc(Universe::heap()->capacity()); - // Universe::set_heap_used_at_last_gc(Universe::heap()->used()); - CodeCache::gc_epilogue(); JvmtiExport::gc_epilogue(); @@ -167,12 +162,12 @@ Klass::clean_weak_klass_links(&GenMarkSweep::is_alive); // Delete entries for dead interned string and clean up unreferenced symbols in symbol table. - G1CollectedHeap::heap()->unlink_string_and_symbol_table(&GenMarkSweep::is_alive); + g1h->unlink_string_and_symbol_table(&GenMarkSweep::is_alive); if (VerifyDuringGC) { HandleMark hm; // handle scope COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact); - Universe::heap()->prepare_for_verify(); + g1h->prepare_for_verify(); // Note: we can verify only the heap here. When an object is // marked, the previous value of the mark word (including // identity hash values, ages, etc) is preserved, and the mark @@ -186,7 +181,7 @@ if (!VerifySilently) { gclog_or_tty->print(" VerifyDuringGC:(full)[Verifying "); } - Universe::heap()->verify(VerifySilently, VerifyOption_G1UseMarkWord); + g1h->verify(VerifySilently, VerifyOption_G1UseMarkWord); if (!VerifySilently) { gclog_or_tty->print_cr("]"); } diff --git a/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp b/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp --- a/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp +++ b/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp @@ -172,7 +172,7 @@ oopDesc* o = obj; #endif // CHECK_UNHANDLED_OOPS assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned"); - assert(Universe::heap()->is_in_reserved(obj), "must be in heap"); + assert(_g1->is_in_reserved(obj), "must be in heap"); #endif // ASSERT assert(_from != NULL, "from region must be non-NULL"); diff --git a/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp b/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp --- a/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp +++ b/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp @@ -63,7 +63,7 @@ assert(has_partial_array_mask(p), "invariant"); oop from_obj = clear_partial_array_mask(p); - assert(Universe::heap()->is_in_reserved(from_obj), "must be in heap."); + assert(_g1h->is_in_reserved(from_obj), "must be in heap."); assert(from_obj->is_objArray(), "must be obj array"); objArrayOop from_obj_array = objArrayOop(from_obj); // The from-space object contains the real length. diff --git a/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp b/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp --- a/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp +++ b/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp @@ -57,7 +57,7 @@ oopDesc* o = obj; #endif // CHECK_UNHANDLED_OOPS assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned"); - assert(Universe::heap()->is_in_reserved(obj), "must be in heap"); + assert(_g1->is_in_reserved(obj), "must be in heap"); #endif // ASSERT assert(from == NULL || from->is_in_reserved(p), "p is not in from"); diff --git a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp --- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp +++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp @@ -206,7 +206,7 @@ if (new_val == NULL) return; // Otherwise, log it. G1SATBCardTableLoggingModRefBS* g1_bs = - barrier_set_cast(Universe::heap()->barrier_set()); + barrier_set_cast(G1CollectedHeap::heap()->barrier_set()); g1_bs->write_ref_field_work(field, new_val); } diff --git a/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp b/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp --- a/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp +++ b/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" +#include "gc_implementation/g1/g1CollectedHeap.hpp" #include "gc_implementation/g1/g1StringDedup.hpp" #include "gc_implementation/g1/g1StringDedupQueue.hpp" #include "memory/gcLocker.hpp" @@ -163,7 +164,7 @@ while (!iter.is_empty()) { oop obj = iter.next(); if (obj != NULL) { - guarantee(Universe::heap()->is_in_reserved(obj), "Object must be on the heap"); + guarantee(G1CollectedHeap::heap()->is_in_reserved(obj), "Object must be on the heap"); guarantee(!obj->is_forwarded(), "Object must not be forwarded"); guarantee(java_lang_String::is_instance(obj), "Object must be a String"); } diff --git a/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp b/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp --- a/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp +++ b/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp @@ -519,7 +519,7 @@ while (*entry != NULL) { typeArrayOop value = (*entry)->obj(); guarantee(value != NULL, "Object must not be NULL"); - guarantee(Universe::heap()->is_in_reserved(value), "Object must be on the heap"); + guarantee(G1CollectedHeap::heap()->is_in_reserved(value), "Object must be on the heap"); guarantee(!value->is_forwarded(), "Object must not be forwarded"); guarantee(value->is_typeArray(), "Object must be a typeArrayOop"); unsigned int hash = hash_code(value);