1004 PSOldGen* old_gen); |
1004 PSOldGen* old_gen); |
1005 |
1005 |
1006 // Reset time since last full gc |
1006 // Reset time since last full gc |
1007 static void reset_millis_since_last_gc(); |
1007 static void reset_millis_since_last_gc(); |
1008 |
1008 |
1009 protected: |
|
1010 #ifdef VALIDATE_MARK_SWEEP |
|
1011 static GrowableArray<void*>* _root_refs_stack; |
|
1012 static GrowableArray<oop> * _live_oops; |
|
1013 static GrowableArray<oop> * _live_oops_moved_to; |
|
1014 static GrowableArray<size_t>* _live_oops_size; |
|
1015 static size_t _live_oops_index; |
|
1016 static size_t _live_oops_index_at_perm; |
|
1017 static GrowableArray<void*>* _other_refs_stack; |
|
1018 static GrowableArray<void*>* _adjusted_pointers; |
|
1019 static bool _pointer_tracking; |
|
1020 static bool _root_tracking; |
|
1021 |
|
1022 // The following arrays are saved since the time of the last GC and |
|
1023 // assist in tracking down problems where someone has done an errant |
|
1024 // store into the heap, usually to an oop that wasn't properly |
|
1025 // handleized across a GC. If we crash or otherwise fail before the |
|
1026 // next GC, we can query these arrays to find out the object we had |
|
1027 // intended to do the store to (assuming it is still alive) and the |
|
1028 // offset within that object. Covered under RecordMarkSweepCompaction. |
|
1029 static GrowableArray<HeapWord*> * _cur_gc_live_oops; |
|
1030 static GrowableArray<HeapWord*> * _cur_gc_live_oops_moved_to; |
|
1031 static GrowableArray<size_t>* _cur_gc_live_oops_size; |
|
1032 static GrowableArray<HeapWord*> * _last_gc_live_oops; |
|
1033 static GrowableArray<HeapWord*> * _last_gc_live_oops_moved_to; |
|
1034 static GrowableArray<size_t>* _last_gc_live_oops_size; |
|
1035 #endif |
|
1036 |
|
1037 public: |
1009 public: |
1038 class MarkAndPushClosure: public OopClosure { |
1010 class MarkAndPushClosure: public OopClosure { |
1039 private: |
1011 private: |
1040 ParCompactionManager* _compaction_manager; |
1012 ParCompactionManager* _compaction_manager; |
1041 public: |
1013 public: |
1188 // Return the SpaceId for the given address. |
1160 // Return the SpaceId for the given address. |
1189 static SpaceId space_id(HeapWord* addr); |
1161 static SpaceId space_id(HeapWord* addr); |
1190 |
1162 |
1191 // Time since last full gc (in milliseconds). |
1163 // Time since last full gc (in milliseconds). |
1192 static jlong millis_since_last_gc(); |
1164 static jlong millis_since_last_gc(); |
1193 |
|
1194 #ifdef VALIDATE_MARK_SWEEP |
|
1195 static void track_adjusted_pointer(void* p, bool isroot); |
|
1196 static void check_adjust_pointer(void* p); |
|
1197 static void track_interior_pointers(oop obj); |
|
1198 static void check_interior_pointers(); |
|
1199 |
|
1200 static void reset_live_oop_tracking(); |
|
1201 static void register_live_oop(oop p, size_t size); |
|
1202 static void validate_live_oop(oop p, size_t size); |
|
1203 static void live_oop_moved_to(HeapWord* q, size_t size, HeapWord* compaction_top); |
|
1204 static void compaction_complete(); |
|
1205 |
|
1206 // Querying operation of RecordMarkSweepCompaction results. |
|
1207 // Finds and prints the current base oop and offset for a word |
|
1208 // within an oop that was live during the last GC. Helpful for |
|
1209 // tracking down heap stomps. |
|
1210 static void print_new_location_of_heap_address(HeapWord* q); |
|
1211 #endif // #ifdef VALIDATE_MARK_SWEEP |
|
1212 |
1165 |
1213 #ifndef PRODUCT |
1166 #ifndef PRODUCT |
1214 // Debugging support. |
1167 // Debugging support. |
1215 static const char* space_names[last_space_id]; |
1168 static const char* space_names[last_space_id]; |
1216 static void print_region_ranges(); |
1169 static void print_region_ranges(); |
1248 |
1201 |
1249 template <class T> |
1202 template <class T> |
1250 inline void PSParallelCompact::follow_root(ParCompactionManager* cm, T* p) { |
1203 inline void PSParallelCompact::follow_root(ParCompactionManager* cm, T* p) { |
1251 assert(!Universe::heap()->is_in_reserved(p), |
1204 assert(!Universe::heap()->is_in_reserved(p), |
1252 "roots shouldn't be things within the heap"); |
1205 "roots shouldn't be things within the heap"); |
1253 #ifdef VALIDATE_MARK_SWEEP |
1206 |
1254 if (ValidateMarkSweep) { |
|
1255 guarantee(!_root_refs_stack->contains(p), "should only be in here once"); |
|
1256 _root_refs_stack->push(p); |
|
1257 } |
|
1258 #endif |
|
1259 T heap_oop = oopDesc::load_heap_oop(p); |
1207 T heap_oop = oopDesc::load_heap_oop(p); |
1260 if (!oopDesc::is_null(heap_oop)) { |
1208 if (!oopDesc::is_null(heap_oop)) { |
1261 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
1209 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
1262 if (mark_bitmap()->is_unmarked(obj)) { |
1210 if (mark_bitmap()->is_unmarked(obj)) { |
1263 if (mark_obj(obj)) { |
1211 if (mark_obj(obj)) { |
1292 assert(Universe::heap()->is_in_reserved(new_obj), |
1240 assert(Universe::heap()->is_in_reserved(new_obj), |
1293 "should be in object space"); |
1241 "should be in object space"); |
1294 oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
1242 oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
1295 } |
1243 } |
1296 } |
1244 } |
1297 VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, isroot)); |
|
1298 } |
1245 } |
1299 |
1246 |
1300 template <class T> |
1247 template <class T> |
1301 inline void PSParallelCompact::KeepAliveClosure::do_oop_work(T* p) { |
1248 inline void PSParallelCompact::KeepAliveClosure::do_oop_work(T* p) { |
1302 #ifdef VALIDATE_MARK_SWEEP |
|
1303 if (ValidateMarkSweep) { |
|
1304 if (!Universe::heap()->is_in_reserved(p)) { |
|
1305 _root_refs_stack->push(p); |
|
1306 } else { |
|
1307 _other_refs_stack->push(p); |
|
1308 } |
|
1309 } |
|
1310 #endif |
|
1311 mark_and_push(_compaction_manager, p); |
1249 mark_and_push(_compaction_manager, p); |
1312 } |
1250 } |
1313 |
1251 |
1314 inline bool PSParallelCompact::print_phases() { |
1252 inline bool PSParallelCompact::print_phases() { |
1315 return _print_phases; |
1253 return _print_phases; |