changeset 13262:f13f6dc290c8

don't pass HotSpotResolvedObjectType to VMToCompiler.compileMethod but instead create it in Java code
author twisti
date Sun, 08 Dec 2013 14:33:38 -0800
parents 0ffe9e4bb364
children 81055aacb98d
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java src/share/vm/classfile/vmSymbols.hpp src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalVMToCompiler.cpp src/share/vm/graal/graalVMToCompiler.hpp
diffstat 6 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java	Sun Dec 08 13:27:52 2013 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java	Sun Dec 08 14:33:38 2013 -0800
@@ -38,7 +38,7 @@
      * Compiles a method to machine code. This method is called from the VM
      * (VMToCompiler::compileMethod).
      */
-    void compileMethod(long metaspaceMethod, HotSpotResolvedObjectType holder, int entryBCI, boolean blocking);
+    void compileMethod(long metaspaceMethod, int entryBCI, boolean blocking);
 
     void shutdownCompiler() throws Exception;
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Sun Dec 08 13:27:52 2013 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Sun Dec 08 14:33:38 2013 -0800
@@ -502,7 +502,12 @@
     }
 
     @Override
-    public void compileMethod(long metaspaceMethod, final HotSpotResolvedObjectType holder, final int entryBCI, final boolean blocking) {
+    public void compileMethod(long metaspaceMethod, final int entryBCI, final boolean blocking) {
+        HotSpotVMConfig config = runtime().getConfig();
+        final long metaspaceConstMethod = unsafe.getAddress(metaspaceMethod + config.methodConstMethodOffset);
+        final long metaspaceConstantPool = unsafe.getAddress(metaspaceConstMethod + config.constMethodConstantsOffset);
+        final long metaspaceKlass = unsafe.getAddress(metaspaceConstantPool + config.constantPoolHolderOffset);
+        final HotSpotResolvedObjectType holder = (HotSpotResolvedObjectType) HotSpotResolvedObjectType.fromMetaspaceKlass(metaspaceKlass);
         final HotSpotResolvedJavaMethod method = holder.createMethod(metaspaceMethod);
         // We have to use a privileged action here because compilations are enqueued from user code
         // which very likely contains unprivileged frames.
--- a/src/share/vm/classfile/vmSymbols.hpp	Sun Dec 08 13:27:52 2013 -0800
+++ b/src/share/vm/classfile/vmSymbols.hpp	Sun Dec 08 14:33:38 2013 -0800
@@ -355,7 +355,7 @@
   template(compileTheWorld_name,                  "compileTheWorld")                                                                  \
   template(shutdownCompiler_name,                 "shutdownCompiler")                                                                 \
   template(compileMethod_name,                    "compileMethod")                                                                    \
-  template(compileMethod_signature,               "(JLcom/oracle/graal/hotspot/meta/HotSpotResolvedObjectType;IZ)V")                  \
+  template(compileMethod_signature,               "(JIZ)V")                                                                           \
   template(setOption_name,                        "setOption")                                                                        \
   template(setOption_signature,                   "(Ljava/lang/String;)Z")                                                            \
   template(finalizeOptions_name,                  "finalizeOptions")                                                                  \
--- a/src/share/vm/graal/graalCompiler.cpp	Sun Dec 08 13:27:52 2013 -0800
+++ b/src/share/vm/graal/graalCompiler.cpp	Sun Dec 08 14:33:38 2013 -0800
@@ -193,9 +193,7 @@
   assert(_initialized, "must already be initialized");
   ResourceMark rm;
   thread->set_is_graal_compiling(true);
-  Handle holder = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK);
-  check_pending_exception("Error while calling createHotSpotResolvedObjectType");
-  VMToCompiler::compileMethod(method(), holder, entry_bci, blocking);
+  VMToCompiler::compileMethod(method(), entry_bci, blocking);
   thread->set_is_graal_compiling(false);
 }
 
--- a/src/share/vm/graal/graalVMToCompiler.cpp	Sun Dec 08 13:27:52 2013 -0800
+++ b/src/share/vm/graal/graalVMToCompiler.cpp	Sun Dec 08 14:33:38 2013 -0800
@@ -111,15 +111,13 @@
   check_pending_exception("Error while calling finalizeOptions");
 }
 
-void VMToCompiler::compileMethod(Method* method, Handle holder, int entry_bci, jboolean blocking) {
+void VMToCompiler::compileMethod(Method* method, int entry_bci, jboolean blocking) {
   assert(method != NULL, "just checking");
-  assert(!holder.is_null(), "just checking");
   Thread* THREAD = Thread::current();
   JavaValue result(T_VOID);
   JavaCallArguments args;
   args.push_oop(instance());
   args.push_long((jlong) (address) method);
-  args.push_oop(holder());
   args.push_int(entry_bci);
   args.push_int(blocking);
   JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD);
--- a/src/share/vm/graal/graalVMToCompiler.hpp	Sun Dec 08 13:27:52 2013 -0800
+++ b/src/share/vm/graal/graalVMToCompiler.hpp	Sun Dec 08 14:33:38 2013 -0800
@@ -60,8 +60,8 @@
   // public static void HotSpotOptions.finalizeOptions(boolean ciTime);
   static void finalizeOptions(jboolean ciTime);
 
-  // public abstract boolean compileMethod(long vmId, String name, int entry_bci, boolean blocking);
-  static void compileMethod(Method* method, Handle holder, int entry_bci, jboolean blocking);
+  // public abstract boolean compileMethod(long vmId, int entry_bci, boolean blocking);
+  static void compileMethod(Method* method, int entry_bci, jboolean blocking);
 
   // public abstract void shutdownCompiler();
   static void shutdownCompiler();