Skip to content

Commit 3d5fea1

Browse files
committed
8253434: Shenandoah: Cleanup ShenandoahRootScanner
Reviewed-by: rkennke
1 parent 8c02bdb commit 3d5fea1

File tree

3 files changed

+7
-42
lines changed

3 files changed

+7
-42
lines changed

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

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,7 @@ class ShenandoahInitMarkRootsTask : public AbstractGangTask {
107107

108108
private:
109109
void do_work(ShenandoahHeap* heap, OopClosure* oops, uint worker_id) {
110-
// The rationale for selecting the roots to scan is as follows:
111-
// a. With unload_classes = true, we only want to scan the actual strong roots from the
112-
// code cache. This will allow us to identify the dead classes, unload them, *and*
113-
// invalidate the relevant code cache blobs. This could be only done together with
114-
// class unloading.
115-
// b. With unload_classes = false, we have to nominally retain all the references from code
116-
// cache, because there could be the case of embedded class/oop in the generated code,
117-
// which we will never visit during mark. Without code cache invalidation, as in (a),
118-
// we risk executing that code cache blob, and crashing.
119-
if (heap->unload_classes()) {
120-
_rp->strong_roots_do(worker_id, oops);
121-
} else {
122-
_rp->roots_do(worker_id, oops);
123-
}
110+
_rp->roots_do(worker_id, oops);
124111
}
125112
};
126113

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

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -168,30 +168,13 @@ ShenandoahRootScanner::~ShenandoahRootScanner() {
168168
}
169169

170170
void ShenandoahRootScanner::roots_do(uint worker_id, OopClosure* oops) {
171-
CLDToOopClosure clds_cl(oops, ClassLoaderData::_claim_strong);
172171
MarkingCodeBlobClosure blobs_cl(oops, !CodeBlobToOopClosure::FixRelocations);
173-
roots_do(worker_id, oops, &clds_cl, &blobs_cl);
172+
roots_do(worker_id, oops, &blobs_cl);
174173
}
175174

176-
void ShenandoahRootScanner::strong_roots_do(uint worker_id, OopClosure* oops) {
177-
CLDToOopClosure clds_cl(oops, ClassLoaderData::_claim_strong);
178-
MarkingCodeBlobClosure blobs_cl(oops, !CodeBlobToOopClosure::FixRelocations);
179-
strong_roots_do(worker_id, oops, &clds_cl, &blobs_cl);
180-
}
181-
182-
void ShenandoahRootScanner::roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure *tc) {
183-
assert(!ShenandoahSafepoint::is_at_shenandoah_safepoint() ||
184-
!ShenandoahHeap::heap()->unload_classes(),
185-
"Expect class unloading when Shenandoah cycle is running");
186-
assert(clds != NULL, "Only possible with CLD closure");
187-
188-
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, code, tc);
189-
ResourceMark rm;
190-
_thread_roots.threads_do(&tc_cl, worker_id);
191-
}
175+
void ShenandoahRootScanner::roots_do(uint worker_id, OopClosure* oops, CodeBlobClosure* code, ThreadClosure *tc) {
176+
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
192177

193-
void ShenandoahRootScanner::strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc) {
194-
assert(ShenandoahHeap::heap()->unload_classes(), "Should be used during class unloading");
195178
ShenandoahParallelOopsDoThreadClosure tc_cl(oops, code, tc);
196179
ResourceMark rm;
197180
_thread_roots.threads_do(&tc_cl, worker_id);

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,10 @@ class ShenandoahRootScanner : public ShenandoahRootProcessor {
197197
ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase);
198198
~ShenandoahRootScanner();
199199

200-
// Apply oops, clds and blobs to all strongly reachable roots in the system,
201-
// during class unloading cycle
202-
void strong_roots_do(uint worker_id, OopClosure* cl);
203-
void strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
204-
205-
// Apply oops, clds and blobs to all strongly reachable roots and weakly reachable
206-
// roots when class unloading is disabled during this cycle
207200
void roots_do(uint worker_id, OopClosure* cl);
208-
void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
201+
202+
private:
203+
void roots_do(uint worker_id, OopClosure* oops, CodeBlobClosure* code, ThreadClosure* tc = NULL);
209204
};
210205

211206
template <bool CONCURRENT>

0 commit comments

Comments
 (0)