Mercurial > hg > graal-jvmci-8
changeset 18825:bf382ef59838
Avoid using placeholder nodes when emitting explicit exceptions. Introduce StressExplictExceptionCode flag for debugging.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 11 Jan 2015 19:19:52 +0100 |
parents | 53d2d5e8462a |
children | 00ec3ff518ce |
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/stubs/ForeignCallStub.java graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java |
diffstat | 4 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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<Boolean> DeoptALot = new OptionValue<>(false); + @Option(help = "Stressed the code emitting explicit exception throwing code.", type = OptionType.Debug) + public static final StableOptionValue<Boolean> StressExplicitExceptionCode = new StableOptionValue<>(false); + @Option(help = "", type = OptionType.Debug) public static final OptionValue<Boolean> VerifyPhases = new OptionValue<>(false);
--- 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.*;
--- 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; }
--- 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())); }