8004132: SerialGC: ValidateMarkSweep broken when running GCOld
Summary: Remove bit-rotten ValidateMarkSweep functionality and flag.
Reviewed-by: johnc, jmasa
Contributed-by: tamao <tao.mao@oracle.com>
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Wed Jan 02 11:32:41 2013 -0800
@@ -214,7 +214,6 @@
assert(q->forwardee() == NULL, "should be forwarded to NULL");
}
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(q, adjusted_size));
compact_top += adjusted_size;
// we need to update the offset table so that the beginnings of objects can be
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Wed Jan 02 11:32:41 2013 -0800
@@ -282,10 +282,8 @@
if (r->startsHumongous()) {
// We must adjust the pointers on the single H object.
oop obj = oop(r->bottom());
- debug_only(GenMarkSweep::track_interior_pointers(obj));
// point all the oops to the new location
obj->adjust_pointers();
- debug_only(GenMarkSweep::check_interior_pointers());
}
} else {
// This really ought to be "as_CompactibleSpace"...
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp Wed Jan 02 11:32:41 2013 -0800
@@ -164,7 +164,6 @@
start_array->allocate_block(compact_top);
}
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(oop(q), size));
compact_top += size;
assert(compact_top <= dest->space()->end(),
"Exceeding space in destination");
@@ -225,7 +224,6 @@
start_array->allocate_block(compact_top);
}
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(oop(q), sz));
compact_top += sz;
assert(compact_top <= dest->space()->end(),
"Exceeding space in destination");
@@ -304,11 +302,8 @@
HeapWord* end = _first_dead;
while (q < end) {
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
// point all the oops to the new location
size_t size = oop(q)->adjust_pointers();
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
q += size;
}
@@ -328,11 +323,8 @@
Prefetch::write(q, interval);
if (oop(q)->is_gc_marked()) {
// q is alive
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
// point all the oops to the new location
size_t size = oop(q)->adjust_pointers();
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
debug_only(prev_q = q);
q += size;
} else {
@@ -366,7 +358,6 @@
while (q < end) {
size_t size = oop(q)->size();
assert(!oop(q)->is_gc_marked(), "should be unmarked (special dense prefix handling)");
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, q));
debug_only(prev_q = q);
q += size;
}
@@ -401,7 +392,6 @@
Prefetch::write(compaction_top, copy_interval);
// copy object and reinit its mark
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, compaction_top));
assert(q != compaction_top, "everything in this pass should be moving");
Copy::aligned_conjoint_words(q, compaction_top, size);
oop(compaction_top)->init_mark();
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Wed Jan 02 11:32:41 2013 -0800
@@ -99,25 +99,6 @@
bool PSParallelCompact::_dwl_initialized = false;
#endif // #ifdef ASSERT
-#ifdef VALIDATE_MARK_SWEEP
-GrowableArray<void*>* PSParallelCompact::_root_refs_stack = NULL;
-GrowableArray<oop> * PSParallelCompact::_live_oops = NULL;
-GrowableArray<oop> * PSParallelCompact::_live_oops_moved_to = NULL;
-GrowableArray<size_t>* PSParallelCompact::_live_oops_size = NULL;
-size_t PSParallelCompact::_live_oops_index = 0;
-GrowableArray<void*>* PSParallelCompact::_other_refs_stack = NULL;
-GrowableArray<void*>* PSParallelCompact::_adjusted_pointers = NULL;
-bool PSParallelCompact::_pointer_tracking = false;
-bool PSParallelCompact::_root_tracking = true;
-
-GrowableArray<HeapWord*>* PSParallelCompact::_cur_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* PSParallelCompact::_cur_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t> * PSParallelCompact::_cur_gc_live_oops_size = NULL;
-GrowableArray<HeapWord*>* PSParallelCompact::_last_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* PSParallelCompact::_last_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t> * PSParallelCompact::_last_gc_live_oops_size = NULL;
-#endif
-
void SplitInfo::record(size_t src_region_idx, size_t partial_obj_size,
HeapWord* destination)
{
@@ -2715,151 +2696,6 @@
}
#endif // #ifdef ASSERT
-
-#ifdef VALIDATE_MARK_SWEEP
-
-void PSParallelCompact::track_adjusted_pointer(void* p, bool isroot) {
- if (!ValidateMarkSweep)
- return;
-
- if (!isroot) {
- if (_pointer_tracking) {
- guarantee(_adjusted_pointers->contains(p), "should have seen this pointer");
- _adjusted_pointers->remove(p);
- }
- } else {
- ptrdiff_t index = _root_refs_stack->find(p);
- if (index != -1) {
- int l = _root_refs_stack->length();
- if (l > 0 && l - 1 != index) {
- void* last = _root_refs_stack->pop();
- assert(last != p, "should be different");
- _root_refs_stack->at_put(index, last);
- } else {
- _root_refs_stack->remove(p);
- }
- }
- }
-}
-
-
-void PSParallelCompact::check_adjust_pointer(void* p) {
- _adjusted_pointers->push(p);
-}
-
-
-class AdjusterTracker: public OopClosure {
- public:
- AdjusterTracker() {};
- void do_oop(oop* o) { PSParallelCompact::check_adjust_pointer(o); }
- void do_oop(narrowOop* o) { PSParallelCompact::check_adjust_pointer(o); }
-};
-
-
-void PSParallelCompact::track_interior_pointers(oop obj) {
- if (ValidateMarkSweep) {
- _adjusted_pointers->clear();
- _pointer_tracking = true;
-
- AdjusterTracker checker;
- obj->oop_iterate_no_header(&checker);
- }
-}
-
-
-void PSParallelCompact::check_interior_pointers() {
- if (ValidateMarkSweep) {
- _pointer_tracking = false;
- guarantee(_adjusted_pointers->length() == 0, "should have processed the same pointers");
- }
-}
-
-
-void PSParallelCompact::reset_live_oop_tracking() {
- if (ValidateMarkSweep) {
- guarantee((size_t)_live_oops->length() == _live_oops_index, "should be at end of live oops");
- _live_oops_index = 0;
- }
-}
-
-
-void PSParallelCompact::register_live_oop(oop p, size_t size) {
- if (ValidateMarkSweep) {
- _live_oops->push(p);
- _live_oops_size->push(size);
- _live_oops_index++;
- }
-}
-
-void PSParallelCompact::validate_live_oop(oop p, size_t size) {
- if (ValidateMarkSweep) {
- oop obj = _live_oops->at((int)_live_oops_index);
- guarantee(obj == p, "should be the same object");
- guarantee(_live_oops_size->at((int)_live_oops_index) == size, "should be the same size");
- _live_oops_index++;
- }
-}
-
-void PSParallelCompact::live_oop_moved_to(HeapWord* q, size_t size,
- HeapWord* compaction_top) {
- assert(oop(q)->forwardee() == NULL || oop(q)->forwardee() == oop(compaction_top),
- "should be moved to forwarded location");
- if (ValidateMarkSweep) {
- PSParallelCompact::validate_live_oop(oop(q), size);
- _live_oops_moved_to->push(oop(compaction_top));
- }
- if (RecordMarkSweepCompaction) {
- _cur_gc_live_oops->push(q);
- _cur_gc_live_oops_moved_to->push(compaction_top);
- _cur_gc_live_oops_size->push(size);
- }
-}
-
-
-void PSParallelCompact::compaction_complete() {
- if (RecordMarkSweepCompaction) {
- GrowableArray<HeapWord*>* _tmp_live_oops = _cur_gc_live_oops;
- GrowableArray<HeapWord*>* _tmp_live_oops_moved_to = _cur_gc_live_oops_moved_to;
- GrowableArray<size_t> * _tmp_live_oops_size = _cur_gc_live_oops_size;
-
- _cur_gc_live_oops = _last_gc_live_oops;
- _cur_gc_live_oops_moved_to = _last_gc_live_oops_moved_to;
- _cur_gc_live_oops_size = _last_gc_live_oops_size;
- _last_gc_live_oops = _tmp_live_oops;
- _last_gc_live_oops_moved_to = _tmp_live_oops_moved_to;
- _last_gc_live_oops_size = _tmp_live_oops_size;
- }
-}
-
-
-void PSParallelCompact::print_new_location_of_heap_address(HeapWord* q) {
- if (!RecordMarkSweepCompaction) {
- tty->print_cr("Requires RecordMarkSweepCompaction to be enabled");
- return;
- }
-
- if (_last_gc_live_oops == NULL) {
- tty->print_cr("No compaction information gathered yet");
- return;
- }
-
- for (int i = 0; i < _last_gc_live_oops->length(); i++) {
- HeapWord* old_oop = _last_gc_live_oops->at(i);
- size_t sz = _last_gc_live_oops_size->at(i);
- if (old_oop <= q && q < (old_oop + sz)) {
- HeapWord* new_oop = _last_gc_live_oops_moved_to->at(i);
- size_t offset = (q - old_oop);
- tty->print_cr("Address " PTR_FORMAT, q);
- tty->print_cr(" Was in oop " PTR_FORMAT ", size %d, at offset %d", old_oop, sz, offset);
- tty->print_cr(" Now in oop " PTR_FORMAT ", actual address " PTR_FORMAT, new_oop, new_oop + offset);
- return;
- }
- }
-
- tty->print_cr("Address " PTR_FORMAT " not found in live oop information from last GC", q);
-}
-#endif //VALIDATE_MARK_SWEEP
-
// Update interior oops in the ranges of regions [beg_region, end_region).
void
PSParallelCompact::update_and_deadwood_in_dense_prefix(ParCompactionManager* cm,
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp Wed Jan 02 11:32:41 2013 -0800
@@ -1006,34 +1006,6 @@
// Reset time since last full gc
static void reset_millis_since_last_gc();
- protected:
-#ifdef VALIDATE_MARK_SWEEP
- static GrowableArray<void*>* _root_refs_stack;
- static GrowableArray<oop> * _live_oops;
- static GrowableArray<oop> * _live_oops_moved_to;
- static GrowableArray<size_t>* _live_oops_size;
- static size_t _live_oops_index;
- static size_t _live_oops_index_at_perm;
- static GrowableArray<void*>* _other_refs_stack;
- static GrowableArray<void*>* _adjusted_pointers;
- static bool _pointer_tracking;
- static bool _root_tracking;
-
- // The following arrays are saved since the time of the last GC and
- // assist in tracking down problems where someone has done an errant
- // store into the heap, usually to an oop that wasn't properly
- // handleized across a GC. If we crash or otherwise fail before the
- // next GC, we can query these arrays to find out the object we had
- // intended to do the store to (assuming it is still alive) and the
- // offset within that object. Covered under RecordMarkSweepCompaction.
- static GrowableArray<HeapWord*> * _cur_gc_live_oops;
- static GrowableArray<HeapWord*> * _cur_gc_live_oops_moved_to;
- static GrowableArray<size_t>* _cur_gc_live_oops_size;
- static GrowableArray<HeapWord*> * _last_gc_live_oops;
- static GrowableArray<HeapWord*> * _last_gc_live_oops_moved_to;
- static GrowableArray<size_t>* _last_gc_live_oops_size;
-#endif
-
public:
class MarkAndPushClosure: public OopClosure {
private:
@@ -1191,25 +1163,6 @@
// Time since last full gc (in milliseconds).
static jlong millis_since_last_gc();
-#ifdef VALIDATE_MARK_SWEEP
- static void track_adjusted_pointer(void* p, bool isroot);
- static void check_adjust_pointer(void* p);
- static void track_interior_pointers(oop obj);
- static void check_interior_pointers();
-
- static void reset_live_oop_tracking();
- static void register_live_oop(oop p, size_t size);
- static void validate_live_oop(oop p, size_t size);
- static void live_oop_moved_to(HeapWord* q, size_t size, HeapWord* compaction_top);
- static void compaction_complete();
-
- // Querying operation of RecordMarkSweepCompaction results.
- // Finds and prints the current base oop and offset for a word
- // within an oop that was live during the last GC. Helpful for
- // tracking down heap stomps.
- static void print_new_location_of_heap_address(HeapWord* q);
-#endif // #ifdef VALIDATE_MARK_SWEEP
-
#ifndef PRODUCT
// Debugging support.
static const char* space_names[last_space_id];
@@ -1250,12 +1203,7 @@
inline void PSParallelCompact::follow_root(ParCompactionManager* cm, T* p) {
assert(!Universe::heap()->is_in_reserved(p),
"roots shouldn't be things within the heap");
-#ifdef VALIDATE_MARK_SWEEP
- if (ValidateMarkSweep) {
- guarantee(!_root_refs_stack->contains(p), "should only be in here once");
- _root_refs_stack->push(p);
- }
-#endif
+
T heap_oop = oopDesc::load_heap_oop(p);
if (!oopDesc::is_null(heap_oop)) {
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
@@ -1294,20 +1242,10 @@
oopDesc::encode_store_heap_oop_not_null(p, new_obj);
}
}
- VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, isroot));
}
template <class T>
inline void PSParallelCompact::KeepAliveClosure::do_oop_work(T* p) {
-#ifdef VALIDATE_MARK_SWEEP
- if (ValidateMarkSweep) {
- if (!Universe::heap()->is_in_reserved(p)) {
- _root_refs_stack->push(p);
- } else {
- _other_refs_stack->push(p);
- }
- }
-#endif
mark_and_push(_compaction_manager, p);
}
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp Wed Jan 02 11:32:41 2013 -0800
@@ -42,26 +42,6 @@
PreservedMark* MarkSweep::_preserved_marks = NULL;
ReferenceProcessor* MarkSweep::_ref_processor = NULL;
-#ifdef VALIDATE_MARK_SWEEP
-GrowableArray<void*>* MarkSweep::_root_refs_stack = NULL;
-GrowableArray<oop> * MarkSweep::_live_oops = NULL;
-GrowableArray<oop> * MarkSweep::_live_oops_moved_to = NULL;
-GrowableArray<size_t>* MarkSweep::_live_oops_size = NULL;
-size_t MarkSweep::_live_oops_index = 0;
-size_t MarkSweep::_live_oops_index_at_perm = 0;
-GrowableArray<void*>* MarkSweep::_other_refs_stack = NULL;
-GrowableArray<void*>* MarkSweep::_adjusted_pointers = NULL;
-bool MarkSweep::_pointer_tracking = false;
-bool MarkSweep::_root_tracking = true;
-
-GrowableArray<HeapWord*>* MarkSweep::_cur_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* MarkSweep::_cur_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t> * MarkSweep::_cur_gc_live_oops_size = NULL;
-GrowableArray<HeapWord*>* MarkSweep::_last_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* MarkSweep::_last_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t> * MarkSweep::_last_gc_live_oops_size = NULL;
-#endif
-
MarkSweep::FollowRootClosure MarkSweep::follow_root_closure;
CodeBlobToOopClosure MarkSweep::follow_code_root_closure(&MarkSweep::follow_root_closure, /*do_marking=*/ true);
@@ -185,142 +165,6 @@
}
}
-#ifdef VALIDATE_MARK_SWEEP
-
-void MarkSweep::track_adjusted_pointer(void* p, bool isroot) {
- if (!ValidateMarkSweep)
- return;
-
- if (!isroot) {
- if (_pointer_tracking) {
- guarantee(_adjusted_pointers->contains(p), "should have seen this pointer");
- _adjusted_pointers->remove(p);
- }
- } else {
- ptrdiff_t index = _root_refs_stack->find(p);
- if (index != -1) {
- int l = _root_refs_stack->length();
- if (l > 0 && l - 1 != index) {
- void* last = _root_refs_stack->pop();
- assert(last != p, "should be different");
- _root_refs_stack->at_put(index, last);
- } else {
- _root_refs_stack->remove(p);
- }
- }
- }
-}
-
-void MarkSweep::check_adjust_pointer(void* p) {
- _adjusted_pointers->push(p);
-}
-
-class AdjusterTracker: public OopClosure {
- public:
- AdjusterTracker() {}
- void do_oop(oop* o) { MarkSweep::check_adjust_pointer(o); }
- void do_oop(narrowOop* o) { MarkSweep::check_adjust_pointer(o); }
-};
-
-void MarkSweep::track_interior_pointers(oop obj) {
- if (ValidateMarkSweep) {
- _adjusted_pointers->clear();
- _pointer_tracking = true;
-
- AdjusterTracker checker;
- obj->oop_iterate_no_header(&checker);
- }
-}
-
-void MarkSweep::check_interior_pointers() {
- if (ValidateMarkSweep) {
- _pointer_tracking = false;
- guarantee(_adjusted_pointers->length() == 0, "should have processed the same pointers");
- }
-}
-
-void MarkSweep::reset_live_oop_tracking() {
- if (ValidateMarkSweep) {
- guarantee((size_t)_live_oops->length() == _live_oops_index, "should be at end of live oops");
- _live_oops_index = 0;
- }
-}
-
-void MarkSweep::register_live_oop(oop p, size_t size) {
- if (ValidateMarkSweep) {
- _live_oops->push(p);
- _live_oops_size->push(size);
- _live_oops_index++;
- }
-}
-
-void MarkSweep::validate_live_oop(oop p, size_t size) {
- if (ValidateMarkSweep) {
- oop obj = _live_oops->at((int)_live_oops_index);
- guarantee(obj == p, "should be the same object");
- guarantee(_live_oops_size->at((int)_live_oops_index) == size, "should be the same size");
- _live_oops_index++;
- }
-}
-
-void MarkSweep::live_oop_moved_to(HeapWord* q, size_t size,
- HeapWord* compaction_top) {
- assert(oop(q)->forwardee() == NULL || oop(q)->forwardee() == oop(compaction_top),
- "should be moved to forwarded location");
- if (ValidateMarkSweep) {
- MarkSweep::validate_live_oop(oop(q), size);
- _live_oops_moved_to->push(oop(compaction_top));
- }
- if (RecordMarkSweepCompaction) {
- _cur_gc_live_oops->push(q);
- _cur_gc_live_oops_moved_to->push(compaction_top);
- _cur_gc_live_oops_size->push(size);
- }
-}
-
-void MarkSweep::compaction_complete() {
- if (RecordMarkSweepCompaction) {
- GrowableArray<HeapWord*>* _tmp_live_oops = _cur_gc_live_oops;
- GrowableArray<HeapWord*>* _tmp_live_oops_moved_to = _cur_gc_live_oops_moved_to;
- GrowableArray<size_t> * _tmp_live_oops_size = _cur_gc_live_oops_size;
-
- _cur_gc_live_oops = _last_gc_live_oops;
- _cur_gc_live_oops_moved_to = _last_gc_live_oops_moved_to;
- _cur_gc_live_oops_size = _last_gc_live_oops_size;
- _last_gc_live_oops = _tmp_live_oops;
- _last_gc_live_oops_moved_to = _tmp_live_oops_moved_to;
- _last_gc_live_oops_size = _tmp_live_oops_size;
- }
-}
-
-void MarkSweep::print_new_location_of_heap_address(HeapWord* q) {
- if (!RecordMarkSweepCompaction) {
- tty->print_cr("Requires RecordMarkSweepCompaction to be enabled");
- return;
- }
-
- if (_last_gc_live_oops == NULL) {
- tty->print_cr("No compaction information gathered yet");
- return;
- }
-
- for (int i = 0; i < _last_gc_live_oops->length(); i++) {
- HeapWord* old_oop = _last_gc_live_oops->at(i);
- size_t sz = _last_gc_live_oops_size->at(i);
- if (old_oop <= q && q < (old_oop + sz)) {
- HeapWord* new_oop = _last_gc_live_oops_moved_to->at(i);
- size_t offset = (q - old_oop);
- tty->print_cr("Address " PTR_FORMAT, q);
- tty->print_cr(" Was in oop " PTR_FORMAT ", size " SIZE_FORMAT ", at offset " SIZE_FORMAT, old_oop, sz, offset);
- tty->print_cr(" Now in oop " PTR_FORMAT ", actual address " PTR_FORMAT, new_oop, new_oop + offset);
- return;
- }
- }
-
- tty->print_cr("Address " PTR_FORMAT " not found in live oop information from last GC", q);
-}
-#endif //VALIDATE_MARK_SWEEP
-
MarkSweep::IsAliveClosure MarkSweep::is_alive;
void MarkSweep::IsAliveClosure::do_object(oop p) { ShouldNotReachHere(); }
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp Wed Jan 02 11:32:41 2013 -0800
@@ -44,21 +44,6 @@
//
// Class unloading will only occur when a full gc is invoked.
-// If VALIDATE_MARK_SWEEP is defined, the -XX:+ValidateMarkSweep flag will
-// be operational, and will provide slow but comprehensive self-checks within
-// the GC. This is not enabled by default in product or release builds,
-// since the extra call to track_adjusted_pointer() in _adjust_pointer()
-// would be too much overhead, and would disturb performance measurement.
-// However, debug builds are sometimes way too slow to run GC tests!
-#ifdef ASSERT
-#define VALIDATE_MARK_SWEEP 1
-#endif
-#ifdef VALIDATE_MARK_SWEEP
-#define VALIDATE_MARK_SWEEP_ONLY(code) code
-#else
-#define VALIDATE_MARK_SWEEP_ONLY(code)
-#endif
-
// declared at end
class PreservedMark;
@@ -147,33 +132,6 @@
// Reference processing (used in ...follow_contents)
static ReferenceProcessor* _ref_processor;
-#ifdef VALIDATE_MARK_SWEEP
- static GrowableArray<void*>* _root_refs_stack;
- static GrowableArray<oop> * _live_oops;
- static GrowableArray<oop> * _live_oops_moved_to;
- static GrowableArray<size_t>* _live_oops_size;
- static size_t _live_oops_index;
- static size_t _live_oops_index_at_perm;
- static GrowableArray<void*>* _other_refs_stack;
- static GrowableArray<void*>* _adjusted_pointers;
- static bool _pointer_tracking;
- static bool _root_tracking;
-
- // The following arrays are saved since the time of the last GC and
- // assist in tracking down problems where someone has done an errant
- // store into the heap, usually to an oop that wasn't properly
- // handleized across a GC. If we crash or otherwise fail before the
- // next GC, we can query these arrays to find out the object we had
- // intended to do the store to (assuming it is still alive) and the
- // offset within that object. Covered under RecordMarkSweepCompaction.
- static GrowableArray<HeapWord*> * _cur_gc_live_oops;
- static GrowableArray<HeapWord*> * _cur_gc_live_oops_moved_to;
- static GrowableArray<size_t>* _cur_gc_live_oops_size;
- static GrowableArray<HeapWord*> * _last_gc_live_oops;
- static GrowableArray<HeapWord*> * _last_gc_live_oops_moved_to;
- static GrowableArray<size_t>* _last_gc_live_oops_size;
-#endif
-
// Non public closures
static KeepAliveClosure keep_alive;
@@ -227,24 +185,6 @@
static void adjust_pointer(oop* p) { adjust_pointer(p, false); }
static void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); }
-#ifdef VALIDATE_MARK_SWEEP
- static void track_adjusted_pointer(void* p, bool isroot);
- static void check_adjust_pointer(void* p);
- static void track_interior_pointers(oop obj);
- static void check_interior_pointers();
-
- static void reset_live_oop_tracking();
- static void register_live_oop(oop p, size_t size);
- static void validate_live_oop(oop p, size_t size);
- static void live_oop_moved_to(HeapWord* q, size_t size, HeapWord* compaction_top);
- static void compaction_complete();
-
- // Querying operation of RecordMarkSweepCompaction results.
- // Finds and prints the current base oop and offset for a word
- // within an oop that was live during the last GC. Helpful for
- // tracking down heap stomps.
- static void print_new_location_of_heap_address(HeapWord* q);
-#endif
};
class PreservedMark VALUE_OBJ_CLASS_SPEC {
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp Wed Jan 02 11:32:41 2013 -0800
@@ -46,12 +46,6 @@
template <class T> inline void MarkSweep::follow_root(T* p) {
assert(!Universe::heap()->is_in_reserved(p),
"roots shouldn't be things within the heap");
-#ifdef VALIDATE_MARK_SWEEP
- if (ValidateMarkSweep) {
- guarantee(!_root_refs_stack->contains(p), "should only be in here once");
- _root_refs_stack->push(p);
- }
-#endif
T heap_oop = oopDesc::load_heap_oop(p);
if (!oopDesc::is_null(heap_oop)) {
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
@@ -97,19 +91,9 @@
oopDesc::encode_store_heap_oop_not_null(p, new_obj);
}
}
- VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, isroot));
}
template <class T> inline void MarkSweep::KeepAliveClosure::do_oop_work(T* p) {
-#ifdef VALIDATE_MARK_SWEEP
- if (ValidateMarkSweep) {
- if (!Universe::heap()->is_in_reserved(p)) {
- _root_refs_stack->push(p);
- } else {
- _other_refs_stack->push(p);
- }
- }
-#endif
mark_and_push(p);
}
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp Wed Jan 02 11:32:41 2013 -0800
@@ -100,21 +100,8 @@
mark_sweep_phase3(level);
- VALIDATE_MARK_SWEEP_ONLY(
- if (ValidateMarkSweep) {
- guarantee(_root_refs_stack->length() == 0, "should be empty by now");
- }
- )
-
mark_sweep_phase4();
- VALIDATE_MARK_SWEEP_ONLY(
- if (ValidateMarkSweep) {
- guarantee(_live_oops->length() == _live_oops_moved_to->length(),
- "should be the same size");
- }
- )
-
restore_marks();
// Set saved marks for allocation profiler (and other things? -- dld)
@@ -187,31 +174,6 @@
_preserved_marks = (PreservedMark*)scratch;
_preserved_count = 0;
-
-#ifdef VALIDATE_MARK_SWEEP
- if (ValidateMarkSweep) {
- _root_refs_stack = new (ResourceObj::C_HEAP, mtGC) GrowableArray<void*>(100, true);
- _other_refs_stack = new (ResourceObj::C_HEAP, mtGC) GrowableArray<void*>(100, true);
- _adjusted_pointers = new (ResourceObj::C_HEAP, mtGC) GrowableArray<void*>(100, true);
- _live_oops = new (ResourceObj::C_HEAP, mtGC) GrowableArray<oop>(100, true);
- _live_oops_moved_to = new (ResourceObj::C_HEAP, mtGC) GrowableArray<oop>(100, true);
- _live_oops_size = new (ResourceObj::C_HEAP, mtGC) GrowableArray<size_t>(100, true);
- }
- if (RecordMarkSweepCompaction) {
- if (_cur_gc_live_oops == NULL) {
- _cur_gc_live_oops = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
- _cur_gc_live_oops_moved_to = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
- _cur_gc_live_oops_size = new(ResourceObj::C_HEAP, mtGC) GrowableArray<size_t>(100, true);
- _last_gc_live_oops = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
- _last_gc_live_oops_moved_to = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
- _last_gc_live_oops_size = new(ResourceObj::C_HEAP, mtGC) GrowableArray<size_t>(100, true);
- } else {
- _cur_gc_live_oops->clear();
- _cur_gc_live_oops_moved_to->clear();
- _cur_gc_live_oops_size->clear();
- }
- }
-#endif
}
@@ -225,19 +187,6 @@
_preserved_oop_stack.clear(true);
_marking_stack.clear();
_objarray_stack.clear(true);
-
-#ifdef VALIDATE_MARK_SWEEP
- if (ValidateMarkSweep) {
- delete _root_refs_stack;
- delete _other_refs_stack;
- delete _adjusted_pointers;
- delete _live_oops;
- delete _live_oops_size;
- delete _live_oops_moved_to;
- _live_oops_index = 0;
- _live_oops_index_at_perm = 0;
- }
-#endif
}
void GenMarkSweep::mark_sweep_phase1(int level,
@@ -246,8 +195,6 @@
TraceTime tm("phase 1", PrintGC && Verbose, true, gclog_or_tty);
trace(" 1");
- VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
GenCollectedHeap* gch = GenCollectedHeap::heap();
// Because follow_root_closure is created statically, cannot
@@ -315,8 +262,6 @@
TraceTime tm("phase 2", PrintGC && Verbose, true, gclog_or_tty);
trace("2");
- VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
gch->prepare_for_compaction();
}
@@ -337,8 +282,6 @@
// Need new claim bits for the pointer adjustment tracing.
ClassLoaderDataGraph::clear_claimed_marks();
- VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
// Because the two closures below are created statically, cannot
// use OopsInGenClosure constructor which takes a generation,
// as the Universe has not been created when the static constructors
@@ -393,10 +336,6 @@
TraceTime tm("phase 4", PrintGC && Verbose, true, gclog_or_tty);
trace("4");
- VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
GenCompactClosure blk;
gch->generation_iterate(&blk, true);
-
- VALIDATE_MARK_SWEEP_ONLY(compaction_complete());
}
--- a/hotspot/src/share/vm/memory/space.cpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/memory/space.cpp Wed Jan 02 11:32:41 2013 -0800
@@ -411,7 +411,6 @@
assert(q->forwardee() == NULL, "should be forwarded to NULL");
}
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(q, size));
compact_top += size;
// we need to update the offset table so that the beginnings of objects can be
@@ -470,13 +469,10 @@
if (oop(q)->is_gc_marked()) {
// q is alive
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
// point all the oops to the new location
size_t size = oop(q)->adjust_pointers();
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
debug_only(prev_q = q);
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
q += size;
} else {
--- a/hotspot/src/share/vm/memory/space.hpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/memory/space.hpp Wed Jan 02 11:32:41 2013 -0800
@@ -655,16 +655,10 @@
assert(block_is_obj(q), \
"should be at block boundaries, and should be looking at objs"); \
\
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q))); \
- \
/* point all the oops to the new location */ \
size_t size = oop(q)->adjust_pointers(); \
size = adjust_obj_size(size); \
\
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers()); \
- \
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size)); \
- \
q += size; \
} \
\
@@ -685,12 +679,9 @@
Prefetch::write(q, interval); \
if (oop(q)->is_gc_marked()) { \
/* q is alive */ \
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q))); \
/* point all the oops to the new location */ \
size_t size = oop(q)->adjust_pointers(); \
size = adjust_obj_size(size); \
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers()); \
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size)); \
debug_only(prev_q = q); \
q += size; \
} else { \
@@ -725,7 +716,6 @@
size_t size = obj_size(q); \
assert(!oop(q)->is_gc_marked(), \
"should be unmarked (special dense prefix handling)"); \
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, q)); \
debug_only(prev_q = q); \
q += size; \
} \
@@ -759,8 +749,6 @@
Prefetch::write(compaction_top, copy_interval); \
\
/* copy object and reinit its mark */ \
- VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, \
- compaction_top)); \
assert(q != compaction_top, "everything in this pass should be moving"); \
Copy::aligned_conjoint_words(q, compaction_top, size); \
oop(compaction_top)->init_mark(); \
--- a/hotspot/src/share/vm/runtime/globals.hpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/runtime/globals.hpp Wed Jan 02 11:32:41 2013 -0800
@@ -1101,13 +1101,6 @@
product(bool, ReduceSignalUsage, false, \
"Reduce the use of OS signals in Java and/or the VM") \
\
- notproduct(bool, ValidateMarkSweep, false, \
- "Do extra validation during MarkSweep collection") \
- \
- notproduct(bool, RecordMarkSweepCompaction, false, \
- "Enable GC-to-GC recording and querying of compaction during " \
- "MarkSweep") \
- \
develop_pd(bool, ShareVtableStubs, \
"Share vtable stubs (smaller code but worse branch prediction") \
\
--- a/hotspot/src/share/vm/utilities/debug.cpp Wed Dec 26 15:05:30 2012 -0800
+++ b/hotspot/src/share/vm/utilities/debug.cpp Wed Jan 02 11:32:41 2013 -0800
@@ -612,21 +612,6 @@
Events::print();
}
-// Given a heap address that was valid before the most recent GC, if
-// the oop that used to contain it is still live, prints the new
-// location of the oop and the address. Useful for tracking down
-// certain kinds of naked oop and oop map bugs.
-extern "C" void pnl(intptr_t old_heap_addr) {
- // Print New Location of old heap address
- Command c("pnl");
-#ifndef VALIDATE_MARK_SWEEP
- tty->print_cr("Requires build with VALIDATE_MARK_SWEEP defined (debug build) and RecordMarkSweepCompaction enabled");
-#else
- MarkSweep::print_new_location_of_heap_address((HeapWord*) old_heap_addr);
-#endif
-}
-
-
extern "C" Method* findm(intptr_t pc) {
Command c("findm");
nmethod* nm = CodeCache::find_nmethod((address)pc);