8225550: Shenandoah: Prevent SH::object_iterate() call's side-effects
Reviewed-by: shade
This commit is contained in:
parent
5370654910
commit
9a2f403a3f
@ -1279,7 +1279,12 @@ void ShenandoahHeap::object_iterate(ObjectClosure* cl) {
|
|||||||
// First, we process all GC roots. This populates the work stack with initial objects.
|
// First, we process all GC roots. This populates the work stack with initial objects.
|
||||||
ShenandoahAllRootScanner rp(1, ShenandoahPhaseTimings::_num_phases);
|
ShenandoahAllRootScanner rp(1, ShenandoahPhaseTimings::_num_phases);
|
||||||
ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack);
|
ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack);
|
||||||
rp.roots_do_unchecked(&oops);
|
|
||||||
|
if (unload_classes()) {
|
||||||
|
rp.strong_roots_do_unchecked(&oops);
|
||||||
|
} else {
|
||||||
|
rp.roots_do_unchecked(&oops);
|
||||||
|
}
|
||||||
|
|
||||||
// Work through the oop stack to traverse heap.
|
// Work through the oop stack to traverse heap.
|
||||||
while (! oop_stack.is_empty()) {
|
while (! oop_stack.is_empty()) {
|
||||||
|
@ -148,6 +148,7 @@ public:
|
|||||||
void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
|
void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
|
||||||
// For heap object iteration
|
// For heap object iteration
|
||||||
void roots_do_unchecked(OopClosure* cl);
|
void roots_do_unchecked(OopClosure* cl);
|
||||||
|
void strong_roots_do_unchecked(OopClosure* cl);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
|
typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
|
||||||
|
@ -125,6 +125,19 @@ void ShenandoahRootScanner<ITR>::roots_do_unchecked(OopClosure* oops) {
|
|||||||
_code_roots.code_blobs_do(&code, 0);
|
_code_roots.code_blobs_do(&code, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename ITR>
|
||||||
|
void ShenandoahRootScanner<ITR>::strong_roots_do_unchecked(OopClosure* oops) {
|
||||||
|
CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
|
||||||
|
MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
|
||||||
|
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
|
||||||
|
ResourceMark rm;
|
||||||
|
|
||||||
|
_serial_roots.oops_do(oops, 0);
|
||||||
|
_jni_roots.oops_do(oops, 0);
|
||||||
|
_cld_roots.clds_do(&clds, NULL, 0);
|
||||||
|
_thread_roots.threads_do(&tc_cl, 0);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename ITR>
|
template <typename ITR>
|
||||||
void ShenandoahRootScanner<ITR>::strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc) {
|
void ShenandoahRootScanner<ITR>::strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc) {
|
||||||
assert(ShenandoahHeap::heap()->unload_classes(), "Should be used during class unloading");
|
assert(ShenandoahHeap::heap()->unload_classes(), "Should be used during class unloading");
|
||||||
|
Loading…
Reference in New Issue
Block a user