8222227: Shenandoah: Fix Traversal GC weak roots handling in final-traversal pause
Reviewed-by: shade, zgu
--- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp Tue Apr 09 21:20:16 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp Tue Apr 09 23:36:43 2019 +0200
@@ -41,13 +41,6 @@
FLAG_SET_DEFAULT(ShenandoahKeepAliveBarrier, false);
FLAG_SET_DEFAULT(ShenandoahAllowMixedAllocs, false);
- SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahRefProcFrequency, 1);
-
- // Adjust class unloading settings only if globally enabled.
- if (ClassUnloadingWithConcurrentMark) {
- SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahUnloadClassesFrequency, 1);
- }
-
SHENANDOAH_ERGO_ENABLE_FLAG(ExplicitGCInvokesConcurrent);
SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahImplicitGCInvokesConcurrent);
--- a/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp Tue Apr 09 21:20:16 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp Tue Apr 09 23:36:43 2019 +0200
@@ -595,11 +595,10 @@
}
if (!_heap->cancelled_gc()) {
+ fixup_roots();
if (_heap->unload_classes()) {
_heap->unload_classes_and_cleanup_tables(false);
}
-
- fixup_roots();
}
if (!_heap->cancelled_gc()) {
@@ -769,29 +768,6 @@
void do_oop(oop* p) { do_oop_work(p); }
};
-class ShenandoahTraversalWeakUpdateClosure : public OopClosure {
-private:
- template <class T>
- inline void do_oop_work(T* p) {
- // Cannot call maybe_update_with_forwarded, because on traversal-degen
- // path the collection set is already dropped. Instead, do the unguarded store.
- // TODO: This can be fixed after degen-traversal stops dropping cset.
- T o = RawAccess<>::oop_load(p);
- if (!CompressedOops::is_null(o)) {
- oop obj = CompressedOops::decode_not_null(o);
- obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
- shenandoah_assert_marked(p, obj);
- RawAccess<IS_NOT_NULL>::oop_store(p, obj);
- }
- }
-
-public:
- ShenandoahTraversalWeakUpdateClosure() {}
-
- void do_oop(narrowOop* p) { do_oop_work(p); }
- void do_oop(oop* p) { do_oop_work(p); }
-};
-
class ShenandoahTraversalKeepAliveUpdateDegenClosure : public OopClosure {
private:
ShenandoahObjToScanQueue* _queue;
@@ -1104,16 +1080,6 @@
&pt);
}
- {
- ShenandoahGCPhase phase(phase_process);
- ShenandoahTerminationTracker termination(ShenandoahPhaseTimings::weakrefs_termination);
-
- // Process leftover weak oops (using parallel version)
- ShenandoahTraversalWeakUpdateClosure cl;
- WeakProcessor::weak_oops_do(workers, &is_alive, &cl, 1);
-
- pt.print_all_references();
-
- assert(task_queues()->is_empty() || _heap->cancelled_gc(), "Should be empty");
- }
+ pt.print_all_references();
+ assert(task_queues()->is_empty() || _heap->cancelled_gc(), "Should be empty");
}