hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp
changeset 46502 116a09d8f142
parent 42638 793e65ba88aa
child 46958 a13bd8c6b7a2
equal deleted inserted replaced
46501:6b4919b83092 46502:116a09d8f142
  1251   // Verify that all the regions have been emptied.
  1251   // Verify that all the regions have been emptied.
  1252   static void verify_complete(SpaceId space_id);
  1252   static void verify_complete(SpaceId space_id);
  1253 #endif  // #ifdef ASSERT
  1253 #endif  // #ifdef ASSERT
  1254 };
  1254 };
  1255 
  1255 
  1256 inline bool PSParallelCompact::is_marked(oop obj) {
       
  1257   return mark_bitmap()->is_marked(obj);
       
  1258 }
       
  1259 
       
  1260 inline double PSParallelCompact::normal_distribution(double density) {
       
  1261   assert(_dwl_initialized, "uninitialized");
       
  1262   const double squared_term = (density - _dwl_mean) / _dwl_std_dev;
       
  1263   return _dwl_first_term * exp(-0.5 * squared_term * squared_term);
       
  1264 }
       
  1265 
       
  1266 inline bool
       
  1267 PSParallelCompact::dead_space_crosses_boundary(const RegionData* region,
       
  1268                                                idx_t bit)
       
  1269 {
       
  1270   assert(bit > 0, "cannot call this for the first bit/region");
       
  1271   assert(_summary_data.region_to_addr(region) == _mark_bitmap.bit_to_addr(bit),
       
  1272          "sanity check");
       
  1273 
       
  1274   // Dead space crosses the boundary if (1) a partial object does not extend
       
  1275   // onto the region, (2) an object does not start at the beginning of the
       
  1276   // region, and (3) an object does not end at the end of the prior region.
       
  1277   return region->partial_obj_size() == 0 &&
       
  1278     !_mark_bitmap.is_obj_beg(bit) &&
       
  1279     !_mark_bitmap.is_obj_end(bit - 1);
       
  1280 }
       
  1281 
       
  1282 inline bool
       
  1283 PSParallelCompact::is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr) {
       
  1284   return p >= beg_addr && p < end_addr;
       
  1285 }
       
  1286 
       
  1287 inline bool
       
  1288 PSParallelCompact::is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr) {
       
  1289   return is_in((HeapWord*)p, beg_addr, end_addr);
       
  1290 }
       
  1291 
       
  1292 inline MutableSpace* PSParallelCompact::space(SpaceId id) {
       
  1293   assert(id < last_space_id, "id out of range");
       
  1294   return _space_info[id].space();
       
  1295 }
       
  1296 
       
  1297 inline HeapWord* PSParallelCompact::new_top(SpaceId id) {
       
  1298   assert(id < last_space_id, "id out of range");
       
  1299   return _space_info[id].new_top();
       
  1300 }
       
  1301 
       
  1302 inline HeapWord* PSParallelCompact::dense_prefix(SpaceId id) {
       
  1303   assert(id < last_space_id, "id out of range");
       
  1304   return _space_info[id].dense_prefix();
       
  1305 }
       
  1306 
       
  1307 inline ObjectStartArray* PSParallelCompact::start_array(SpaceId id) {
       
  1308   assert(id < last_space_id, "id out of range");
       
  1309   return _space_info[id].start_array();
       
  1310 }
       
  1311 
       
  1312 #ifdef ASSERT
       
  1313 inline void
       
  1314 PSParallelCompact::check_new_location(HeapWord* old_addr, HeapWord* new_addr)
       
  1315 {
       
  1316   assert(old_addr >= new_addr || space_id(old_addr) != space_id(new_addr),
       
  1317          "must move left or to a different space");
       
  1318   assert(is_object_aligned((intptr_t)old_addr) && is_object_aligned((intptr_t)new_addr),
       
  1319          "checking alignment");
       
  1320 }
       
  1321 #endif // ASSERT
       
  1322 
       
  1323 class MoveAndUpdateClosure: public ParMarkBitMapClosure {
  1256 class MoveAndUpdateClosure: public ParMarkBitMapClosure {
  1324  public:
  1257  public:
  1325   inline MoveAndUpdateClosure(ParMarkBitMap* bitmap, ParCompactionManager* cm,
  1258   inline MoveAndUpdateClosure(ParMarkBitMap* bitmap, ParCompactionManager* cm,
  1326                               ObjectStartArray* start_array,
  1259                               ObjectStartArray* start_array,
  1327                               HeapWord* destination, size_t words);
  1260                               HeapWord* destination, size_t words);
  1387   inline void do_addr(HeapWord* addr);
  1320   inline void do_addr(HeapWord* addr);
  1388 };
  1321 };
  1389 
  1322 
  1390 class FillClosure: public ParMarkBitMapClosure {
  1323 class FillClosure: public ParMarkBitMapClosure {
  1391  public:
  1324  public:
  1392   FillClosure(ParCompactionManager* cm, PSParallelCompact::SpaceId space_id) :
  1325   FillClosure(ParCompactionManager* cm, PSParallelCompact::SpaceId space_id);
  1393     ParMarkBitMapClosure(PSParallelCompact::mark_bitmap(), cm),
       
  1394     _start_array(PSParallelCompact::start_array(space_id))
       
  1395   {
       
  1396     assert(space_id == PSParallelCompact::old_space_id,
       
  1397            "cannot use FillClosure in the young gen");
       
  1398   }
       
  1399 
  1326 
  1400   virtual IterationStatus do_addr(HeapWord* addr, size_t size);
  1327   virtual IterationStatus do_addr(HeapWord* addr, size_t size);
  1401 
  1328 
  1402  private:
  1329  private:
  1403   ObjectStartArray* const _start_array;
  1330   ObjectStartArray* const _start_array;