Mercurial > hg > graal-compiler
changeset 22705:89520cbb9633
Merge
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Fri, 25 Sep 2015 15:07:22 -0700 |
parents | a610e5da2e28 (current diff) 78293834a24b (diff) |
children | 8c20b80554d3 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRPhase.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/BasePhase.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java |
diffstat | 6 files changed, 42 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java Thu Sep 24 14:24:07 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java Fri Sep 25 15:07:22 2015 -0700 @@ -124,7 +124,7 @@ registerStableOptionPlugins(invocationPlugins, snippetReflection); registerAESPlugins(invocationPlugins, config); registerCRC32Plugins(invocationPlugins, config); - StandardGraphBuilderPlugins.registerInvocationPlugins(metaAccess, invocationPlugins); + StandardGraphBuilderPlugins.registerInvocationPlugins(metaAccess, invocationPlugins, true); return plugins; }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRPhase.java Thu Sep 24 14:24:07 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRPhase.java Fri Sep 25 15:07:22 2015 -0700 @@ -90,17 +90,13 @@ } }; - @SuppressWarnings("all") - private static boolean assertionsEnabled() { - boolean enabled = false; - assert enabled = true; - return enabled; + /** Lazy initialization to create pattern only when assertions are enabled. */ + static class NamePatternHolder { + static final Pattern NAME_PATTERN = Pattern.compile("[A-Z][A-Za-z0-9]+"); } - private static final Pattern NAME_PATTERN = assertionsEnabled() ? Pattern.compile("[A-Z][A-Za-z0-9]+") : null; - private static boolean checkName(String name) { - assert name == null || NAME_PATTERN.matcher(name).matches() : "illegal phase name: " + name; + assert name == null || NamePatternHolder.NAME_PATTERN.matcher(name).matches() : "illegal phase name: " + name; return true; }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/BasePhase.java Thu Sep 24 14:24:07 2015 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/BasePhase.java Fri Sep 25 15:07:22 2015 -0700 @@ -67,17 +67,13 @@ */ private final DebugMemUseTracker memUseTracker; - @SuppressWarnings("all") - private static boolean assertionsEnabled() { - boolean enabled = false; - assert enabled = true; - return enabled; + /** Lazy initialization to create pattern only when assertions are enabled. */ + static class NamePatternHolder { + static final Pattern NAME_PATTERN = Pattern.compile("[A-Z][A-Za-z0-9]+"); } - private static final Pattern NAME_PATTERN = assertionsEnabled() ? Pattern.compile("[A-Z][A-Za-z0-9]+") : null; - private static boolean checkName(String name) { - assert NAME_PATTERN.matcher(name).matches() : "illegal phase name: " + name; + assert NamePatternHolder.NAME_PATTERN.matcher(name).matches() : "illegal phase name: " + name; return true; }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java Thu Sep 24 14:24:07 2015 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java Fri Sep 25 15:07:22 2015 -0700 @@ -118,10 +118,10 @@ } // @formatter:on - public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins, boolean allowDeoptimization) { registerObjectPlugins(plugins); registerClassPlugins(plugins); - registerMathPlugins(plugins); + registerMathPlugins(plugins, allowDeoptimization); registerUnsignedMathPlugins(plugins); registerCharacterPlugins(plugins); registerShortPlugins(plugins); @@ -332,28 +332,30 @@ }); } - private static void registerMathPlugins(InvocationPlugins plugins) { + private static void registerMathPlugins(InvocationPlugins plugins, boolean allowDeoptimization) { Registration r = new Registration(plugins, Math.class); - for (JavaKind kind : new JavaKind[]{JavaKind.Int, JavaKind.Long}) { - Class<?> type = kind.toJavaClass(); - r.register2("addExact", type, type, new InvocationPlugin() { - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) { - b.addPush(kind, new IntegerAddExactNode(x, y)); - return true; - } - }); - r.register2("subtractExact", type, type, new InvocationPlugin() { - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) { - b.addPush(kind, new IntegerSubExactNode(x, y)); - return true; - } - }); - r.register2("multiplyExact", type, type, new InvocationPlugin() { - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) { - b.addPush(kind, new IntegerMulExactNode(x, y)); - return true; - } - }); + if (allowDeoptimization) { + for (JavaKind kind : new JavaKind[]{JavaKind.Int, JavaKind.Long}) { + Class<?> type = kind.toJavaClass(); + r.register2("addExact", type, type, new InvocationPlugin() { + public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) { + b.addPush(kind, new IntegerAddExactNode(x, y)); + return true; + } + }); + r.register2("subtractExact", type, type, new InvocationPlugin() { + public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) { + b.addPush(kind, new IntegerSubExactNode(x, y)); + return true; + } + }); + r.register2("multiplyExact", type, type, new InvocationPlugin() { + public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) { + b.addPush(kind, new IntegerMulExactNode(x, y)); + return true; + } + }); + } } r.register1("abs", Float.TYPE, new InvocationPlugin() { public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Thu Sep 24 14:24:07 2015 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Fri Sep 25 15:07:22 2015 -0700 @@ -26,6 +26,7 @@ import static com.oracle.graal.truffle.TruffleCompilerOptions.TruffleBackgroundCompilation; import static com.oracle.graal.truffle.TruffleCompilerOptions.TruffleCallTargetProfiling; import static com.oracle.graal.truffle.TruffleCompilerOptions.TruffleCompilationExceptionsAreFatal; +import static com.oracle.graal.truffle.TruffleCompilerOptions.TruffleCompilationExceptionsArePrinted; import static com.oracle.graal.truffle.TruffleCompilerOptions.TruffleCompilationExceptionsAreThrown; import static com.oracle.graal.truffle.TruffleCompilerOptions.TruffleReturnTypeSpeculation; @@ -385,9 +386,11 @@ if (TruffleCompilationExceptionsAreThrown.getValue()) { throw new OptimizationFailedException(t, this); } - if (TruffleCompilationExceptionsAreFatal.getValue()) { + if (TruffleCompilationExceptionsArePrinted.getValue() || TruffleCompilationExceptionsAreFatal.getValue()) { printException(t); - System.exit(-1); + if (TruffleCompilationExceptionsAreFatal.getValue()) { + System.exit(-1); + } } } }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java Thu Sep 24 14:24:07 2015 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java Fri Sep 25 15:07:22 2015 -0700 @@ -147,6 +147,9 @@ @Option(help = "Treat compilation exceptions as fatal exceptions that will exit the application", type = OptionType.Debug) public static final OptionValue<Boolean> TruffleCompilationExceptionsAreFatal = new OptionValue<>(false); + @Option(help = "Prints the exception stack trace for compilation exceptions", type = OptionType.Debug) + public static final OptionValue<Boolean> TruffleCompilationExceptionsArePrinted = new OptionValue<>(false); + @Option(help = "Treat compilation exceptions as thrown runtime exceptions", type = OptionType.Debug) public static final OptionValue<Boolean> TruffleCompilationExceptionsAreThrown = new OptionValue<>(false);