changeset 21622:45dea3e24169

Enable inlining during parsing by default.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 31 May 2015 23:57:57 +0200
parents 993853d22c14
children d2113f5ae550
files graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InlineDuringParsingPlugin.java
diffstat 3 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java	Sun May 31 23:20:24 2015 +0200
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java	Sun May 31 23:57:57 2015 +0200
@@ -77,7 +77,7 @@
         public static final OptionValue<Integer> TraceBytecodeParserLevel = new OptionValue<>(0);
 
         @Option(help = "Inlines trivial methods during bytecode parsing.", type = OptionType.Expert)//
-        public static final StableOptionValue<Boolean> InlineDuringParsing = new StableOptionValue<>(false);
+        public static final StableOptionValue<Boolean> InlineDuringParsing = new StableOptionValue<>(true);
 
         @Option(help = "Inlines intrinsic methods during bytecode parsing.", type = OptionType.Expert)//
         public static final StableOptionValue<Boolean> InlineIntrinsicsDuringParsing = new StableOptionValue<>(true);
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java	Sun May 31 23:20:24 2015 +0200
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java	Sun May 31 23:57:57 2015 +0200
@@ -48,8 +48,8 @@
         return graph;
     }
 
-    private static void raiseException(String s) {
-        throw new RuntimeException(s);
+    private static void raiseExceptionSimple(String s) {
+        throw new RuntimeException("Raising exception with message \"" + s + "\"");
     }
 
     @Test
@@ -67,7 +67,7 @@
     public static String test1Snippet(String message) {
         if (message != null) {
             try {
-                raiseException(message);
+                raiseExceptionSimple(message);
             } catch (Exception e) {
                 return message + e.getMessage();
             }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InlineDuringParsingPlugin.java	Sun May 31 23:20:24 2015 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InlineDuringParsingPlugin.java	Sun May 31 23:57:57 2015 +0200
@@ -33,9 +33,14 @@
 
     @Override
     public InlineInfo shouldInlineInvoke(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args, JavaType returnType) {
-        if (method.hasBytecodes() && !method.isSynchronized() && method.getCode().length <= TrivialInliningSize.getValue() && b.getDepth() < InlineDuringParsingMaxDepth.getValue()) {
+        if (method.hasBytecodes() && method.canBeInlined() && !method.isSynchronized() && checkSize(method, args) && b.getDepth() < InlineDuringParsingMaxDepth.getValue()) {
             return new InlineInfo(method, false);
         }
         return null;
     }
+
+    private static boolean checkSize(ResolvedJavaMethod method, @SuppressWarnings("unused") ValueNode[] args) {
+        int bonus = 1;
+        return method.getCode().length <= TrivialInliningSize.getValue() * bonus;
+    }
 }