8231999: Shenandoah: Traversal failed compiler/jsr292/CallSiteDepContextTest.java
authorzgu
Thu, 17 Oct 2019 13:14:48 -0400
changeset 58674 42a3a8941418
parent 58673 06cc25fe0ca3
child 58675 0cc52a55fce4
8231999: Shenandoah: Traversal failed compiler/jsr292/CallSiteDepContextTest.java Reviewed-by: rkennke
src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp	Thu Oct 17 09:38:32 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp	Thu Oct 17 13:14:48 2019 -0400
@@ -268,17 +268,12 @@
   }
 
   ShenandoahMarkingContext* const marking_context = _heap->marking_context();
-
-  if (_heap->is_evacuation_in_progress()) {
-    // Normal GC
-    if (!marking_context->is_marked(obj)) {
+  if (_heap->is_evacuation_in_progress() && !marking_context->is_marked(obj)) {
+    Thread* thr = Thread::current();
+    if (thr->is_Java_thread()) {
       return NULL;
-    }
-  } else if (_heap->is_concurrent_traversal_in_progress()) {
-    // Traversal GC
-    if (marking_context->is_complete() &&
-        !marking_context->is_marked(resolve_forwarded_not_null(obj))) {
-      return NULL;
+    } else {
+      return obj;
     }
   }
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Thu Oct 17 09:38:32 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Thu Oct 17 13:14:48 2019 -0400
@@ -1902,7 +1902,7 @@
 }
 
 void ShenandoahHeap::set_concurrent_traversal_in_progress(bool in_progress) {
-   set_gc_state_mask(TRAVERSAL | HAS_FORWARDED | UPDATEREFS, in_progress);
+   set_gc_state_mask(TRAVERSAL, in_progress);
    ShenandoahBarrierSet::satb_mark_queue_set().set_active_all_threads(in_progress, !in_progress);
 }
 
@@ -2060,7 +2060,12 @@
 }
 
 void ShenandoahHeap::set_has_forwarded_objects(bool cond) {
-  set_gc_state_mask(HAS_FORWARDED, cond);
+  if (is_traversal_mode()) {
+    set_gc_state_mask(HAS_FORWARDED | UPDATEREFS, cond);
+  } else {
+    set_gc_state_mask(HAS_FORWARDED, cond);
+  }
+
 }
 
 void ShenandoahHeap::set_process_references(bool pr) {
--- a/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp	Thu Oct 17 09:38:32 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp	Thu Oct 17 13:14:48 2019 -0400
@@ -390,6 +390,7 @@
   }
 
   _heap->set_concurrent_traversal_in_progress(true);
+  _heap->set_has_forwarded_objects(true);
 
   bool process_refs = _heap->process_references();
   if (process_refs) {
@@ -601,11 +602,14 @@
     TASKQUEUE_STATS_ONLY(_task_queues->reset_taskqueue_stats());
 
     // No more marking expected
+    _heap->set_concurrent_traversal_in_progress(false);
     _heap->mark_complete_marking_context();
 
     fixup_roots();
     _heap->parallel_cleaning(false);
 
+    _heap->set_has_forwarded_objects(false);
+
     // Resize metaspace
     MetaspaceGC::compute_new_size();
 
@@ -651,7 +655,6 @@
     }
 
     assert(_task_queues->is_empty(), "queues must be empty after traversal GC");
-    _heap->set_concurrent_traversal_in_progress(false);
     assert(!_heap->cancelled_gc(), "must not be cancelled when getting out here");
 
     if (ShenandoahVerify) {