src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp

Print this page




1183 
1184   // Public accessors
1185   static elapsedTimer* accumulated_time() { return &_accumulated_time; }
1186   static unsigned int total_invocations() { return _total_invocations; }
1187   static CollectorCounters* counters()    { return _counters; }
1188 
1189   // Used to add tasks
1190   static GCTaskManager* const gc_task_manager();
1191   static Klass* updated_int_array_klass_obj() {
1192     return _updated_int_array_klass_obj;
1193   }
1194 
1195   // Marking support
1196   static inline bool mark_obj(oop obj);
1197   static inline bool is_marked(oop obj);
1198   // Check mark and maybe push on marking stack
1199   template <class T> static inline void mark_and_push(ParCompactionManager* cm,
1200                                                       T* p);
1201   template <class T> static inline void adjust_pointer(T* p);
1202 
1203   static void follow_klass(ParCompactionManager* cm, Klass* klass);
1204   static void adjust_klass(ParCompactionManager* cm, Klass* klass);
1205 
1206   static void follow_class_loader(ParCompactionManager* cm,
1207                                   ClassLoaderData* klass);
1208   static void adjust_class_loader(ParCompactionManager* cm,
1209                                   ClassLoaderData* klass);
1210 
1211   // Compaction support.
1212   // Return true if p is in the range [beg_addr, end_addr).
1213   static inline bool is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr);
1214   static inline bool is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr);
1215 
1216   // Convenience wrappers for per-space data kept in _space_info.
1217   static inline MutableSpace*     space(SpaceId space_id);
1218   static inline HeapWord*         new_top(SpaceId space_id);
1219   static inline HeapWord*         dense_prefix(SpaceId space_id);
1220   static inline ObjectStartArray* start_array(SpaceId space_id);
1221 
1222   // Move and update the live objects in the specified space.
1223   static void move_and_update(ParCompactionManager* cm, SpaceId space_id);
1224 
1225   // Process the end of the given region range in the dense prefix.
1226   // This includes saving any object not updated.
1227   static void dense_prefix_regions_epilogue(ParCompactionManager* cm,
1228                                             size_t region_start_index,
1229                                             size_t region_end_index,


1333 
1334 inline bool PSParallelCompact::is_marked(oop obj) {
1335   return mark_bitmap()->is_marked(obj);
1336 }
1337 
1338 template <class T>
1339 inline void PSParallelCompact::follow_root(ParCompactionManager* cm, T* p) {
1340   assert(!Universe::heap()->is_in_reserved(p),
1341          "roots shouldn't be things within the heap");
1342 
1343   T heap_oop = oopDesc::load_heap_oop(p);
1344   if (!oopDesc::is_null(heap_oop)) {
1345     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
1346     if (mark_bitmap()->is_unmarked(obj)) {
1347       if (mark_obj(obj)) {
1348         obj->follow_contents(cm);
1349       }
1350     }
1351   }
1352   cm->follow_marking_stacks();





1353 }
1354 
1355 template <class T>
1356 inline void PSParallelCompact::mark_and_push(ParCompactionManager* cm, T* p) {
1357   T heap_oop = oopDesc::load_heap_oop(p);
1358   if (!oopDesc::is_null(heap_oop)) {
1359     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
1360     if (mark_bitmap()->is_unmarked(obj) && mark_obj(obj)) {
1361       cm->push(obj);
1362     }
1363   }
1364 }
1365 
1366 template <class T>
1367 inline void PSParallelCompact::adjust_pointer(T* p) {
1368   T heap_oop = oopDesc::load_heap_oop(p);
1369   if (!oopDesc::is_null(heap_oop)) {
1370     oop obj     = oopDesc::decode_heap_oop_not_null(heap_oop);
1371     oop new_obj = (oop)summary_data().calc_new_pointer(obj);
1372     assert(new_obj != NULL,                    // is forwarding ptr?




1183 
1184   // Public accessors
1185   static elapsedTimer* accumulated_time() { return &_accumulated_time; }
1186   static unsigned int total_invocations() { return _total_invocations; }
1187   static CollectorCounters* counters()    { return _counters; }
1188 
1189   // Used to add tasks
1190   static GCTaskManager* const gc_task_manager();
1191   static Klass* updated_int_array_klass_obj() {
1192     return _updated_int_array_klass_obj;
1193   }
1194 
1195   // Marking support
1196   static inline bool mark_obj(oop obj);
1197   static inline bool is_marked(oop obj);
1198   // Check mark and maybe push on marking stack
1199   template <class T> static inline void mark_and_push(ParCompactionManager* cm,
1200                                                       T* p);
1201   template <class T> static inline void adjust_pointer(T* p);
1202 
1203   static inline void follow_klass(ParCompactionManager* cm, Klass* klass);

1204 
1205   static void follow_class_loader(ParCompactionManager* cm,
1206                                   ClassLoaderData* klass);


1207 
1208   // Compaction support.
1209   // Return true if p is in the range [beg_addr, end_addr).
1210   static inline bool is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr);
1211   static inline bool is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr);
1212 
1213   // Convenience wrappers for per-space data kept in _space_info.
1214   static inline MutableSpace*     space(SpaceId space_id);
1215   static inline HeapWord*         new_top(SpaceId space_id);
1216   static inline HeapWord*         dense_prefix(SpaceId space_id);
1217   static inline ObjectStartArray* start_array(SpaceId space_id);
1218 
1219   // Move and update the live objects in the specified space.
1220   static void move_and_update(ParCompactionManager* cm, SpaceId space_id);
1221 
1222   // Process the end of the given region range in the dense prefix.
1223   // This includes saving any object not updated.
1224   static void dense_prefix_regions_epilogue(ParCompactionManager* cm,
1225                                             size_t region_start_index,
1226                                             size_t region_end_index,


1330 
1331 inline bool PSParallelCompact::is_marked(oop obj) {
1332   return mark_bitmap()->is_marked(obj);
1333 }
1334 
1335 template <class T>
1336 inline void PSParallelCompact::follow_root(ParCompactionManager* cm, T* p) {
1337   assert(!Universe::heap()->is_in_reserved(p),
1338          "roots shouldn't be things within the heap");
1339 
1340   T heap_oop = oopDesc::load_heap_oop(p);
1341   if (!oopDesc::is_null(heap_oop)) {
1342     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
1343     if (mark_bitmap()->is_unmarked(obj)) {
1344       if (mark_obj(obj)) {
1345         obj->follow_contents(cm);
1346       }
1347     }
1348   }
1349   cm->follow_marking_stacks();
1350 }
1351 
1352 inline void PSParallelCompact::follow_klass(ParCompactionManager* cm, Klass* klass) {
1353   oop holder = klass->klass_holder();
1354   PSParallelCompact::mark_and_push(cm, &holder);
1355 }
1356 
1357 template <class T>
1358 inline void PSParallelCompact::mark_and_push(ParCompactionManager* cm, T* p) {
1359   T heap_oop = oopDesc::load_heap_oop(p);
1360   if (!oopDesc::is_null(heap_oop)) {
1361     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
1362     if (mark_bitmap()->is_unmarked(obj) && mark_obj(obj)) {
1363       cm->push(obj);
1364     }
1365   }
1366 }
1367 
1368 template <class T>
1369 inline void PSParallelCompact::adjust_pointer(T* p) {
1370   T heap_oop = oopDesc::load_heap_oop(p);
1371   if (!oopDesc::is_null(heap_oop)) {
1372     oop obj     = oopDesc::decode_heap_oop_not_null(heap_oop);
1373     oop new_obj = (oop)summary_data().calc_new_pointer(obj);
1374     assert(new_obj != NULL,                    // is forwarding ptr?