Mercurial > hg > graal-compiler
changeset 17427:307b26f8b5d1
Truffle: fixed inlining performance regression.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 13 Oct 2014 21:15:03 +0200 |
parents | de120499a936 |
children | 50942f016967 |
files | graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java |
diffstat | 2 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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()) {
--- 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; }