Skip to content
Permalink
Browse files
8278627: Shenandoah: TestHeapDump test failed
Reviewed-by: shade
Backport-of: 1128674d7f3766dda8869b213e1fc629e44ea7a8
  • Loading branch information
zhengyu123 committed Jan 6, 2022
1 parent 3b5fc8c commit e54e3c42093f50ea90da7ba67ae79da85c36623a
Showing 3 changed files with 39 additions and 23 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),
@@ -258,22 +253,44 @@ ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner() :
_code_roots(ShenandoahPhaseTimings::heap_iteration_roots) {
}

void ShenandoahHeapIterationRootScanner::roots_do(OopClosure* oops) {
assert(Thread::current()->is_VM_thread(), "Only by VM thread");
// Must use _claim_none to avoid interfering with concurrent CLDG iteration
CLDToOopClosure clds(oops, ClassLoaderData::_claim_none);
MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
AlwaysTrueClosure always_true;
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_none to avoid interfering with concurrent CLDG iteration
CLDToOopClosure clds(oops, ClassLoaderData::_claim_none);
ShenandoahMarkCodeBlobClosure code(oops);
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);

ResourceMark rm;
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 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);
}
// 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 e54e3c4

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on e54e3c4 Jan 6, 2022

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.