comparison src/share/vm/gc_implementation/shared/markSweep.hpp @ 7448:b735136e0d82

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>
author johnc
date Wed, 02 Jan 2013 11:32:41 -0800
parents da91efe96a93
children a08c80e9e1e5
comparison
equal deleted inserted replaced
7447:1de1b145f6bc 7448:b735136e0d82
42 // generations are assumed to support marking; those that can also support 42 // generations are assumed to support marking; those that can also support
43 // compaction. 43 // compaction.
44 // 44 //
45 // Class unloading will only occur when a full gc is invoked. 45 // Class unloading will only occur when a full gc is invoked.
46 46
47 // If VALIDATE_MARK_SWEEP is defined, the -XX:+ValidateMarkSweep flag will
48 // be operational, and will provide slow but comprehensive self-checks within
49 // the GC. This is not enabled by default in product or release builds,
50 // since the extra call to track_adjusted_pointer() in _adjust_pointer()
51 // would be too much overhead, and would disturb performance measurement.
52 // However, debug builds are sometimes way too slow to run GC tests!
53 #ifdef ASSERT
54 #define VALIDATE_MARK_SWEEP 1
55 #endif
56 #ifdef VALIDATE_MARK_SWEEP
57 #define VALIDATE_MARK_SWEEP_ONLY(code) code
58 #else
59 #define VALIDATE_MARK_SWEEP_ONLY(code)
60 #endif
61
62 // declared at end 47 // declared at end
63 class PreservedMark; 48 class PreservedMark;
64 49
65 class MarkSweep : AllStatic { 50 class MarkSweep : AllStatic {
66 // 51 //
144 static size_t _preserved_count_max; 129 static size_t _preserved_count_max;
145 static PreservedMark* _preserved_marks; 130 static PreservedMark* _preserved_marks;
146 131
147 // Reference processing (used in ...follow_contents) 132 // Reference processing (used in ...follow_contents)
148 static ReferenceProcessor* _ref_processor; 133 static ReferenceProcessor* _ref_processor;
149
150 #ifdef VALIDATE_MARK_SWEEP
151 static GrowableArray<void*>* _root_refs_stack;
152 static GrowableArray<oop> * _live_oops;
153 static GrowableArray<oop> * _live_oops_moved_to;
154 static GrowableArray<size_t>* _live_oops_size;
155 static size_t _live_oops_index;
156 static size_t _live_oops_index_at_perm;
157 static GrowableArray<void*>* _other_refs_stack;
158 static GrowableArray<void*>* _adjusted_pointers;
159 static bool _pointer_tracking;
160 static bool _root_tracking;
161
162 // The following arrays are saved since the time of the last GC and
163 // assist in tracking down problems where someone has done an errant
164 // store into the heap, usually to an oop that wasn't properly
165 // handleized across a GC. If we crash or otherwise fail before the
166 // next GC, we can query these arrays to find out the object we had
167 // intended to do the store to (assuming it is still alive) and the
168 // offset within that object. Covered under RecordMarkSweepCompaction.
169 static GrowableArray<HeapWord*> * _cur_gc_live_oops;
170 static GrowableArray<HeapWord*> * _cur_gc_live_oops_moved_to;
171 static GrowableArray<size_t>* _cur_gc_live_oops_size;
172 static GrowableArray<HeapWord*> * _last_gc_live_oops;
173 static GrowableArray<HeapWord*> * _last_gc_live_oops_moved_to;
174 static GrowableArray<size_t>* _last_gc_live_oops_size;
175 #endif
176 134
177 // Non public closures 135 // Non public closures
178 static KeepAliveClosure keep_alive; 136 static KeepAliveClosure keep_alive;
179 137
180 // Debugging 138 // Debugging
225 183
226 static void adjust_root_pointer(oop* p) { adjust_pointer(p, true); } 184 static void adjust_root_pointer(oop* p) { adjust_pointer(p, true); }
227 static void adjust_pointer(oop* p) { adjust_pointer(p, false); } 185 static void adjust_pointer(oop* p) { adjust_pointer(p, false); }
228 static void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); } 186 static void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); }
229 187
230 #ifdef VALIDATE_MARK_SWEEP
231 static void track_adjusted_pointer(void* p, bool isroot);
232 static void check_adjust_pointer(void* p);
233 static void track_interior_pointers(oop obj);
234 static void check_interior_pointers();
235
236 static void reset_live_oop_tracking();
237 static void register_live_oop(oop p, size_t size);
238 static void validate_live_oop(oop p, size_t size);
239 static void live_oop_moved_to(HeapWord* q, size_t size, HeapWord* compaction_top);
240 static void compaction_complete();
241
242 // Querying operation of RecordMarkSweepCompaction results.
243 // Finds and prints the current base oop and offset for a word
244 // within an oop that was live during the last GC. Helpful for
245 // tracking down heap stomps.
246 static void print_new_location_of_heap_address(HeapWord* q);
247 #endif
248 }; 188 };
249 189
250 class PreservedMark VALUE_OBJ_CLASS_SPEC { 190 class PreservedMark VALUE_OBJ_CLASS_SPEC {
251 private: 191 private:
252 oop _obj; 192 oop _obj;