1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Wed Apr 08 10:32:16 2015 -0400 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Wed Apr 15 12:16:01 2015 -0400 1.3 @@ -348,20 +348,30 @@ 1.4 return is_obj_ill(obj, heap_region_containing(obj)); 1.5 } 1.6 1.7 +inline void G1CollectedHeap::set_humongous_reclaim_candidate(uint region, bool value) { 1.8 + assert(_hrm.at(region)->startsHumongous(), "Must start a humongous object"); 1.9 + _humongous_reclaim_candidates.set_candidate(region, value); 1.10 +} 1.11 + 1.12 +inline bool G1CollectedHeap::is_humongous_reclaim_candidate(uint region) { 1.13 + assert(_hrm.at(region)->startsHumongous(), "Must start a humongous object"); 1.14 + return _humongous_reclaim_candidates.is_candidate(region); 1.15 +} 1.16 + 1.17 inline void G1CollectedHeap::set_humongous_is_live(oop obj) { 1.18 uint region = addr_to_region((HeapWord*)obj); 1.19 - // We not only set the "live" flag in the humongous_is_live table, but also 1.20 + // Clear the flag in the humongous_reclaim_candidates table. Also 1.21 // reset the entry in the _in_cset_fast_test table so that subsequent references 1.22 // to the same humongous object do not go into the slow path again. 1.23 // This is racy, as multiple threads may at the same time enter here, but this 1.24 // is benign. 1.25 - // During collection we only ever set the "live" flag, and only ever clear the 1.26 + // During collection we only ever clear the "candidate" flag, and only ever clear the 1.27 // entry in the in_cset_fast_table. 1.28 // We only ever evaluate the contents of these tables (in the VM thread) after 1.29 // having synchronized the worker threads with the VM thread, or in the same 1.30 // thread (i.e. within the VM thread). 1.31 - if (!_humongous_is_live.is_live(region)) { 1.32 - _humongous_is_live.set_live(region); 1.33 + if (is_humongous_reclaim_candidate(region)) { 1.34 + set_humongous_reclaim_candidate(region, false); 1.35 _in_cset_fast_test.clear_humongous(region); 1.36 } 1.37 }