changeset 22496:90c4254dc25a

Pass TargetDescription argument to CompilerToVM.installCode.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 01 Sep 2015 13:43:22 +0200
parents 740feb10d15a
children bdaa38ed01da
files jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVMImpl.java jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotCodeCacheProvider.java src/share/vm/jvmci/jvmciCodeInstaller.cpp src/share/vm/jvmci/jvmciCodeInstaller.hpp src/share/vm/jvmci/jvmciCompilerToVM.cpp src/share/vm/jvmci/jvmciJavaAccess.hpp src/share/vm/jvmci/systemDictionary_jvmci.hpp src/share/vm/jvmci/vmSymbols_jvmci.hpp
diffstat 9 files changed, 23 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java	Mon Aug 31 11:13:32 2015 -0700
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java	Tue Sep 01 13:43:22 2015 +0200
@@ -271,6 +271,7 @@
     /**
      * Installs the result of a compilation into the code cache.
      *
+     * @param target the target where this code should be installed
      * @param compiledCode the result of a compilation
      * @param code the details of the installed CodeBlob are written to this object
      * @return the outcome of the installation which will be one of
@@ -280,7 +281,7 @@
      *         {@link HotSpotVMConfig#codeInstallResultDependenciesFailed} or
      *         {@link HotSpotVMConfig#codeInstallResultDependenciesInvalid}.
      */
