< prev index next >

src/share/vm/gc/shenandoah/shenandoahHeap.cpp

Print this page
rev 12117 : Pin regions that contain JNI critical regions, instead of bail-and-retry protocol.

@@ -37,11 +37,10 @@
 #include "gc/shenandoah/shenandoahFreeSet.hpp"
 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
 #include "gc/shenandoah/shenandoahHeapRegionSet.hpp"
 #include "gc/shenandoah/shenandoahHumongous.hpp"
-#include "gc/shenandoah/shenandoahJNICritical.hpp"
 #include "gc/shenandoah/shenandoahMarkCompact.hpp"
 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
 #include "gc/shenandoah/vm_operations_shenandoah.hpp"
 

@@ -210,11 +209,10 @@
   _mark_bit_map1(),
   _cancelled_concgc(false),
   _need_update_refs(false),
   _need_reset_bitmaps(false),
   _growing_heap(0),
-  _jni_critical(new ShenandoahJNICritical()),
   _gc_timer(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer())
 
 {
   if (ShenandoahLogConfig) {
     tty->print_cr("Parallel GC threads: "UINT32_FORMAT, ParallelGCThreads);

@@ -1412,10 +1410,11 @@
 bool ShenandoahHeap::card_mark_must_follow_store() const {
   return false;
 }
 
 void ShenandoahHeap::collect(GCCause::Cause cause) {
+  assert(cause != GCCause::_gc_locker, "no JNI critical callback");
   if (GCCause::is_user_requested_gc(cause)) {
     if (! DisableExplicitGC) {
       cancel_concgc();
       _concurrent_gc_thread->do_full_gc(cause);
     }

@@ -1423,17 +1422,10 @@
 
     cancel_concgc();
     collector_policy()->set_should_clear_all_soft_refs(true);
       _concurrent_gc_thread->do_full_gc(cause);
 
-  } else if (cause == GCCause::_gc_locker) {
-
-    if (ShenandoahTraceJNICritical) {
-      tty->print_cr("Resuming deferred evacuation after JNI critical regions");
-    }
-
-    jni_critical()->notify_jni_critical();
   }
 }
 
 void ShenandoahHeap::do_full_collection(bool clear_all_soft_refs) {
   //assert(false, "Shouldn't need to do full collections");

@@ -2084,14 +2076,10 @@
 
 void ShenandoahHeap::set_need_update_refs(bool need_update_refs) {
   _need_update_refs = need_update_refs;
 }
 
-ShenandoahJNICritical* ShenandoahHeap::jni_critical() {
-  return _jni_critical;
-}
-
 //fixme this should be in heapregionset
 ShenandoahHeapRegion* ShenandoahHeap::next_compaction_region(const ShenandoahHeapRegion* r) {
   size_t region_idx = r->region_number() + 1;
   ShenandoahHeapRegion* next = _ordered_regions->get(region_idx);
   guarantee(next->region_number() == region_idx, "region number must match");

@@ -2219,8 +2207,17 @@
 }
 
 void ShenandoahHeap::unregister_nmethod(nmethod* nm) {
 }
 
+void ShenandoahHeap::enter_critical(oop o) {
+  heap_region_containing(o)->enter_critical();
+}
+
+void ShenandoahHeap::exit_critical(oop o) {
+  heap_region_containing(o)->exit_critical();
+}
+
+
 GCTimer* ShenandoahHeap::gc_timer() const {
   return _gc_timer;
 }
< prev index next >