Skip to content

Commit 1128674

Browse files
committed
8278627: Shenandoah: TestHeapDump test failed
Reviewed-by: shade, rkennke
1 parent 54517fa commit 1128674

File tree

3 files changed

+50
-33
lines changed

3 files changed

+50
-33
lines changed

src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ ShenandoahCodeBlobAndDisarmClosure::ShenandoahCodeBlobAndDisarmClosure(OopClosur
227227

228228
void ShenandoahCodeBlobAndDisarmClosure::do_code_blob(CodeBlob* cb) {
229229
nmethod* const nm = cb->as_nmethod_or_null();
230-
if (nm != NULL && nm->oops_do_try_claim()) {
230+
if (nm != NULL) {
231231
assert(!ShenandoahNMethod::gc_data(nm)->is_unregistered(), "Should not be here");
232232
CodeBlobToOopClosure::do_code_blob(cb);
233233
_bs->disarm(nm);

src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,13 @@ ShenandoahThreadRoots::~ShenandoahThreadRoots() {
7979
}
8080

8181
ShenandoahCodeCacheRoots::ShenandoahCodeCacheRoots(ShenandoahPhaseTimings::Phase phase) : _phase(phase) {
82-
nmethod::oops_do_marking_prologue();
8382
}
8483

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

90-
ShenandoahCodeCacheRoots::~ShenandoahCodeCacheRoots() {
91-
nmethod::oops_do_marking_epilogue();
92-
}
93-
9489
ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase) :
9590
_heap(ShenandoahHeap::heap()),
9691
_phase(phase),
@@ -250,29 +245,52 @@ void ShenandoahRootAdjuster::roots_do(uint worker_id, OopClosure* oops) {
250245
}
251246

252247
ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner(uint n_workers) :
253-
ShenandoahRootProcessor(ShenandoahPhaseTimings::heap_iteration_roots),
254-
_thread_roots(ShenandoahPhaseTimings::heap_iteration_roots, false /*is par*/),
255-
_vm_roots(ShenandoahPhaseTimings::heap_iteration_roots),
256-
_cld_roots(ShenandoahPhaseTimings::heap_iteration_roots, n_workers, true /*heap iteration*/),
257-
_weak_roots(ShenandoahPhaseTimings::heap_iteration_roots),
258-
_code_roots(ShenandoahPhaseTimings::heap_iteration_roots) {
259-
}
260-
261-
void ShenandoahHeapIterationRootScanner::roots_do(OopClosure* oops) {
262-
// Must use _claim_other to avoid interfering with concurrent CLDG iteration
263-
CLDToOopClosure clds(oops, ClassLoaderData::_claim_other);
264-
MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
265-
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
266-
AlwaysTrueClosure always_true;
267-
268-
ResourceMark rm;
269-
270-
// Process light-weight/limited parallel roots then
271-
_vm_roots.oops_do(oops, 0);
272-
_weak_roots.oops_do<OopClosure>(oops, 0);
273-
_cld_roots.cld_do(&clds, 0);
274-
275-
// Process heavy-weight/fully parallel roots the last
276-
_code_roots.code_blobs_do(&code, 0);
277-
_thread_roots.threads_do(&tc_cl, 0);
278-
}
248+
ShenandoahRootProcessor(ShenandoahPhaseTimings::heap_iteration_roots),
249+
_thread_roots(ShenandoahPhaseTimings::heap_iteration_roots, false /*is par*/),
250+
_vm_roots(ShenandoahPhaseTimings::heap_iteration_roots),
251+
_cld_roots(ShenandoahPhaseTimings::heap_iteration_roots, n_workers, true /*heap iteration*/),
252+
_weak_roots(ShenandoahPhaseTimings::heap_iteration_roots),
253+
_code_roots(ShenandoahPhaseTimings::heap_iteration_roots) {
254+
}
255+
256+
class ShenandoahMarkCodeBlobClosure : public CodeBlobClosure {
257+
private:
258+
OopClosure* const _oops;
259+
BarrierSetNMethod* const _bs_nm;
260+
261+
public:
262+
ShenandoahMarkCodeBlobClosure(OopClosure* oops) :
263+
_oops(oops),
264+
_bs_nm(BarrierSet::barrier_set()->barrier_set_nmethod()) {}
265+
266+
virtual void do_code_blob(CodeBlob* cb) {
267+
nmethod* const nm = cb->as_nmethod_or_null();
268+
if (nm != nullptr) {
269+
if (_bs_nm != nullptr) {
270+
// Make sure it only sees to-space objects
271+
_bs_nm->nmethod_entry_barrier(nm);
272+
}
273+
ShenandoahNMethod* const snm = ShenandoahNMethod::gc_data(nm);
274+
assert(snm != nullptr, "Sanity");
275+
snm->oops_do(_oops, false /*fix_relocations*/);
276+
}
277+
}
278+
};
279+
280+
void ShenandoahHeapIterationRootScanner::roots_do(OopClosure* oops) {
281+
// Must use _claim_other to avoid interfering with concurrent CLDG iteration
282+
CLDToOopClosure clds(oops, ClassLoaderData::_claim_other);
283+
ShenandoahMarkCodeBlobClosure code(oops);
284+
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
285+
286+
ResourceMark rm;
287+
288+
// Process light-weight/limited parallel roots then
289+
_vm_roots.oops_do(oops, 0);
290+
_weak_roots.oops_do<OopClosure>(oops, 0);
291+
_cld_roots.cld_do(&clds, 0);
292+
293+
// Process heavy-weight/fully parallel roots the last
294+
_code_roots.code_blobs_do(&code, 0);
295+
_thread_roots.threads_do(&tc_cl, 0);
296+
}

src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ class ShenandoahCodeCacheRoots {
102102
ShenandoahCodeRootsIterator _coderoots_iterator;
103103
public:
104104
ShenandoahCodeCacheRoots(ShenandoahPhaseTimings::Phase phase);
105-
~ShenandoahCodeCacheRoots();
106105

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

0 commit comments

Comments
 (0)