-    int installCode(HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog);
+    int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog);
 
     /**
      * Notifies the VM of statistics for a completed compilation.
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVMImpl.java	Mon Aug 31 11:13:32 2015 -0700
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVMImpl.java	Tue Sep 01 13:43:22 2015 +0200
@@ -45,7 +45,7 @@
     }
 
     @Override
-    public native int installCode(HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog);
+    public native int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog);
 
     @Override
     public native HotSpotResolvedJavaMethodImpl getResolvedJavaMethodAtSlot(Class<?> holder, int slot);
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotCodeCacheProvider.java	Mon Aug 31 11:13:32 2015 -0700
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotCodeCacheProvider.java	Tue Sep 01 13:43:22 2015 +0200
@@ -108,7 +108,7 @@
             compResult.setId(method.allocateCompileId(compResult.getEntryBCI()));
         }
         HotSpotInstalledCode installedCode = new HotSpotNmethod(method, compResult.getName(), isDefault);
-        runtime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(method, compResult, jvmciEnv), installedCode, method.getSpeculationLog());
+        runtime.getCompilerToVM().installCode(target, new HotSpotCompiledNmethod(method, compResult, jvmciEnv), installedCode, method.getSpeculationLog());
         return logOrDump(installedCode, compResult);
     }
 
@@ -124,7 +124,7 @@
             installedCode = code;
         }
         HotSpotCompiledNmethod compiledCode = new HotSpotCompiledNmethod(hotspotMethod, compResult);
-        int result = runtime.getCompilerToVM().installCode(compiledCode, installedCode, log);
+        int result = runtime.getCompilerToVM().installCode(target, compiledCode, installedCode, log);
         if (result != config.codeInstallResultOk) {
             String msg = compiledCode.getInstallationFailureMessage();
             String resultDesc = config.getCodeInstallResultDescription(result);
@@ -155,7 +155,7 @@
         HotSpotNmethod code = new HotSpotNmethod(javaMethod, compResult.getName(), false, true);
         HotSpotCompiledNmethod compiled = new HotSpotCompiledNmethod(javaMethod, compResult);
         CompilerToVM vm = runtime.getCompilerToVM();
-        int result = vm.installCode(compiled, code, null);
+        int result = vm.installCode(target, compiled, code, null);
         if (result != runtime.getConfig().codeInstallResultOk) {
             return null;
         }
--- a/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Mon Aug 31 11:13:32 2015 -0700
+++ b/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Tue Sep 01 13:43:22 2015 +0200
@@ -390,7 +390,7 @@
 }
 
 // constructor used to create a method
-JVMCIEnv::CodeInstallResult CodeInstaller::install(Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log) {
+JVMCIEnv::CodeInstallResult CodeInstaller::install(Handle target, Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log) {
   BufferBlob* buffer_blob = JVMCIRuntime::initialize_buffer_blob();
   if (buffer_blob == NULL) {
     return JVMCIEnv::cache_full;
--- a/src/share/vm/jvmci/jvmciCodeInstaller.hpp	Mon Aug 31 11:13:32 2015 -0700
+++ b/src/share/vm/jvmci/jvmciCodeInstaller.hpp	Tue Sep 01 13:43:22 2015 +0200
@@ -110,7 +110,7 @@
 public:
 
   CodeInstaller() : _arena(mtCompiler) {}
-  JVMCIEnv::CodeInstallResult install(Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log);
+  JVMCIEnv::CodeInstallResult install(Handle target, Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log);
 
   static address runtime_call_target_address(oop runtime_call);
   static VMReg get_hotspot_reg(jint jvmciRegisterNumber);
--- a/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Mon Aug 31 11:13:32 2015 -0700
+++ b/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Tue Sep 01 13:43:22 2015 +0200
@@ -565,9 +565,10 @@
   method->set_dont_inline(true);
 C2V_END
 
-C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject compiled_code, jobject installed_code, jobject speculation_log))
+C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject installed_code, jobject speculation_log))
   ResourceMark rm;
   HandleMark hm;
+  Handle target_handle = JNIHandles::resolve(target);
   Handle compiled_code_handle = JNIHandles::resolve(compiled_code);
   CodeBlob* cb = NULL;
   Handle installed_code_handle = JNIHandles::resolve(installed_code);
@@ -575,7 +576,7 @@
 
   TraceTime install_time("installCode", JVMCICompiler::codeInstallTimer());
   CodeInstaller installer;
-  JVMCIEnv::CodeInstallResult result = installer.install(compiled_code_handle, cb, installed_code_handle, speculation_log_handle);
+  JVMCIEnv::CodeInstallResult result = installer.install(target_handle, compiled_code_handle, cb, installed_code_handle, speculation_log_handle);
 
   if (PrintCodeCacheOnCompilation) {
     stringStream s;
@@ -1129,6 +1130,7 @@
 #define CLASS                 "Ljava/lang/Class;"
 #define STACK_TRACE_ELEMENT   "Ljava/lang/StackTraceElement;"
 #define INSTALLED_CODE        "Ljdk/internal/jvmci/code/InstalledCode;"
+#define TARGET_DESCRIPTION    "Ljdk/internal/jvmci/code/TargetDescription;"
 #define RESOLVED_METHOD       "Ljdk/internal/jvmci/meta/ResolvedJavaMethod;"
 #define HS_RESOLVED_METHOD    "Ljdk/internal/jvmci/hotspot/HotSpotResolvedJavaMethodImpl;"
 #define HS_RESOLVED_KLASS     "Ljdk/internal/jvmci/hotspot/HotSpotResolvedObjectTypeImpl;"
@@ -1175,7 +1177,7 @@
   {CC"getConstantPool",                              CC"(Ljava/lang/Object;J)"HS_CONSTANT_POOL,                                        FN_PTR(getConstantPool)},
   {CC"getResolvedJavaType",                          CC"(Ljava/lang/Object;JZ)"HS_RESOLVED_KLASS,                                      FN_PTR(getResolvedJavaType)},
   {CC"initializeConfiguration",                      CC"("HS_CONFIG")V",                                                               FN_PTR(initializeConfiguration)},
-  {CC"installCode",                                  CC"("HS_COMPILED_CODE INSTALLED_CODE SPECULATION_LOG")I",                         FN_PTR(installCode)},
+  {CC"installCode",                                  CC"("TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE SPECULATION_LOG")I",      FN_PTR(installCode)},
   {CC"notifyCompilationStatistics",                  CC"(I"HS_RESOLVED_METHOD"ZIJJ"INSTALLED_CODE")V",                                 FN_PTR(notifyCompilationStatistics)},
   {CC"resetCompilationStatistics",                   CC"()V",                                                                          FN_PTR(resetCompilationStatistics)},
   {CC"disassembleCodeBlob",                          CC"(J)"STRING,                                                                    FN_PTR(disassembleCodeBlob)},
--- a/src/share/vm/jvmci/jvmciJavaAccess.hpp	Mon Aug 31 11:13:32 2015 -0700
+++ b/src/share/vm/jvmci/jvmciJavaAccess.hpp	Tue Sep 01 13:43:22 2015 +0200
@@ -48,6 +48,12 @@
  */
 
 #define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, float_field, oop_field, typeArrayOop_field, objArrayOop_field, static_oop_field, static_objArrayOop_field, static_int_field, static_boolean_field) \
