< prev index next >

src/share/vm/runtime/safepoint.cpp

Print this page
rev 8802 : G1 performance improvements: card batching, joining, sorting, prefetching and write barrier fence elision and simplification based on a global syncrhonization using handshakes piggybacking on thread-local safepoints.

@@ -180,11 +180,16 @@
   }
 
   // Make interpreter safepoint aware
   Interpreter::notice_safepoints();
 
-  if (DeferPollingPageLoopCount < 0) {
+  if (ThreadLocalSafepoints) {
+    for (JavaThread *cur = Threads::first(); cur != NULL; cur = cur->next()) {
+      // Make sure the threads start polling it's time to yield.
+      cur->set_yieldpoint(true);
+    }
+  } else if (DeferPollingPageLoopCount < 0) {
     // Make polling safepoint aware
     guarantee (PageArmed == 0, "invariant") ;
     PageArmed = 1 ;
     os::make_polling_page_unreadable();
   }

@@ -286,11 +291,11 @@
       //    Alternately, instead of counting iterations of the outer loop
       //    we could count the # of threads visited in the inner loop, above.
       // 9. On windows consider using the return value from SwitchThreadTo()
       //    to drive subsequent spin/SwitchThreadTo()/Sleep(N) decisions.
 
-      if (int(iterations) == DeferPollingPageLoopCount) {
+      if (!ThreadLocalSafepoints && int(iterations) == DeferPollingPageLoopCount) {
          guarantee (PageArmed == 0, "invariant") ;
          PageArmed = 1 ;
          os::make_polling_page_unreadable();
       }
 
< prev index next >