Mercurial > hg > graal-compiler
changeset 14544:8c306609eb68
modified HotSpotResolvedJavaMethod.getCompiledCodeSize() to only return Graal compiled code size
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 14 Mar 2014 22:09:46 +0100 |
parents | 12eaf1a47a90 |
children | 4877b0cb446f |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java src/share/vm/graal/graalCompilerToVM.cpp |
diffstat | 4 files changed, 15 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Fri Mar 14 22:05:50 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Fri Mar 14 22:09:46 2014 +0100 @@ -252,12 +252,12 @@ boolean hasFinalizableSubclass(long metaspaceKlass); /** - * Gets the compiled code size for a method. - * - * @param metaspaceMethod the metaspace Method object to query - * @return the compiled code size the method + * Gets the most recent {@link HotSpotInstalledCode} object associated with a given metaspace + * Method object as a result of + * {@linkplain #installCode(HotSpotCompiledCode, HotSpotInstalledCode, SpeculationLog) + * installing} code for the Method. */ - int getCompiledCodeSize(long metaspaceMethod); + HotSpotInstalledCode getInstalledCode(long metaspaceMethod); /** * Gets the metaspace Method object corresponding to a given {@link Class} object and slot
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Fri Mar 14 22:05:50 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Fri Mar 14 22:09:46 2014 +0100 @@ -111,7 +111,7 @@ public native long getClassInitializer(long metaspaceKlass); @Override - public native int getCompiledCodeSize(long metaspaceMethod); + public native HotSpotInstalledCode getInstalledCode(long metaspaceMethod); @Override public native long getMaxCallTargetOffset(long address);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Fri Mar 14 22:05:50 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Fri Mar 14 22:09:46 2014 +0100 @@ -354,7 +354,11 @@ } public int getCompiledCodeSize() { - return runtime().getCompilerToVM().getCompiledCodeSize(metaspaceMethod); + HotSpotInstalledCode installedCode = runtime().getCompilerToVM().getInstalledCode(metaspaceMethod); + if (installedCode != null) { + return (int) installedCode.getCodeSize(); + } + return 0; } /**
--- a/src/share/vm/graal/graalCompilerToVM.cpp Fri Mar 14 22:05:50 2014 +0100 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Fri Mar 14 22:09:46 2014 +0100 @@ -348,9 +348,9 @@ return CompilerOracle::should_inline(method) || method->force_inline(); C2V_END -C2V_ENTRY(jint, getCompiledCodeSize, (JNIEnv *env, jobject, jlong metaspace_method)) - nmethod* code = (asMethod(metaspace_method))->code(); - return code == NULL ? 0 : code->insts_size(); +C2V_VMENTRY(jobject, getInstalledCode, (JNIEnv *env, jobject, jlong metaspace_method)) + nmethod* nm = (asMethod(metaspace_method))->code(); + return nm == NULL ? NULL : JNIHandles::make_local(THREAD, nm->graal_installed_code()); C2V_END C2V_VMENTRY(jlong, lookupType, (JNIEnv *env, jobject, jstring jname, jclass accessing_class, jboolean resolve)) @@ -814,7 +814,7 @@ {CC"doNotInlineOrCompile", CC"("METASPACE_METHOD")V", FN_PTR(doNotInlineOrCompile)}, {CC"canInlineMethod", CC"("METASPACE_METHOD")Z", FN_PTR(canInlineMethod)}, {CC"shouldInlineMethod", CC"("METASPACE_METHOD")Z", FN_PTR(shouldInlineMethod)}, - {CC"getCompiledCodeSize", CC"("METASPACE_METHOD")I", FN_PTR(getCompiledCodeSize)}, + {CC"getInstalledCode", CC"("METASPACE_METHOD")"HS_INSTALLED_CODE, FN_PTR(getInstalledCode)}, {CC"lookupType", CC"("STRING CLASS"Z)"METASPACE_KLASS, FN_PTR(lookupType)}, {CC"resolveConstantInPool", CC"("METASPACE_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolveConstantInPool)}, {CC"resolvePossiblyCachedConstantInPool", CC"("METASPACE_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolvePossiblyCachedConstantInPool)},