diff src/share/vm/runtime/javaCalls.cpp @ 4993:897b7d18bebc

added RiCompiledMethod.execute and the required VM infrastructure
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 28 Feb 2012 18:00:35 +0100
parents 1b8d02e10ee8
children 11ce128f8d28
line wrap: on
line diff
--- a/src/share/vm/runtime/javaCalls.cpp	Tue Feb 28 17:53:07 2012 +0100
+++ b/src/share/vm/runtime/javaCalls.cpp	Tue Feb 28 18:00:35 2012 +0100
@@ -334,10 +334,19 @@
   assert(THREAD->is_Java_thread(), "only JavaThreads can make JavaCalls");
   // Need to wrap each and everytime, since there might be native code down the
   // stack that has installed its own exception handlers
-  os::os_exception_wrapper(call_helper, result, &method, args, THREAD);
+  os::os_exception_wrapper(call_helper, result, &method, NULL, args, THREAD);
 }
 
-void JavaCalls::call_helper(JavaValue* result, methodHandle* m, JavaCallArguments* args, TRAPS) {
+void JavaCalls::call(JavaValue* result, methodHandle method, nmethod* nm, JavaCallArguments* args, TRAPS) {
+  // Check if we need to wrap a potential OS exception handler around thread
+  // This is used for e.g. Win32 structured exception handlers
+  assert(THREAD->is_Java_thread(), "only JavaThreads can make JavaCalls");
+  // Need to wrap each and everytime, since there might be native code down the
+  // stack that has installed its own exception handlers
+  os::os_exception_wrapper(call_helper, result, &method, nm, args, THREAD);
+}
+
+void JavaCalls::call_helper(JavaValue* result, methodHandle* m, nmethod* nm, JavaCallArguments* args, TRAPS) {
   methodHandle method = *m;
   JavaThread* thread = (JavaThread*)THREAD;
   assert(thread->is_Java_thread(), "must be called by a java thread");
@@ -416,6 +425,19 @@
     os::bang_stack_shadow_pages();
   }
 
+  if (nm != NULL) {
+#ifdef GRAAL
+    if (nm->is_alive()) {
+      ((JavaThread*) THREAD)->set_graal_alternate_call_target(nm->entry_point());
+      entry_point = method->adapter()->get_i2c_entry();
+    } else {
+      THROW(vmSymbols::MethodInvalidatedException());
+    }
+#else
+    ShouldNotReachHere();
+#endif
+  }
+
   // do call
   { JavaCallWrapper link(method, receiver, result, CHECK);
     { HandleMark hm(thread);  // HandleMark used by HandleMarkCleaner