diff src/share/vm/runtime/sharedRuntime.cpp @ 4873:0382d2b469b2

7013347: allow crypto functions to be called inline to enhance performance Reviewed-by: kvn
author never
date Wed, 01 Feb 2012 16:57:08 -0800
parents aa3d708d67c4
children 09d00c18e323
line wrap: on
line diff
--- a/src/share/vm/runtime/sharedRuntime.cpp	Wed Feb 01 07:59:01 2012 -0800
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Wed Feb 01 16:57:08 2012 -0800
@@ -2678,6 +2678,20 @@
   return nm;
 }
 
+JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread))
+  assert(thread == JavaThread::current(), "must be");
+  // The code is about to enter a JNI lazy critical native method and
+  // _needs_gc is true, so if this thread is already in a critical
+  // section then just return, otherwise this thread should block
+  // until needs_gc has been cleared.
+  if (thread->in_critical()) {
+    return;
+  }
+  // Lock and unlock a critical section to give the system a chance to block
+  GC_locker::lock_critical(thread);
+  GC_locker::unlock_critical(thread);
+JRT_END
+
 #ifdef HAVE_DTRACE_H
 // Create a dtrace nmethod for this method.  The wrapper converts the
 // java compiled calling convention to the native convention, makes a dummy call