diff src/share/vm/graal/graalCompilerToVM.cpp @ 9025:ff5a32117e02

Implement fast invocation of installed code (direct tail call to the target machine code address).
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 12 Apr 2013 01:53:52 +0200
parents 2b840ae76df1
children e0e85d78843b
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Thu Apr 11 17:48:30 2013 +0200
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Fri Apr 12 01:53:52 2013 +0200
@@ -898,12 +898,10 @@
   return JNIHandles::make_local(element);
 C2V_END
 
-C2V_VMENTRY(jobject, executeCompiledMethodVarargs, (JNIEnv *env, jobject args, jlong nativeMethod))
+C2V_VMENTRY(jobject, executeCompiledMethodVarargs, (JNIEnv *env, jobject, jobject args, jlong nativeMethod))
   ResourceMark rm;
   HandleMark hm;
 
-  assert(metaspace_method != 0, "just checking");
-
   nmethod* nm = (nmethod*) (address) nativeMethod;
   methodHandle mh = nm->method();
   Symbol* signature = mh->signature();
@@ -924,24 +922,6 @@
   }
 C2V_END
 
-C2V_VMENTRY(jobject, executeCompiledMethod, (JNIEnv *env, jobject, jobject arg1, jobject arg2, jobject arg3, jlong nativeMethod))
-  ResourceMark rm;
-  HandleMark hm;
-
-  nmethod* nm = (nmethod*) (address) nativeMethod;
-  methodHandle method = nm->method();
-  JavaValue result(T_OBJECT);
-  JavaCallArguments args;
-  args.push_oop(JNIHandles::resolve(arg1));
-  args.push_oop(JNIHandles::resolve(arg2));
-  args.push_oop(JNIHandles::resolve(arg3));
-
-  args.set_alternative_target(nm);
-  JavaCalls::call(&result, method, &args, CHECK_NULL);
-
-  return JNIHandles::make_local((oop) result.get_jobject());
-C2V_END
-
 C2V_VMENTRY(jint, getVtableEntryOffset, (JNIEnv *, jobject, jlong metaspace_method))
 
   Method* method = asMethod(metaspace_method);
@@ -1062,15 +1042,17 @@
 
 C2V_VMENTRY(void, invalidateInstalledCode, (JNIEnv *env, jobject, jlong nativeMethod))
   nmethod* m = (nmethod*)nativeMethod;
-  m->mark_for_deoptimization();
-  VM_Deoptimize op;
-  VMThread::execute(&op);
+  if (!m->is_not_entrant()) {
+    m->mark_for_deoptimization();
+    VM_Deoptimize op;
+    VMThread::execute(&op);
+  }
 C2V_END
 
 
 C2V_VMENTRY(jboolean, isInstalledCodeValid, (JNIEnv *env, jobject, jlong nativeMethod))
   nmethod* m = (nmethod*)nativeMethod;
-  return m->is_alive();
+  return m->is_alive() && !m->is_not_entrant();
 C2V_END
 
 #define CC (char*)  /*cast a literal from (const char*)*/
@@ -1141,7 +1123,6 @@
   {CC"installCode0",                  CC"("HS_COMP_RESULT HS_INSTALLED_CODE"[Z)I",                      FN_PTR(installCode0)},
   {CC"getCode",                       CC"(J)[B",                                                        FN_PTR(getCode)},
   {CC"disassembleNMethod",            CC"(J)"STRING,                                                    FN_PTR(disassembleNMethod)},
-  {CC"executeCompiledMethod",         CC"("OBJECT OBJECT OBJECT NMETHOD")"OBJECT,                       FN_PTR(executeCompiledMethod)},
   {CC"executeCompiledMethodVarargs",  CC"(["OBJECT NMETHOD")"OBJECT,                                    FN_PTR(executeCompiledMethodVarargs)},
   {CC"getDeoptedLeafGraphIds",        CC"()[J",                                                         FN_PTR(getDeoptedLeafGraphIds)},
   {CC"getLineNumberTable",            CC"("HS_RESOLVED_METHOD")[J",                                     FN_PTR(getLineNumberTable)},