# HG changeset patch # User Doug Simon # Date 1394831386 -3600 # Node ID 8c306609eb68fe7233276b9330540f6cc672d4b6 # Parent 12eaf1a47a90a62a83e530ab8a45d49c0154c497 modified HotSpotResolvedJavaMethod.getCompiledCodeSize() to only return Graal compiled code size diff -r 12eaf1a47a90 -r 8c306609eb68 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java --- 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 diff -r 12eaf1a47a90 -r 8c306609eb68 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java --- 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); diff -r 12eaf1a47a90 -r 8c306609eb68 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java --- 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; } /** diff -r 12eaf1a47a90 -r 8c306609eb68 src/share/vm/graal/graalCompilerToVM.cpp --- 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)},