Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @ 3979:4dfb2df418f2
6484982: G1: process references during evacuation pauses
Summary: G1 now uses two reference processors - one is used by concurrent marking and the other is used by STW GCs (both full and incremental evacuation pauses). In an evacuation pause, the reference processor is embedded into the closures used to scan objects. Doing so causes causes reference objects to be 'discovered' by the reference processor. At the end of the evacuation pause, these discovered reference objects are processed - preserving (and copying) referent objects (and their reachable graphs) as appropriate.
Reviewed-by: ysr, jwilhelm, brutisso, stefank, tonyp
author | johnc |
---|---|
date | Thu, 22 Sep 2011 10:57:37 -0700 |
parents | 41e6ee74f879 |
children | bca17e38de00 |
comparison
equal
deleted
inserted
replaced
3978:f0ecbe78fc7b | 3979:4dfb2df418f2 |
---|---|
2002 ReferenceProcessorAtomicMutator rp_mut_atomic(ref_processor(), true); | 2002 ReferenceProcessorAtomicMutator rp_mut_atomic(ref_processor(), true); |
2003 // Temporarily make reference _discovery_ single threaded (non-MT) | 2003 // Temporarily make reference _discovery_ single threaded (non-MT) |
2004 ReferenceProcessorMTDiscoveryMutator rp_mut_discovery(ref_processor(), false); | 2004 ReferenceProcessorMTDiscoveryMutator rp_mut_discovery(ref_processor(), false); |
2005 | 2005 |
2006 ref_processor()->set_enqueuing_is_done(false); | 2006 ref_processor()->set_enqueuing_is_done(false); |
2007 ref_processor()->enable_discovery(); | 2007 ref_processor()->enable_discovery(false /*verify_disabled*/, false /*check_no_refs*/); |
2008 ref_processor()->setup_policy(clear_all_soft_refs); | 2008 ref_processor()->setup_policy(clear_all_soft_refs); |
2009 // If an asynchronous collection finishes, the _modUnionTable is | 2009 // If an asynchronous collection finishes, the _modUnionTable is |
2010 // all clear. If we are assuming the collection from an asynchronous | 2010 // all clear. If we are assuming the collection from an asynchronous |
2011 // collection, clear the _modUnionTable. | 2011 // collection, clear the _modUnionTable. |
2012 assert(_collectorState != Idling || _modUnionTable.isAllClear(), | 2012 assert(_collectorState != Idling || _modUnionTable.isAllClear(), |
3488 if (asynch) { | 3488 if (asynch) { |
3489 // acquire locks for subsequent manipulations | 3489 // acquire locks for subsequent manipulations |
3490 MutexLockerEx x(bitMapLock(), | 3490 MutexLockerEx x(bitMapLock(), |
3491 Mutex::_no_safepoint_check_flag); | 3491 Mutex::_no_safepoint_check_flag); |
3492 checkpointRootsInitialWork(asynch); | 3492 checkpointRootsInitialWork(asynch); |
3493 rp->verify_no_references_recorded(); | 3493 // enable ("weak") refs discovery |
3494 rp->enable_discovery(); // enable ("weak") refs discovery | 3494 rp->enable_discovery(true /*verify_disabled*/, true /*check_no_refs*/); |
3495 _collectorState = Marking; | 3495 _collectorState = Marking; |
3496 } else { | 3496 } else { |
3497 // (Weak) Refs discovery: this is controlled from genCollectedHeap::do_collection | 3497 // (Weak) Refs discovery: this is controlled from genCollectedHeap::do_collection |
3498 // which recognizes if we are a CMS generation, and doesn't try to turn on | 3498 // which recognizes if we are a CMS generation, and doesn't try to turn on |
3499 // discovery; verify that they aren't meddling. | 3499 // discovery; verify that they aren't meddling. |
3501 "incorrect setting of discovery predicate"); | 3501 "incorrect setting of discovery predicate"); |
3502 assert(!rp->discovery_enabled(), "genCollectedHeap shouldn't control " | 3502 assert(!rp->discovery_enabled(), "genCollectedHeap shouldn't control " |
3503 "ref discovery for this generation kind"); | 3503 "ref discovery for this generation kind"); |
3504 // already have locks | 3504 // already have locks |
3505 checkpointRootsInitialWork(asynch); | 3505 checkpointRootsInitialWork(asynch); |
3506 rp->enable_discovery(); // now enable ("weak") refs discovery | 3506 // now enable ("weak") refs discovery |
3507 rp->enable_discovery(true /*verify_disabled*/, false /*verify_no_refs*/); | |
3507 _collectorState = Marking; | 3508 _collectorState = Marking; |
3508 } | 3509 } |
3509 SpecializationStats::print(); | 3510 SpecializationStats::print(); |
3510 } | 3511 } |
3511 | 3512 |