Mercurial > hg > truffle
changeset 18921:13e43d2a413e
Initialize frame state builder created for parse time inlining correctly.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 21 Jan 2015 14:29:00 +0100 |
parents | 4af661af76fd |
children | fede93375dcb |
files | graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderConfiguration.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java |
diffstat | 5 files changed, 41 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java Wed Jan 21 13:10:52 2015 +0100 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java Wed Jan 21 14:29:00 2015 +0100 @@ -63,6 +63,9 @@ @Option(help = "Inlines trivial methods during parsing of the bytecodes.", type = OptionType.Expert) public static final StableOptionValue<Boolean> InlineDuringParsing = new StableOptionValue<>(false); + @Option(help = "Maximum depth when inlining during parsing.", type = OptionType.Debug) + public static final StableOptionValue<Integer> InlineDuringParsingMaxDepth = new StableOptionValue<>(10); + @Option(help = "Inlining is explored up to this number of nodes in the graph for each call site.", type = OptionType.Expert) public static final OptionValue<Integer> MaximumInliningSize = new OptionValue<>(300);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java Wed Jan 21 13:10:52 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java Wed Jan 21 14:29:00 2015 +0100 @@ -84,6 +84,7 @@ protected PhaseSuite<HighTierContext> createGraphBuilderSuite() { PhaseSuite<HighTierContext> suite = new PhaseSuite<>(); GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(); + config.setInlineTrivial(true); suite.appendPhase(new GraphBuilderPhase(config)); return suite; }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderConfiguration.java Wed Jan 21 13:10:52 2015 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderConfiguration.java Wed Jan 21 14:29:00 2015 +0100 @@ -36,6 +36,7 @@ private final ResolvedJavaType[] skippedExceptionTypes; private final DebugInfoMode debugInfoMode; private final boolean doLivenessAnalysis; + private boolean inlineTrivial; public static enum DebugInfoMode { SafePointsOnly, @@ -130,4 +131,12 @@ public boolean unresolvedIsError() { return eagerResolving; } + + public boolean shouldInlineTrivial() { + return inlineTrivial; + } + + public void setInlineTrivial(boolean inlineTrivial) { + this.inlineTrivial = inlineTrivial; + } }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Wed Jan 21 13:10:52 2015 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Wed Jan 21 14:29:00 2015 +0100 @@ -717,8 +717,14 @@ } if (GraalOptions.InlineDuringParsing.getValue() && invokeKind.isDirect() && targetMethod.canBeInlined() && targetMethod.hasBytecodes()) { - if (targetMethod.getCode().length <= GraalOptions.TrivialInliningSize.getValue()) { - System.out.println("could inline trivial: " + targetMethod); + if (targetMethod.getCode().length <= GraalOptions.TrivialInliningSize.getValue() && currentDepth < GraalOptions.InlineDuringParsingMaxDepth.getValue() && + graphBuilderConfig.shouldInlineTrivial()) { + BytecodeParser parser = new BytecodeParser(metaAccess, targetMethod, graphBuilderConfig, optimisticOpts, StructuredGraph.INVOCATION_ENTRY_BCI); + HIRFrameStateBuilder startFrameState = new HIRFrameStateBuilder(targetMethod, currentGraph); + System.out.println(args + ", " + args.length + ", " + targetMethod); + startFrameState.initializeFromArgumentsArray(args); + System.out.println("try inline trivial: " + targetMethod); + parser.build(currentDepth + 1, this.lastInstr, startFrameState); } }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java Wed Jan 21 13:10:52 2015 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java Wed Jan 21 14:29:00 2015 +0100 @@ -46,7 +46,7 @@ /** * Creates a new frame state builder for the given method and the given target graph. - * + * * @param method the method whose frame is simulated * @param graph the target graph of Graal nodes created by the builder */ @@ -59,6 +59,25 @@ this.graph = graph; } + public final void initializeFromArgumentsArray(ValueNode[] arguments) { + + int javaIndex = 0; + int index = 0; + if (!method.isStatic()) { + // set the receiver + storeLocal(javaIndex, arguments[index]); + javaIndex = 1; + index = 1; + } + Signature sig = method.getSignature(); + int max = sig.getParameterCount(false); + for (int i = 0; i < max; i++) { + storeLocal(javaIndex, arguments[index]); + javaIndex += arguments[index].getKind().getSlotCount(); + index++; + } + } + public final void initializeForMethodStart(boolean eagerResolve) { int javaIndex = 0;