changeset 22636:1ec4129907b3

made CompilerToVM package-private
author Doug Simon <doug.simon@oracle.com>
date Tue, 29 Sep 2015 22:13:22 +0200
parents 353eb2b44df8
children 28b99a7a37d0
files jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotCodeCacheProvider.java src/share/vm/jvmci/jvmciCompilerToVM.cpp
diffstat 3 files changed, 35 insertions(+), 77 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java	Tue Sep 29 22:00:39 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java	Tue Sep 29 22:13:22 2015 +0200
@@ -45,7 +45,7 @@
  * pointer as an argument (e.g., {@link #getSymbol(long)}) is undefined if the argument does not
  * denote a valid native object.
  */
-public final class CompilerToVM {
+final class CompilerToVM {
     /**
      * Initializes the native part of the JVMCI runtime.
      */
@@ -315,11 +315,7 @@
      *         {@link HotSpotVMConfig#codeInstallResultDependenciesFailed} or
      *         {@link HotSpotVMConfig#codeInstallResultDependenciesInvalid}.
      */
-    int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog) {
-        return installCodeImpl(target, compiledCode, code, speculationLog);
-    }
-
-    private native int installCodeImpl(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog);
+    native int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog);
 
     /**
      * Notifies the VM of statistics for a completed compilation.
@@ -333,21 +329,13 @@
      * @param timeUnitsPerSecond the granularity of the units for the {@code time} value
      * @param installedCode the nmethod installed as a result of the compilation
      */
-    void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethod method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond, InstalledCode installedCode) {
-        notifyCompilationStatisticsImpl(id, (HotSpotResolvedJavaMethodImpl) method, osr, processedBytecodes, time, timeUnitsPerSecond, installedCode);
-    }
-
-    private synchronized native void notifyCompilationStatisticsImpl(int id, HotSpotResolvedJavaMethodImpl method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond,
+    synchronized native void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethodImpl method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond,
                     InstalledCode installedCode);
 
     /**
      * Resets all compilation statistics.
      */
-    void resetCompilationStatistics() {
-        resetCompilationStatisticsImpl();
-    }
-
-    native void resetCompilationStatisticsImpl();
+    native void resetCompilationStatistics();
 
     /**
      * Initializes the fields of {@code config}.
@@ -391,11 +379,7 @@
      * @param address an address that may be called from any code in the code cache
      * @return -1 if {@code address == 0}
      */
-    long getMaxCallTargetOffset(long address) {
-        return getMaxCallTargetOffsetImpl(address);
-    }
-
-    private native long getMaxCallTargetOffsetImpl(long address);
+    native long getMaxCallTargetOffset(long address);
 
     /**
      * Gets a textual disassembly of {@code codeBlob}.
@@ -403,12 +387,8 @@
      * @return a non-zero length string containing a disassembly of {@code codeBlob} or null if
      *         {@code codeBlob} could not be disassembled for some reason
      */
-    String disassembleCodeBlob(long codeBlob) {
-        return disassembleCodeBlobImpl(codeBlob);
-    }
-
     // The HotSpot disassembler seems not to be thread safe so it's better to synchronize its usage
-    private synchronized native String disassembleCodeBlobImpl(long codeBlob);
+    synchronized native String disassembleCodeBlob(long codeBlob);
 
     /**
      * Gets a stack trace element for {@code method} at bytecode index {@code bci}.
@@ -486,20 +466,12 @@
      * Invalidates {@code installedCode} such that {@link InvalidInstalledCodeException} will be
      * raised the next time {@code installedCode} is executed.
      */
-    void invalidateInstalledCode(InstalledCode installedCode) {
-        invalidateInstalledCodeImpl(installedCode);
-    }
-
-    private native void invalidateInstalledCodeImpl(InstalledCode installedCode);
+    native void invalidateInstalledCode(InstalledCode installedCode);
 
     /**
      * Collects the current values of all JVMCI benchmark counters, summed up over all threads.
      */
-    long[] collectCounters() {
-        return collectCountersImpl();
-    }
-
-    private native long[] collectCountersImpl();
+    native long[] collectCounters();
 
     /**
      * Determines if {@code metaspaceMethodData} is mature.
@@ -529,11 +501,7 @@
      * @param methods the methods to look for, where {@code null} means that any frame is returned
      * @return the frame, or {@code null} if the end of the stack was reached during the search
      */
-    HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, ResolvedJavaMethod[] methods, int initialSkip) {
-        return getNextStackFrameImpl(frame, methods, initialSkip);
-    }
-
-    private native HotSpotStackFrameReference getNextStackFrameImpl(HotSpotStackFrameReference frame, ResolvedJavaMethod[] methods, int initialSkip);
+    native HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, ResolvedJavaMethod[] methods, int initialSkip);
 
     /**
      * Materializes all virtual objects within {@code stackFrame} updates its locals.
@@ -556,30 +524,20 @@
     /**
      * Determines if debug info should also be emitted at non-safepoint locations.
      */
-    boolean shouldDebugNonSafepoints() {
-        return shouldDebugNonSafepointsImpl();
-    }
 
-    private native boolean shouldDebugNonSafepointsImpl();
+    native boolean shouldDebugNonSafepoints();
 
     /**
      * Writes {@code length} bytes from {@code buf} starting at offset {@code offset} to the
      * HotSpot's log stream. No range checking is performed.
      */
-    void writeDebugOutput(byte[] bytes, int offset, int length) {
-        writeDebugOutputImpl(bytes, offset, length);
-    }
-
-    private native void writeDebugOutputImpl(byte[] bytes, int offset, int length);
+    native void writeDebugOutput(byte[] bytes, int offset, int length);
 
     /**
      * Flush HotSpot's log stream.
      */
-    void flushDebugOutput() {
-        flushDebugOutputImpl();
-    }
 
-    private native void flushDebugOutputImpl();
+    native void flushDebugOutput();
 
     /**
      * Read a value representing a metaspace Method* and return the
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotCodeCacheProvider.java	Tue Sep 29 22:00:39 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotCodeCacheProvider.java	Tue Sep 29 22:13:22 2015 +0200
@@ -282,7 +282,7 @@
      * @param installedCode the nmethod installed as a result of the compilation
      */
     public void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethod method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond, InstalledCode installedCode) {
-        runtime.getCompilerToVM().notifyCompilationStatistics(id, method, osr, processedBytecodes, time, timeUnitsPerSecond, installedCode);
+        runtime.getCompilerToVM().notifyCompilationStatistics(id, (HotSpotResolvedJavaMethodImpl) method, osr, processedBytecodes, time, timeUnitsPerSecond, installedCode);
     }
 
     /**
--- a/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Tue Sep 29 22:00:39 2015 +0200
+++ b/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Tue Sep 29 22:13:22 2015 +0200
@@ -562,7 +562,7 @@
   return JNIHandles::make_local(THREAD, result);
 C2V_END
 
-C2V_VMENTRY(jlong, getMaxCallTargetOffsetImpl, (JNIEnv*, jobject, jlong addr))
+C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv*, jobject, jlong addr))
   address target_addr = (address) addr;
   if (target_addr != 0x0) {
     int64_t off_low = (int64_t)target_addr - ((int64_t)CodeCache::low_bound() + sizeof(int));
@@ -579,7 +579,7 @@
   method->set_dont_inline(true);
 C2V_END
 
-C2V_VMENTRY(jint, installCodeImpl, (JNIEnv *jniEnv, jobject, jobject target, 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);
@@ -627,7 +627,7 @@
   return result;
 C2V_END
 
-C2V_VMENTRY(void, notifyCompilationStatisticsImpl, (JNIEnv *jniEnv, jobject, jint id, jobject hotspot_method, jboolean osr, jint processedBytecodes, jlong time, jlong timeUnitsPerSecond, jobject installed_code))
+C2V_VMENTRY(void, notifyCompilationStatistics, (JNIEnv *jniEnv, jobject, jint id, jobject hotspot_method, jboolean osr, jint processedBytecodes, jlong time, jlong timeUnitsPerSecond, jobject installed_code))
   CompilerStatistics* stats = JVMCICompiler::instance()->stats();
 
   elapsedTimer timer = elapsedTimer(time, timeUnitsPerSecond);
@@ -650,13 +650,13 @@
   }
 C2V_END
 
-C2V_VMENTRY(void, resetCompilationStatisticsImpl, (JNIEnv *jniEnv, jobject))
+C2V_VMENTRY(void, resetCompilationStatistics, (JNIEnv *jniEnv, jobject))
   CompilerStatistics* stats = JVMCICompiler::instance()->stats();
   stats->_standard.reset();
   stats->_osr.reset();
 C2V_END
 
-C2V_VMENTRY(jobject, disassembleCodeBlobImpl, (JNIEnv *jniEnv, jobject, jlong codeBlob))
+C2V_VMENTRY(jobject, disassembleCodeBlob, (JNIEnv *jniEnv, jobject, jlong codeBlob))
   ResourceMark rm;
   HandleMark hm;
 
@@ -810,7 +810,7 @@
 C2V_END
 
 
-C2V_VMENTRY(void, invalidateInstalledCodeImpl, (JNIEnv*, jobject, jobject hotspotInstalledCode))
+C2V_VMENTRY(void, invalidateInstalledCode, (JNIEnv*, jobject, jobject hotspotInstalledCode))
   jlong nativeMethod = InstalledCode::address(hotspotInstalledCode);
   nmethod* m = (nmethod*)nativeMethod;
   if (m != NULL && !m->is_not_entrant()) {
@@ -826,7 +826,7 @@
   return JNIHandles::make_local(THREAD, ret);
 C2V_END
 
-C2V_VMENTRY(jlongArray, collectCountersImpl, (JNIEnv*, jobject))
+C2V_VMENTRY(jlongArray, collectCounters, (JNIEnv*, jobject))
   typeArrayOop arrayOop = oopFactory::new_longArray(JVMCICounterSize, CHECK_NULL);
   JavaThread::collect_counters(arrayOop);
   return (jlongArray) JNIHandles::make_local(THREAD, arrayOop);
@@ -867,7 +867,7 @@
   return false;
 }
 
-C2V_VMENTRY(jobject, getNextStackFrameImpl, (JNIEnv*, jobject compilerToVM, jobject hs_frame, jobjectArray methods, jint initialSkip))
+C2V_VMENTRY(jobject, getNextStackFrame, (JNIEnv*, jobject compilerToVM, jobject hs_frame, jobjectArray methods, jint initialSkip))
   ResourceMark rm;
 
   if (!thread->has_last_Java_frame()) return NULL;
@@ -1018,7 +1018,7 @@
   cp_cache_entry->set_method_handle(cp, callInfo);
 C2V_END
 
-C2V_VMENTRY(jboolean, shouldDebugNonSafepointsImpl, (JNIEnv*, jobject))
+C2V_VMENTRY(jboolean, shouldDebugNonSafepoints, (JNIEnv*, jobject))
   //see compute_recording_non_safepoints in debugInfroRec.cpp
   if (JvmtiExport::should_post_compiled_method_load() && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
     return true;
@@ -1127,7 +1127,7 @@
   }
 C2V_END
 
-C2V_VMENTRY(void, writeDebugOutputImpl, (JNIEnv*, jobject, jbyteArray bytes, jint offset, jint length))
+C2V_VMENTRY(void, writeDebugOutput, (JNIEnv*, jobject, jbyteArray bytes, jint offset, jint length))
   while (length > 0) {
     jbyte* start = ((typeArrayOop) JNIHandles::resolve(bytes))->byte_at_addr(offset);
     tty->write((char*) start, MIN2(length, O_BUFLEN));
@@ -1136,7 +1136,7 @@
   }
 C2V_END
 
-C2V_VMENTRY(void, flushDebugOutputImpl, (JNIEnv*, jobject))
+C2V_VMENTRY(void, flushDebugOutput, (JNIEnv*, jobject))
   tty->flush();
 C2V_END
 
@@ -1210,33 +1210,33 @@
   {CC"getVtableIndexForInterfaceMethod",             CC"("HS_RESOLVED_KLASS HS_RESOLVED_METHOD")I",                                    FN_PTR(getVtableIndexForInterfaceMethod)},
   {CC"getClassInitializer",                          CC"("HS_RESOLVED_KLASS")"HS_RESOLVED_METHOD,                                      FN_PTR(getClassInitializer)},
   {CC"hasFinalizableSubclass",                       CC"("HS_RESOLVED_KLASS")Z",                                                       FN_PTR(hasFinalizableSubclass)},
-  {CC"getMaxCallTargetOffsetImpl",                   CC"(J)J",                                                                         FN_PTR(getMaxCallTargetOffsetImpl)},
+  {CC"getMaxCallTargetOffset",                       CC"(J)J",                                                                         FN_PTR(getMaxCallTargetOffset)},
   {CC"getResolvedJavaMethodAtSlot",                  CC"("CLASS"I)"HS_RESOLVED_METHOD,                                                 FN_PTR(getResolvedJavaMethodAtSlot)},
   {CC"getResolvedJavaMethod",                        CC"(Ljava/lang/Object;J)"HS_RESOLVED_METHOD,                                      FN_PTR(getResolvedJavaMethod)},
   {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"installCodeImpl",                              CC"("TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE SPECULATION_LOG")I",      FN_PTR(installCodeImpl)},
-  {CC"notifyCompilationStatisticsImpl",              CC"(I"HS_RESOLVED_METHOD"ZIJJ"INSTALLED_CODE")V",                                 FN_PTR(notifyCompilationStatisticsImpl)},
-  {CC"resetCompilationStatisticsImpl",               CC"()V",                                                                          FN_PTR(resetCompilationStatisticsImpl)},
-  {CC"disassembleCodeBlobImpl",                      CC"(J)"STRING,                                                                    FN_PTR(disassembleCodeBlobImpl)},
+  {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)},
   {CC"executeInstalledCode",                         CC"(["OBJECT INSTALLED_CODE")"OBJECT,                                             FN_PTR(executeInstalledCode)},
   {CC"getLineNumberTable",                           CC"("HS_RESOLVED_METHOD")[J",                                                     FN_PTR(getLineNumberTable)},
   {CC"getLocalVariableTableStart",                   CC"("HS_RESOLVED_METHOD")J",                                                      FN_PTR(getLocalVariableTableStart)},
   {CC"getLocalVariableTableLength",                  CC"("HS_RESOLVED_METHOD")I",                                                      FN_PTR(getLocalVariableTableLength)},
   {CC"reprofile",                                    CC"("HS_RESOLVED_METHOD")V",                                                      FN_PTR(reprofile)},
-  {CC"invalidateInstalledCodeImpl",                  CC"("INSTALLED_CODE")V",                                                          FN_PTR(invalidateInstalledCodeImpl)},
+  {CC"invalidateInstalledCode",                      CC"("INSTALLED_CODE")V",                                                          FN_PTR(invalidateInstalledCode)},
   {CC"readUncompressedOop",                          CC"(J)"OBJECT,                                                                    FN_PTR(readUncompressedOop)},
-  {CC"collectCountersImpl",                          CC"()[J",                                                                         FN_PTR(collectCountersImpl)},
+  {CC"collectCounters",                              CC"()[J",                                                                         FN_PTR(collectCounters)},
   {CC"allocateCompileId",                            CC"("HS_RESOLVED_METHOD"I)I",                                                     FN_PTR(allocateCompileId)},
   {CC"isMature",                                     CC"("METASPACE_METHOD_DATA")Z",                                                   FN_PTR(isMature)},
   {CC"hasCompiledCodeForOSR",                        CC"("HS_RESOLVED_METHOD"II)Z",                                                    FN_PTR(hasCompiledCodeForOSR)},
   {CC"getSymbol",                                    CC"(J)"STRING,                                                                    FN_PTR(getSymbol)},
-  {CC"getNextStackFrameImpl",                        CC"("HS_STACK_FRAME_REF "["RESOLVED_METHOD"I)"HS_STACK_FRAME_REF,                 FN_PTR(getNextStackFrameImpl)},
+  {CC"getNextStackFrame",                            CC"("HS_STACK_FRAME_REF "["RESOLVED_METHOD"I)"HS_STACK_FRAME_REF,                 FN_PTR(getNextStackFrame)},
   {CC"materializeVirtualObjects",                    CC"("HS_STACK_FRAME_REF"Z)V",                                                     FN_PTR(materializeVirtualObjects)},
-  {CC"shouldDebugNonSafepointsImpl",                 CC"()Z",                                                                          FN_PTR(shouldDebugNonSafepointsImpl)},
-  {CC"writeDebugOutputImpl",                         CC"([BII)V",                                                                      FN_PTR(writeDebugOutputImpl)},
-  {CC"flushDebugOutputImpl",                         CC"()V",                                                                          FN_PTR(flushDebugOutputImpl)},
+  {CC"shouldDebugNonSafepoints",                     CC"()Z",                                                                          FN_PTR(shouldDebugNonSafepoints)},
+  {CC"writeDebugOutput",                             CC"([BII)V",                                                                      FN_PTR(writeDebugOutput)},
+  {CC"flushDebugOutput",                             CC"()V",                                                                          FN_PTR(flushDebugOutput)},
   {CC"methodDataProfileDataSize",                    CC"(JI)I",                                                                        FN_PTR(methodDataProfileDataSize)},
 };