# HG changeset patch # User Matthias Grimmer # Date 1382525286 -7200 # Node ID 9b1cc262896106bb69cd8f2193d74003b62d3cc5 # Parent 7d5c3ffbee6485bf7c553c5c9e11bf644ffa9cd3 Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods diff -r 7d5c3ffbee64 -r 9b1cc2628961 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 Wed Oct 23 12:46:58 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Wed Oct 23 12:48:06 2013 +0200 @@ -218,6 +218,8 @@ long readUnsafeKlassPointer(Object o); + void dontInline(long metaspaceMethod, HotSpotResolvedJavaMethod method); + /** * Invalidates the profiling information and restarts profiling upon the next invocation. * diff -r 7d5c3ffbee64 -r 9b1cc2628961 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 Wed Oct 23 12:46:58 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Wed Oct 23 12:48:06 2013 +0200 @@ -178,6 +178,9 @@ public native long readUnsafeKlassPointer(Object o); @Override + public native void dontInline(long metaspaceMethod, HotSpotResolvedJavaMethod method); + + @Override public Object executeCompiledMethod(Object arg1, Object arg2, Object arg3, HotSpotInstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException { return executeCompiledMethodIntrinsic(arg1, arg2, arg3, hotspotInstalledCode); } diff -r 7d5c3ffbee64 -r 9b1cc2628961 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 Wed Oct 23 12:46:58 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Wed Oct 23 12:48:06 2013 +0200 @@ -190,6 +190,14 @@ } /** + * Manually adds a DontInline annotation to this method. + */ + public void setDontInline() { + dontInline = true; + runtime().getCompilerToVM().dontInline(metaspaceMethod, this); + } + + /** * Returns true if this method is one of the special methods that is ignored by security stack * walks. * diff -r 7d5c3ffbee64 -r 9b1cc2628961 graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64HotSpotTruffleBackend.java --- a/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64HotSpotTruffleBackend.java Wed Oct 23 12:46:58 2013 +0200 +++ b/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64HotSpotTruffleBackend.java Wed Oct 23 12:48:06 2013 +0200 @@ -46,7 +46,7 @@ */ class AMD64HotSpotTruffleBackend extends AMD64HotSpotBackend { - private ResolvedJavaMethod optimizedCallTargetCall; + private HotSpotResolvedJavaMethod optimizedCallTargetCall; public AMD64HotSpotTruffleBackend(HotSpotGraalRuntime runtime, HotSpotProviders providers) { super(runtime, providers); @@ -55,7 +55,9 @@ private ResolvedJavaMethod getInstrumentedMethod() throws GraalInternalError { if (optimizedCallTargetCall == null) { try { - optimizedCallTargetCall = getProviders().getMetaAccess().lookupJavaMethod(OptimizedCallTarget.class.getDeclaredMethod("call", PackedFrame.class, Arguments.class)); + optimizedCallTargetCall = (HotSpotResolvedJavaMethod) getProviders().getMetaAccess().lookupJavaMethod( + OptimizedCallTarget.class.getDeclaredMethod("call", PackedFrame.class, Arguments.class)); + optimizedCallTargetCall.setDontInline(); } catch (NoSuchMethodException | SecurityException e) { throw new GraalInternalError(e); } @@ -89,7 +91,6 @@ AMD64Address verifiedEntryPointAddress = new AMD64Address(spillRegister, config.nmethodEntryOffset); asm.movq(spillRegister, verifiedEntryPointAddress); - asm.jmp(spillRegister); asm.bind(doProlog); diff -r 7d5c3ffbee64 -r 9b1cc2628961 src/share/vm/graal/graalCompilerToVM.cpp --- a/src/share/vm/graal/graalCompilerToVM.cpp Wed Oct 23 12:46:58 2013 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Wed Oct 23 12:48:06 2013 +0200 @@ -642,6 +642,13 @@ return id; } +C2V_VMENTRY(void, dontInline,(JNIEnv *, jobject, jlong metaspace_method, jobject hotspot_method)) + methodHandle method = asMethod(metaspace_method); + method->set_not_c1_compilable(); + method->set_not_c2_compilable(); + method->set_dont_inline(true); +C2V_END + C2V_ENTRY(void, initializeConfiguration, (JNIEnv *env, jobject, jobject config)) #define set_boolean(name, value) do { env->SetBooleanField(config, getFieldID(env, config, name, "Z"), value); } while (0) @@ -1196,6 +1203,7 @@ {CC"getUniqueImplementor", CC"("HS_RESOLVED_TYPE")"RESOLVED_TYPE, FN_PTR(getUniqueImplementor)}, {CC"getStackTraceElement", CC"("METASPACE_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(getStackTraceElement)}, {CC"initializeMethod", CC"("METASPACE_METHOD HS_RESOLVED_METHOD")V", FN_PTR(initializeMethod)}, + {CC"dontInline", CC"("METASPACE_METHOD HS_RESOLVED_METHOD")V", FN_PTR(dontInline)}, {CC"initializeMethodData", CC"("METASPACE_METHOD_DATA METHOD_DATA")V", FN_PTR(initializeMethodData)}, {CC"isMethodCompilable", CC"("METASPACE_METHOD")Z", FN_PTR(isMethodCompilable)}, {CC"getCompiledCodeSize", CC"("METASPACE_METHOD")I", FN_PTR(getCompiledCodeSize)},