# HG changeset patch # User Thomas Wuerthinger # Date 1421000392 -3600 # Node ID bf382ef598384e93e8038b3b0af11fe939aa41d4 # Parent 53d2d5e8462a8bdaca31011df557f84bc7a6fbe0 Avoid using placeholder nodes when emitting explicit exceptions. Introduce StressExplictExceptionCode flag for debugging. diff -r 53d2d5e8462a -r bf382ef59838 graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java --- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java Sun Jan 11 18:34:08 2015 +0100 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java Sun Jan 11 19:19:52 2015 +0100 @@ -140,6 +140,9 @@ @Option(help = "", type = OptionType.Debug) public static final OptionValue DeoptALot = new OptionValue<>(false); + @Option(help = "Stressed the code emitting explicit exception throwing code.", type = OptionType.Debug) + public static final StableOptionValue StressExplicitExceptionCode = new StableOptionValue<>(false); + @Option(help = "", type = OptionType.Debug) public static final OptionValue VerifyPhases = new OptionValue<>(false); diff -r 53d2d5e8462a -r bf382ef59838 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Sun Jan 11 18:34:08 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Sun Jan 11 19:19:52 2015 +0100 @@ -25,6 +25,7 @@ import static com.oracle.graal.api.code.CallingConvention.Type.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*; +import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.api.replacements.*; import com.oracle.graal.compiler.common.type.*; diff -r 53d2d5e8462a -r bf382ef59838 graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java Sun Jan 11 18:34:08 2015 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java Sun Jan 11 19:19:52 2015 +0100 @@ -716,7 +716,8 @@ protected void emitExplicitExceptions(T receiver, T outOfBoundsIndex) { assert receiver != null; - if (graphBuilderConfig.omitAllExceptionEdges() || (optimisticOpts.useExceptionProbabilityForOperations() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE)) { + if (graphBuilderConfig.omitAllExceptionEdges() || + (optimisticOpts.useExceptionProbabilityForOperations() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE && !GraalOptions.StressExplicitExceptionCode.getValue())) { return; } diff -r 53d2d5e8462a -r bf382ef59838 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Sun Jan 11 18:34:08 2015 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Sun Jan 11 19:19:52 2015 +0100 @@ -328,7 +328,7 @@ @Override protected void handleUnresolvedInstanceOf(JavaType type, ValueNode object) { assert !graphBuilderConfig.eagerResolving(); - BlockPlaceholderNode successor = currentGraph.add(BlockPlaceholderNode.create(this)); + BeginNode successor = currentGraph.add(BeginNode.create()); DeoptimizeNode deopt = currentGraph.add(DeoptimizeNode.create(InvalidateRecompile, Unresolved)); append(IfNode.create(currentGraph.unique(IsNullNode.create(object)), successor, deopt, 1)); lastInstr = successor; @@ -637,27 +637,23 @@ if (StampTool.isPointerNonNull(receiver.stamp())) { return; } - BlockPlaceholderNode trueSucc = currentGraph.add(BlockPlaceholderNode.create(this)); - BlockPlaceholderNode falseSucc = currentGraph.add(BlockPlaceholderNode.create(this)); - append(IfNode.create(currentGraph.unique(IsNullNode.create(receiver)), trueSucc, falseSucc, 0.01)); + BytecodeExceptionNode exception = currentGraph.add(BytecodeExceptionNode.create(metaAccess, NullPointerException.class)); + BeginNode falseSucc = currentGraph.add(BeginNode.create()); + append(IfNode.create(currentGraph.unique(IsNullNode.create(receiver)), exception, falseSucc, 0.01)); lastInstr = falseSucc; - BytecodeExceptionNode exception = currentGraph.add(BytecodeExceptionNode.create(metaAccess, NullPointerException.class)); exception.setStateAfter(frameState.create(bci())); - trueSucc.setNext(exception); exception.setNext(handleException(exception, bci())); } @Override protected void emitBoundsCheck(ValueNode index, ValueNode length) { - BlockPlaceholderNode trueSucc = currentGraph.add(BlockPlaceholderNode.create(this)); - BlockPlaceholderNode falseSucc = currentGraph.add(BlockPlaceholderNode.create(this)); - append(IfNode.create(currentGraph.unique(IntegerBelowNode.create(index, length)), trueSucc, falseSucc, 0.99)); + BeginNode trueSucc = currentGraph.add(BeginNode.create()); + BytecodeExceptionNode exception = currentGraph.add(BytecodeExceptionNode.create(metaAccess, ArrayIndexOutOfBoundsException.class, index)); + append(IfNode.create(currentGraph.unique(IntegerBelowNode.create(index, length)), trueSucc, exception, 0.99)); lastInstr = trueSucc; - BytecodeExceptionNode exception = currentGraph.add(BytecodeExceptionNode.create(metaAccess, ArrayIndexOutOfBoundsException.class, index)); exception.setStateAfter(frameState.create(bci())); - falseSucc.setNext(exception); exception.setNext(handleException(exception, bci())); }