+  start_class(Architecture)                                                                                                                                    \
+    oop_field(Architecture, name, "Ljava/lang/String;")                                                                                                        \
+  end_class                                                                                                                                                    \
+  start_class(TargetDescription)                                                                                                                               \
+    oop_field(TargetDescription, arch, "Ljdk/internal/jvmci/code/Architecture;")                                                                               \
+  end_class                                                                                                                                                    \
   start_class(HotSpotResolvedObjectTypeImpl)                                                                                                                   \
     oop_field(HotSpotResolvedObjectTypeImpl, javaClass, "Ljava/lang/Class;")                                                                                   \
   end_class                                                                                                                                                    \
--- a/src/share/vm/jvmci/systemDictionary_jvmci.hpp	Mon Aug 31 11:13:32 2015 -0700
+++ b/src/share/vm/jvmci/systemDictionary_jvmci.hpp	Tue Sep 01 13:43:22 2015 +0200
@@ -49,6 +49,8 @@
   do_klass(Assumptions_ConcreteSubtype_klass,            jdk_internal_jvmci_meta_Assumptions_ConcreteSubtype,            Jvmci) \
   do_klass(Assumptions_LeafType_klass,                   jdk_internal_jvmci_meta_Assumptions_LeafType,                   Jvmci) \
   do_klass(Assumptions_CallSiteTargetValue_klass,        jdk_internal_jvmci_meta_Assumptions_CallSiteTargetValue,        Jvmci) \
+  do_klass(Architecture_klass,                           jdk_internal_jvmci_code_Architecture,                           Jvmci) \
+  do_klass(TargetDescription_klass,                      jdk_internal_jvmci_code_TargetDescription,                      Jvmci) \
   do_klass(BytecodePosition_klass,                       jdk_internal_jvmci_code_BytecodePosition,                       Jvmci) \
   do_klass(DebugInfo_klass,                              jdk_internal_jvmci_code_DebugInfo,                              Jvmci) \
   do_klass(RegisterSaveLayout_klass,                     jdk_internal_jvmci_code_RegisterSaveLayout,                     Jvmci) \
--- a/src/share/vm/jvmci/vmSymbols_jvmci.hpp	Mon Aug 31 11:13:32 2015 -0700
+++ b/src/share/vm/jvmci/vmSymbols_jvmci.hpp	Tue Sep 01 13:43:22 2015 +0200
@@ -59,6 +59,8 @@
   template(jdk_internal_jvmci_meta_Assumptions_ConcreteMethod,         "jdk/internal/jvmci/meta/Assumptions$ConcreteMethod")              \
   template(jdk_internal_jvmci_meta_Assumptions_CallSiteTargetValue,    "jdk/internal/jvmci/meta/Assumptions$CallSiteTargetValue")         \
   template(jdk_internal_jvmci_meta_SpeculationLog,                     "jdk/internal/jvmci/meta/SpeculationLog")                          \
+  template(jdk_internal_jvmci_code_Architecture,                       "jdk/internal/jvmci/code/Architecture")                            \
+  template(jdk_internal_jvmci_code_TargetDescription,                  "jdk/internal/jvmci/code/TargetDescription")                       \
   template(jdk_internal_jvmci_code_CompilationResult_Call,             "jdk/internal/jvmci/code/CompilationResult$Call")                  \
   template(jdk_internal_jvmci_code_CompilationResult_ConstantReference, "jdk/internal/jvmci/code/CompilationResult$ConstantReference")    \
   template(jdk_internal_jvmci_code_CompilationResult_DataPatch,        "jdk/internal/jvmci/code/CompilationResult$DataPatch")             \