# HG changeset patch # User Thomas Wuerthinger # Date 1309451953 -7200 # Node ID 573c8e2917abc595031e4118e77df392c72c8e4c # Parent 33f0052372c6bf0b27653b2fd2381b4777067d67 must not gvn checkcast instructions. diff -r 33f0052372c6 -r 573c8e2917ab graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CheckCast.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CheckCast.java Thu Jun 30 18:03:43 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/CheckCast.java Thu Jun 30 18:39:13 2011 +0200 @@ -70,15 +70,15 @@ v.visitCheckCast(this); } - @Override - public int valueNumber() { - return targetClass().isResolved() ? Util.hash1(Bytecodes.CHECKCAST, object()) : 0; - } - - @Override - public boolean valueEqual(Node i) { - return i instanceof CheckCast; - } +// @Override +// public int valueNumber() { +// return targetClass().isResolved() ? Util.hash1(Bytecodes.CHECKCAST, object()) : 0; +// } +// +// @Override +// public boolean valueEqual(Node i) { +// return i instanceof CheckCast; +// } @Override public void print(LogStream out) { diff -r 33f0052372c6 -r 573c8e2917ab graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FixedGuard.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FixedGuard.java Thu Jun 30 18:03:43 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FixedGuard.java Thu Jun 30 18:39:13 2011 +0200 @@ -47,8 +47,9 @@ inputs().set(super.inputCount() + INPUT_NODE, n); } - public FixedGuard(Graph graph) { + public FixedGuard(BooleanNode node, Graph graph) { super(CiKind.Illegal, INPUT_COUNT, SUCCESSOR_COUNT, graph); + setNode(node); } @Override @@ -63,7 +64,7 @@ @Override public Node copy(Graph into) { - return new FixedGuard(into); + return new FixedGuard(null, into); } @SuppressWarnings("unchecked") diff -r 33f0052372c6 -r 573c8e2917ab graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Thu Jun 30 18:03:43 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Thu Jun 30 18:39:13 2011 +0200 @@ -720,8 +720,7 @@ private void genThrow(int bci) { Value exception = frameState.apop(); - FixedGuard node = new FixedGuard(graph); - node.setNode(new IsNonNull(exception, graph)); + FixedGuard node = new FixedGuard(new IsNonNull(exception, graph), graph); append(node); FixedNode entry = handleException(exception, bci); @@ -741,7 +740,9 @@ Constant typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, isInitialized, cpi); Value object = frameState.apop(); if (typeInstruction != null) { - frameState.apush(append(new CheckCast(typeInstruction, object, graph))); +// append(new FixedGuard(new InstanceOf(typeInstruction, object, graph), graph)); +// frameState.apush(object); + frameState.apush(new CheckCast(typeInstruction, object, graph)); } else { frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); } @@ -1141,9 +1142,8 @@ if (ifNode.falseSuccessor() == prev) { FixedNode successor = ifNode.trueSuccessor(); BooleanNode condition = ifNode.compare(); - FixedGuard fixedGuard = new FixedGuard(graph); + FixedGuard fixedGuard = new FixedGuard(condition, graph); fixedGuard.setNext(successor); - fixedGuard.setNode(condition); ifNode.replaceAndDelete(fixedGuard); lastInstr = null; return fixed; diff -r 33f0052372c6 -r 573c8e2917ab graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Thu Jun 30 18:03:43 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Thu Jun 30 18:39:13 2011 +0200 @@ -97,8 +97,7 @@ concrete = profile.types[0].resolveMethodImpl(invoke.target); if (concrete != null && checkTargetConditions(concrete, iterations) && checkSizeConditions(concrete, invoke, profile, ratio)) { IsType isType = new IsType(invoke.receiver(), profile.types[0], compilation.graph); - FixedGuard guard = new FixedGuard(graph); - guard.setNode(isType); + FixedGuard guard = new FixedGuard(isType, graph); assert invoke.predecessors().size() == 1; invoke.predecessors().get(0).successors().replace(invoke, guard); guard.setNext(invoke); @@ -346,8 +345,7 @@ assert invoke.predecessors().size() == 1 : "size: " + invoke.predecessors().size(); FixedNodeWithNext pred; if (withReceiver) { - FixedGuard clipNode = new FixedGuard(compilation.graph); - clipNode.setNode(new IsNonNull(parameters[0], compilation.graph)); + FixedGuard clipNode = new FixedGuard(new IsNonNull(parameters[0], compilation.graph), compilation.graph); pred = clipNode; } else { pred = new Placeholder(compilation.graph); diff -r 33f0052372c6 -r 573c8e2917ab graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java Thu Jun 30 18:03:43 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java Thu Jun 30 18:39:13 2011 +0200 @@ -2110,6 +2110,10 @@ default: throw Util.shouldNotReachHere(); } + if (code == 0) TTY.println("deopt stub with code=" + code); + if (code == 0) { + throw new RuntimeException(); + } masm.movq(rscratch1, code); directCall(CiRuntimeCall.Deoptimize, stub.info); shouldNotReachHere();