# HG changeset patch # User Christian Humer # Date 1413227703 -7200 # Node ID 307b26f8b5d1c06c9165c9a004c55dc664024761 # Parent de120499a936383d7a76216e96c67491d862bf4a Truffle: fixed inlining performance regression. diff -r de120499a936 -r 307b26f8b5d1 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Mon Oct 13 21:15:03 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Mon Oct 13 21:15:03 2014 +0200 @@ -218,14 +218,19 @@ // We come here from compiled code (i.e., we have been inlined). } - Object[] args1 = args; + return callRoot(args); + } + + public final Object callRoot(Object[] originalArguments) { + Object[] args = originalArguments; if (this.profiledArgumentTypesAssumption != null && CompilerDirectives.inCompiledCode() && profiledArgumentTypesAssumption.isValid()) { - args1 = CompilerDirectives.unsafeCast(castArrayFixedLength(args1, profiledArgumentTypes.length), Object[].class, true, true); + args = CompilerDirectives.unsafeCast(castArrayFixedLength(args, profiledArgumentTypes.length), Object[].class, true, true); if (TruffleArgumentTypeSpeculation.getValue()) { - args1 = castArguments(args1); + args = castArguments(args); } } - VirtualFrame frame = createFrame(getRootNode().getFrameDescriptor(), args1); + + VirtualFrame frame = createFrame(getRootNode().getFrameDescriptor(), args); Object result = callProxy(frame); // Profile call return type @@ -233,7 +238,7 @@ if (TruffleReturnTypeSpeculation.getValue()) { CompilerDirectives.transferToInterpreterAndInvalidate(); profiledReturnType = (result == null ? null : result.getClass()); - profiledReturnTypeAssumption = runtime.createAssumption("Profiled Return Type"); + profiledReturnTypeAssumption = Truffle.getRuntime().createAssumption("Profiled Return Type"); } } else if (profiledReturnType != null) { if (result == null || profiledReturnType != result.getClass()) { diff -r de120499a936 -r 307b26f8b5d1 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java Mon Oct 13 21:15:03 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java Mon Oct 13 21:15:03 2014 +0200 @@ -68,7 +68,7 @@ private final ResolvedJavaType errorClass; private final ResolvedJavaType controlFlowExceptionClass; - private final ResolvedJavaMethod callBoundaryMethod; + private final ResolvedJavaMethod callRootMethod; private final ResolvedJavaMethod callInlinedMethod; private long counter; @@ -85,7 +85,7 @@ this.controlFlowExceptionClass = providers.getMetaAccess().lookupJavaType(ControlFlowException.class); try { - callBoundaryMethod = providers.getMetaAccess().lookupJavaMethod(OptimizedCallTarget.class.getDeclaredMethod("callBoundary", Object[].class)); + callRootMethod = providers.getMetaAccess().lookupJavaMethod(OptimizedCallTarget.class.getDeclaredMethod("callRoot", Object[].class)); } catch (NoSuchMethodException ex) { throw new RuntimeException(ex); } @@ -99,7 +99,7 @@ } public StructuredGraph createRootGraph(String name) { - StructuredGraph graph = new StructuredGraph(name, callBoundaryMethod); + StructuredGraph graph = new StructuredGraph(name, callRootMethod); new GraphBuilderPhase.Instance(providers.getMetaAccess(), configForRoot, TruffleCompilerImpl.Optimizations).apply(graph); return graph; }