src/share/vm/gc_implementation/g1/heapRegion.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc9 Sdiff src/share/vm/gc_implementation/g1

src/share/vm/gc_implementation/g1/heapRegion.cpp

Print this page




 305     // continues humongous
 306     assert(end() == _orig_end, "sanity");
 307   }
 308 
 309   assert(capacity() == HeapRegion::GrainBytes, "pre-condition");
 310   _humongous_type = NotHumongous;
 311   _humongous_start_region = NULL;
 312 }
 313 
 314 bool HeapRegion::claimHeapRegion(jint claimValue) {
 315   jint current = _claimed;
 316   if (current != claimValue) {
 317     jint res = Atomic::cmpxchg(claimValue, &_claimed, current);
 318     if (res == current) {
 319       return true;
 320     }
 321   }
 322   return false;
 323 }
 324 
 325 HeapWord* HeapRegion::next_block_start_careful(HeapWord* addr) {
 326   HeapWord* low = addr;
 327   HeapWord* high = end();
 328   while (low < high) {
 329     size_t diff = pointer_delta(high, low);
 330     // Must add one below to bias toward the high amount.  Otherwise, if
 331   // "high" were at the desired value, and "low" were one less, we
 332     // would not converge on "high".  This is not symmetric, because
 333     // we set "high" to a block start, which might be the right one,
 334     // which we don't do for "low".
 335     HeapWord* middle = low + (diff+1)/2;
 336     if (middle == high) return high;
 337     HeapWord* mid_bs = block_start_careful(middle);
 338     if (mid_bs < addr) {
 339       low = middle;
 340     } else {
 341       high = mid_bs;
 342     }
 343   }
 344   assert(low == high && low >= addr, "Didn't work.");
 345   return low;
 346 }
 347 
 348 HeapRegion::HeapRegion(uint hrs_index,
 349                        G1BlockOffsetSharedArray* sharedOffsetArray,
 350                        MemRegion mr) :
 351     G1OffsetTableContigSpace(sharedOffsetArray, mr),
 352     _hrs_index(hrs_index),
 353     _humongous_type(NotHumongous), _humongous_start_region(NULL),
 354     _in_collection_set(false),
 355     _next_in_special_set(NULL), _orig_end(NULL),
 356     _claimed(InitialClaimValue), _evacuation_failed(false),
 357     _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0),
 358     _young_type(NotYoung), _next_young_region(NULL),
 359     _next_dirty_cards_region(NULL), _next(NULL), _prev(NULL),
 360 #ifdef ASSERT
 361     _containing_set(NULL),
 362 #endif // ASSERT
 363      _young_index_in_cset(-1), _surv_rate_group(NULL), _age_index(-1),
 364     _rem_set(NULL), _recorded_rs_length(0), _predicted_elapsed_time_ms(0),
 365     _predicted_bytes_to_copy(0)
 366 {
 367   _rem_set = new HeapRegionRemSet(sharedOffsetArray, this);




 305     // continues humongous
 306     assert(end() == _orig_end, "sanity");
 307   }
 308 
 309   assert(capacity() == HeapRegion::GrainBytes, "pre-condition");
 310   _humongous_type = NotHumongous;
 311   _humongous_start_region = NULL;
 312 }
 313 
 314 bool HeapRegion::claimHeapRegion(jint claimValue) {
 315   jint current = _claimed;
 316   if (current != claimValue) {
 317     jint res = Atomic::cmpxchg(claimValue, &_claimed, current);
 318     if (res == current) {
 319       return true;
 320     }
 321   }
 322   return false;
 323 }
 324 























 325 HeapRegion::HeapRegion(uint hrs_index,
 326                        G1BlockOffsetSharedArray* sharedOffsetArray,
 327                        MemRegion mr) :
 328     G1OffsetTableContigSpace(sharedOffsetArray, mr),
 329     _hrs_index(hrs_index),
 330     _humongous_type(NotHumongous), _humongous_start_region(NULL),
 331     _in_collection_set(false),
 332     _next_in_special_set(NULL), _orig_end(NULL),
 333     _claimed(InitialClaimValue), _evacuation_failed(false),
 334     _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0),
 335     _young_type(NotYoung), _next_young_region(NULL),
 336     _next_dirty_cards_region(NULL), _next(NULL), _prev(NULL),
 337 #ifdef ASSERT
 338     _containing_set(NULL),
 339 #endif // ASSERT
 340      _young_index_in_cset(-1), _surv_rate_group(NULL), _age_index(-1),
 341     _rem_set(NULL), _recorded_rs_length(0), _predicted_elapsed_time_ms(0),
 342     _predicted_bytes_to_copy(0)
 343 {
 344   _rem_set = new HeapRegionRemSet(sharedOffsetArray, this);


src/share/vm/gc_implementation/g1/heapRegion.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File