changeset 18912:9536c47658a2

Introduce new option InlineDuringParsing.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 20 Jan 2015 16:09:23 +0100
parents 91fee1fab96d
children 51680f58e681
files graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Thu Jan 22 11:16:26 2015 +0100
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Tue Jan 20 16:09:23 2015 +0100
@@ -60,6 +60,9 @@
     @Option(help = "Graphs with less than this number of nodes are trivial and therefore always inlined.", type = OptionType.Expert)
     public static final OptionValue<Integer> TrivialInliningSize = new OptionValue<>(10);
 
+    @Option(help = "Inlines trivial methods during parsing of the bytecodes.", type = OptionType.Expert)
+    public static final StableOptionValue<Boolean> InlineDuringParsing = new StableOptionValue<>(false);
+
     @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.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Thu Jan 22 11:16:26 2015 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Tue Jan 20 16:09:23 2015 +0100
@@ -738,6 +738,12 @@
                     }
                 }
 
+                if (GraalOptions.InlineDuringParsing.getValue() && invokeKind.isDirect() && targetMethod.canBeInlined() && targetMethod.hasBytecodes()) {
+                    if (targetMethod.getCode().length <= GraalOptions.TrivialInliningSize.getValue()) {
+                        System.out.println("could inline trivial: " + targetMethod);
+                    }
+                }
+
                 MethodCallTargetNode callTarget = currentGraph.add(createMethodCallTarget(invokeKind, targetMethod, args, returnType));
 
                 // be conservative if information was not recorded (could result in endless
@@ -1210,8 +1216,7 @@
             protected void iterateBytecodesForBlock(BciBlock block) {
                 if (block.isLoopHeader) {
                     // Create the loop header block, which later will merge the backward branches of
-                    // the
-                    // loop.
+                    // the loop.
                     AbstractEndNode preLoopEnd = currentGraph.add(new EndNode());
                     LoopBeginNode loopBegin = currentGraph.add(new LoopBeginNode());
                     lastInstr.setNext(preLoopEnd);