346 return false; |
346 return false; |
347 } |
347 } |
348 return is_obj_ill(obj, heap_region_containing(obj)); |
348 return is_obj_ill(obj, heap_region_containing(obj)); |
349 } |
349 } |
350 |
350 |
|
351 inline void G1CollectedHeap::set_humongous_reclaim_candidate(uint region, bool value) { |
|
352 assert(_hrm.at(region)->startsHumongous(), "Must start a humongous object"); |
|
353 _humongous_reclaim_candidates.set_candidate(region, value); |
|
354 } |
|
355 |
|
356 inline bool G1CollectedHeap::is_humongous_reclaim_candidate(uint region) { |
|
357 assert(_hrm.at(region)->startsHumongous(), "Must start a humongous object"); |
|
358 return _humongous_reclaim_candidates.is_candidate(region); |
|
359 } |
|
360 |
351 inline void G1CollectedHeap::set_humongous_is_live(oop obj) { |
361 inline void G1CollectedHeap::set_humongous_is_live(oop obj) { |
352 uint region = addr_to_region((HeapWord*)obj); |
362 uint region = addr_to_region((HeapWord*)obj); |
353 // We not only set the "live" flag in the humongous_is_live table, but also |
363 // Clear the flag in the humongous_reclaim_candidates table. Also |
354 // reset the entry in the _in_cset_fast_test table so that subsequent references |
364 // reset the entry in the _in_cset_fast_test table so that subsequent references |
355 // to the same humongous object do not go into the slow path again. |
365 // to the same humongous object do not go into the slow path again. |
356 // This is racy, as multiple threads may at the same time enter here, but this |
366 // This is racy, as multiple threads may at the same time enter here, but this |
357 // is benign. |
367 // is benign. |
358 // During collection we only ever set the "live" flag, and only ever clear the |
368 // During collection we only ever clear the "candidate" flag, and only ever clear the |
359 // entry in the in_cset_fast_table. |
369 // entry in the in_cset_fast_table. |
360 // We only ever evaluate the contents of these tables (in the VM thread) after |
370 // We only ever evaluate the contents of these tables (in the VM thread) after |
361 // having synchronized the worker threads with the VM thread, or in the same |
371 // having synchronized the worker threads with the VM thread, or in the same |
362 // thread (i.e. within the VM thread). |
372 // thread (i.e. within the VM thread). |
363 if (!_humongous_is_live.is_live(region)) { |
373 if (is_humongous_reclaim_candidate(region)) { |
364 _humongous_is_live.set_live(region); |
374 set_humongous_reclaim_candidate(region, false); |
365 _in_cset_fast_test.clear_humongous(region); |
375 _in_cset_fast_test.clear_humongous(region); |
366 } |
376 } |
367 } |
377 } |
368 |
378 |
369 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP |
379 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP |