Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8278627: Shenandoah: TestHeapDump test failed
Reviewed-by: shade, rkennke
  • Loading branch information
zhengyu123 committed Dec 21, 2021
1 parent 54517fa commit 1128674d7f3766dda8869b213e1fc629e44ea7a8
Showing 3 changed files with 50 additions and 33 deletions.
@@ -227,7 +227,7 @@ ShenandoahCodeBlobAndDisarmClosure::ShenandoahCodeBlobAndDisarmClosure(OopClosur

void ShenandoahCodeBlobAndDisarmClosure::do_code_blob(CodeBlob* cb) {
nmethod* const nm = cb->as_nmethod_or_null();
if (nm != NULL && nm->oops_do_try_claim()) {
if (nm != NULL) {
assert(!ShenandoahNMethod::gc_data(nm)->is_unregistered(), "Should not be here");
CodeBlobToOopClosure::do_code_blob(cb);
_bs->disarm(nm);
@@ -79,18 +79,13 @@ ShenandoahThreadRoots::~ShenandoahThreadRoots() {
}

ShenandoahCodeCacheRoots::ShenandoahCodeCacheRoots(ShenandoahPhaseTimings::Phase phase) : _phase(phase) {
nmethod::oops_do_marking_prologue();
}

void ShenandoahCodeCacheRoots::code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id) {
ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CodeCacheRoots, worker_id);
_coderoots_iterator.possibly_parallel_blobs_do(blob_cl);
}

ShenandoahCodeCacheRoots::~ShenandoahCodeCacheRoots() {
nmethod::oops_do_marking_epilogue();
}

ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase) :
_heap(ShenandoahHeap::heap()),
_phase(phase),
@@ -250,29 +245,52 @@ void ShenandoahRootAdjuster::roots_do(uint worker_id, OopClosure* oops) {
}

ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner(uint n_workers) :
ShenandoahRootProcessor(ShenandoahPhaseTimings::heap_iteration_roots),
_thread_roots(ShenandoahPhaseTimings::heap_iteration_roots, false /*is par*/),
_vm_roots(ShenandoahPhaseTimings::heap_iteration_roots),
_cld_roots(ShenandoahPhaseTimings::heap_iteration_roots, n_workers, true /*heap iteration*/),
_weak_roots(ShenandoahPhaseTimings::heap_iteration_roots),
_code_roots(ShenandoahPhaseTimings::heap_iteration_roots) {
}

void ShenandoahHeapIterationRootScanner::roots_do(OopClosure* oops) {
// Must use _claim_other to avoid interfering with concurrent CLDG iteration
CLDToOopClosure clds(oops, ClassLoaderData::_claim_other);
MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
AlwaysTrueClosure always_true;

ResourceMark rm;

// Process light-weight/limited parallel roots then
_vm_roots.oops_do(oops, 0);
_weak_roots.oops_do<OopClosure>(oops, 0);
_cld_roots.cld_do(&clds, 0);

// Process heavy-weight/fully parallel roots the last
_code_roots.code_blobs_do(&code, 0);
_thread_roots.threads_do(&tc_cl, 0);
}
ShenandoahRootProcessor(ShenandoahPhaseTimings::heap_iteration_roots),
_thread_roots(ShenandoahPhaseTimings::heap_iteration_roots, false /*is par*/),
_vm_roots(ShenandoahPhaseTimings::heap_iteration_roots),
_cld_roots(ShenandoahPhaseTimings::heap_iteration_roots, n_workers, true /*heap iteration*/),
_weak_roots(ShenandoahPhaseTimings::heap_iteration_roots),
_code_roots(ShenandoahPhaseTimings::heap_iteration_roots) {
}

class ShenandoahMarkCodeBlobClosure : public CodeBlobClosure {
private:
OopClosure* const _oops;
BarrierSetNMethod* const _bs_nm;

public:
ShenandoahMarkCodeBlobClosure(OopClosure* oops) :
_oops(oops),
_bs_nm(BarrierSet::barrier_set()->barrier_set_nmethod()) {}

virtual void do_code_blob(CodeBlob* cb) {
nmethod* const nm = cb->as_nmethod_or_null();
if (nm != nullptr) {
if (_bs_nm != nullptr) {
// Make sure it only sees to-space objects
_bs_nm->nmethod_entry_barrier(nm);
}
ShenandoahNMethod* const snm = ShenandoahNMethod::gc_data(nm);
assert(snm != nullptr, "Sanity");
snm->oops_do(_oops, false /*fix_relocations*/);
}
}
};

void ShenandoahHeapIterationRootScanner::roots_do(OopClosure* oops) {
// Must use _claim_other to avoid interfering with concurrent CLDG iteration
CLDToOopClosure clds(oops, ClassLoaderData::_claim_other);
ShenandoahMarkCodeBlobClosure code(oops);
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);

ResourceMark rm;

// Process light-weight/limited parallel roots then
_vm_roots.oops_do(oops, 0);
_weak_roots.oops_do<OopClosure>(oops, 0);
_cld_roots.cld_do(&clds, 0);

// Process heavy-weight/fully parallel roots the last
_code_roots.code_blobs_do(&code, 0);
_thread_roots.threads_do(&tc_cl, 0);
}
@@ -102,7 +102,6 @@ class ShenandoahCodeCacheRoots {
ShenandoahCodeRootsIterator _coderoots_iterator;
public:
ShenandoahCodeCacheRoots(ShenandoahPhaseTimings::Phase phase);
~ShenandoahCodeCacheRoots();

void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
};

1 comment on commit 1128674

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 1128674 Dec 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.