mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8246100: Shenandoah: walk roots in more efficient order
Reviewed-by: zgu
This commit is contained in:
parent
19257f4fb7
commit
82dc495ca0
1 changed files with 42 additions and 20 deletions
|
@ -221,28 +221,38 @@ void ShenandoahRootScanner::roots_do(uint worker_id, OopClosure* oops, CLDClosur
|
||||||
assert(!ShenandoahSafepoint::is_at_shenandoah_safepoint() ||
|
assert(!ShenandoahSafepoint::is_at_shenandoah_safepoint() ||
|
||||||
!ShenandoahHeap::heap()->unload_classes(),
|
!ShenandoahHeap::heap()->unload_classes(),
|
||||||
"Expect class unloading when Shenandoah cycle is running");
|
"Expect class unloading when Shenandoah cycle is running");
|
||||||
ResourceMark rm;
|
|
||||||
|
|
||||||
_serial_roots.oops_do(oops, worker_id);
|
|
||||||
_vm_roots.oops_do(oops, worker_id);
|
|
||||||
|
|
||||||
assert(clds != NULL, "Only possible with CLD closure");
|
assert(clds != NULL, "Only possible with CLD closure");
|
||||||
_cld_roots.cld_do(clds, worker_id);
|
|
||||||
|
|
||||||
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, code, tc);
|
|
||||||
_thread_roots.threads_do(&tc_cl, worker_id);
|
|
||||||
|
|
||||||
AlwaysTrueClosure always_true;
|
AlwaysTrueClosure always_true;
|
||||||
|
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, code, tc);
|
||||||
|
|
||||||
|
ResourceMark rm;
|
||||||
|
|
||||||
|
// Process serial-claiming roots first
|
||||||
|
_serial_roots.oops_do(oops, worker_id);
|
||||||
|
|
||||||
|
// Process light-weight/limited parallel roots then
|
||||||
|
_vm_roots.oops_do(oops, worker_id);
|
||||||
_dedup_roots.oops_do(&always_true, oops, worker_id);
|
_dedup_roots.oops_do(&always_true, oops, worker_id);
|
||||||
|
|
||||||
|
// Process heavy-weight/fully parallel roots the last
|
||||||
|
_cld_roots.cld_do(clds, worker_id);
|
||||||
|
_thread_roots.threads_do(&tc_cl, worker_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShenandoahRootScanner::strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc) {
|
void ShenandoahRootScanner::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");
|
||||||
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, code, tc);
|
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, code, tc);
|
||||||
|
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
|
|
||||||
|
// Process serial-claiming roots first
|
||||||
_serial_roots.oops_do(oops, worker_id);
|
_serial_roots.oops_do(oops, worker_id);
|
||||||
|
|
||||||
|
// Process light-weight/limited parallel roots then
|
||||||
_vm_roots.oops_do(oops, worker_id);
|
_vm_roots.oops_do(oops, worker_id);
|
||||||
|
|
||||||
|
// Process heavy-weight/fully parallel roots the last
|
||||||
_cld_roots.always_strong_cld_do(clds, worker_id);
|
_cld_roots.always_strong_cld_do(clds, worker_id);
|
||||||
_thread_roots.threads_do(&tc_cl, worker_id);
|
_thread_roots.threads_do(&tc_cl, worker_id);
|
||||||
}
|
}
|
||||||
|
@ -272,14 +282,18 @@ void ShenandoahRootEvacuator::roots_do(uint worker_id, OopClosure* oops) {
|
||||||
static_cast<CodeBlobToOopClosure*>(&blobsCl);
|
static_cast<CodeBlobToOopClosure*>(&blobsCl);
|
||||||
AlwaysTrueClosure always_true;
|
AlwaysTrueClosure always_true;
|
||||||
|
|
||||||
|
// Process serial-claiming roots first
|
||||||
_serial_roots.oops_do(oops, worker_id);
|
_serial_roots.oops_do(oops, worker_id);
|
||||||
_serial_weak_roots.weak_oops_do(oops, worker_id);
|
_serial_weak_roots.weak_oops_do(oops, worker_id);
|
||||||
|
|
||||||
|
// Process light-weight/limited parallel roots then
|
||||||
if (_stw_roots_processing) {
|
if (_stw_roots_processing) {
|
||||||
_vm_roots.oops_do<OopClosure>(oops, worker_id);
|
_vm_roots.oops_do<OopClosure>(oops, worker_id);
|
||||||
_weak_roots.oops_do<OopClosure>(oops, worker_id);
|
_weak_roots.oops_do<OopClosure>(oops, worker_id);
|
||||||
_dedup_roots.oops_do(&always_true, oops, worker_id);
|
_dedup_roots.oops_do(&always_true, oops, worker_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Process heavy-weight/fully parallel roots the last
|
||||||
if (_stw_class_unloading) {
|
if (_stw_class_unloading) {
|
||||||
CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
|
CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
|
||||||
_cld_roots.cld_do(&clds, worker_id);
|
_cld_roots.cld_do(&clds, worker_id);
|
||||||
|
@ -324,16 +338,19 @@ void ShenandoahRootAdjuster::roots_do(uint worker_id, OopClosure* oops) {
|
||||||
CLDToOopClosure adjust_cld_closure(oops, ClassLoaderData::_claim_strong);
|
CLDToOopClosure adjust_cld_closure(oops, ClassLoaderData::_claim_strong);
|
||||||
AlwaysTrueClosure always_true;
|
AlwaysTrueClosure always_true;
|
||||||
|
|
||||||
|
// Process serial-claiming roots first
|
||||||
_serial_roots.oops_do(oops, worker_id);
|
_serial_roots.oops_do(oops, worker_id);
|
||||||
_vm_roots.oops_do(oops, worker_id);
|
|
||||||
|
|
||||||
_thread_roots.oops_do(oops, NULL, worker_id);
|
|
||||||
_cld_roots.cld_do(&adjust_cld_closure, worker_id);
|
|
||||||
_code_roots.code_blobs_do(adjust_code_closure, worker_id);
|
|
||||||
|
|
||||||
_serial_weak_roots.weak_oops_do(oops, worker_id);
|
_serial_weak_roots.weak_oops_do(oops, worker_id);
|
||||||
|
|
||||||
|
// Process light-weight/limited parallel roots then
|
||||||
|
_vm_roots.oops_do(oops, worker_id);
|
||||||
_weak_roots.oops_do<OopClosure>(oops, worker_id);
|
_weak_roots.oops_do<OopClosure>(oops, worker_id);
|
||||||
_dedup_roots.oops_do(&always_true, oops, worker_id);
|
_dedup_roots.oops_do(&always_true, oops, worker_id);
|
||||||
|
|
||||||
|
// Process heavy-weight/fully parallel roots the last
|
||||||
|
_cld_roots.cld_do(&adjust_cld_closure, worker_id);
|
||||||
|
_code_roots.code_blobs_do(adjust_code_closure, worker_id);
|
||||||
|
_thread_roots.oops_do(oops, NULL, worker_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner() :
|
ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner() :
|
||||||
|
@ -354,15 +371,20 @@ ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner() :
|
||||||
MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
|
MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
|
||||||
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
|
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
|
||||||
AlwaysTrueClosure always_true;
|
AlwaysTrueClosure always_true;
|
||||||
|
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
|
|
||||||
|
// Process serial-claiming roots first
|
||||||
_serial_roots.oops_do(oops, 0);
|
_serial_roots.oops_do(oops, 0);
|
||||||
_vm_roots.oops_do(oops, 0);
|
|
||||||
_cld_roots.cld_do(&clds, 0);
|
|
||||||
_thread_roots.threads_do(&tc_cl, 0);
|
|
||||||
_code_roots.code_blobs_do(&code, 0);
|
|
||||||
|
|
||||||
_serial_weak_roots.weak_oops_do(oops, 0);
|
_serial_weak_roots.weak_oops_do(oops, 0);
|
||||||
|
|
||||||
|
// Process light-weight/limited parallel roots then
|
||||||
|
_vm_roots.oops_do(oops, 0);
|
||||||
_weak_roots.oops_do<OopClosure>(oops, 0);
|
_weak_roots.oops_do<OopClosure>(oops, 0);
|
||||||
_dedup_roots.oops_do(&always_true, oops, 0);
|
_dedup_roots.oops_do(&always_true, oops, 0);
|
||||||
|
|
||||||
|
// Process heavy-weight/fully parallel roots the last
|
||||||
|
_cld_roots.cld_do(&clds, 0);
|
||||||
|
_code_roots.code_blobs_do(&code, 0);
|
||||||
|
_thread_roots.threads_do(&tc_cl, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue