changeset 13101:82450573a934

ShenandoahHeap::_cancelled_gc should be consistently treated as jbyte.
author shade
date Tue, 21 Mar 2017 17:24:10 +0100
parents 0548633ee749
children 555f3a32bf60
files src/share/vm/gc/shenandoah/shenandoahConcurrentThread.cpp src/share/vm/gc/shenandoah/shenandoahHeap.cpp src/share/vm/gc/shenandoah/shenandoahHeap.hpp src/share/vm/gc/shenandoah/shenandoahHeap.inline.hpp
diffstat 4 files changed, 8 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc/shenandoah/shenandoahConcurrentThread.cpp	Tue Mar 21 15:04:52 2017 +0100
+++ b/src/share/vm/gc/shenandoah/shenandoahConcurrentThread.cpp	Tue Mar 21 17:24:10 2017 +0100
@@ -129,7 +129,7 @@
     heap->shenandoahPolicy()->record_cm_cancelled();
     if (_full_gc_cause == GCCause::_allocation_failure &&
         heap->shenandoahPolicy()->handover_cancelled_marking()) {
-      heap->set_cancelled_concgc(false);
+      heap->clear_cancelled_concgc();
       clear_full_gc = true;
       heap->shenandoahPolicy()->record_cm_degenerated();
     } else {
--- a/src/share/vm/gc/shenandoah/shenandoahHeap.cpp	Tue Mar 21 15:04:52 2017 +0100
+++ b/src/share/vm/gc/shenandoah/shenandoahHeap.cpp	Tue Mar 21 17:24:10 2017 +0100
@@ -2252,10 +2252,6 @@
   }
 }
 
-void ShenandoahHeap::clear_cancelled_concgc() {
-  set_cancelled_concgc(false);
-}
-
 uint ShenandoahHeap::max_workers() {
   return _max_workers;
 }
--- a/src/share/vm/gc/shenandoah/shenandoahHeap.hpp	Tue Mar 21 15:04:52 2017 +0100
+++ b/src/share/vm/gc/shenandoah/shenandoahHeap.hpp	Tue Mar 21 17:24:10 2017 +0100
@@ -344,9 +344,8 @@
   // param and set to true if this thread succeeded, otherwise to false.
   inline oop  evacuate_object(oop src, Thread* thread, bool& evacuated);
   inline bool cancelled_concgc() const;
-  inline void set_cancelled_concgc(bool v);
-  inline bool try_cancel_concgc() const;
-  void clear_cancelled_concgc();
+  inline bool try_cancel_concgc();
+  inline void clear_cancelled_concgc();
 
   ShenandoahHeapRegionSet* regions() { return _ordered_regions;}
   ShenandoahFreeSet* free_regions();
--- a/src/share/vm/gc/shenandoah/shenandoahHeap.inline.hpp	Tue Mar 21 15:04:52 2017 +0100
+++ b/src/share/vm/gc/shenandoah/shenandoahHeap.inline.hpp	Tue Mar 21 17:24:10 2017 +0100
@@ -207,15 +207,15 @@
 }
 
 inline bool ShenandoahHeap::cancelled_concgc() const {
-  return (jbyte) OrderAccess::load_acquire((jbyte*) &_cancelled_concgc);
+  return OrderAccess::load_acquire((jbyte*) &_cancelled_concgc) == 1;
 }
 
-inline bool ShenandoahHeap::try_cancel_concgc() const {
-  return Atomic::cmpxchg(true, (jbyte*) &_cancelled_concgc, false) == false;
+inline bool ShenandoahHeap::try_cancel_concgc() {
+  return Atomic::cmpxchg(1, &_cancelled_concgc, 0) == 0;
 }
 
-inline void ShenandoahHeap::set_cancelled_concgc(bool v) {
-  OrderAccess::release_store_fence((jbyte*) &_cancelled_concgc, (jbyte) v);
+inline void ShenandoahHeap::clear_cancelled_concgc() {
+  OrderAccess::release_store_fence(&_cancelled_concgc, 0);
 }
 
 inline HeapWord* ShenandoahHeap::allocate_from_gclab(Thread* thread, size_t size) {