# HG changeset patch # User Thomas Wuerthinger # Date 1379277189 -7200 # Node ID f091e0d6f4f399a6342f3104b92a4abc304a57e3 # Parent 44d5989ae7451a82d21c4d3da860048f6a0bfa73 Disallow add for global value numberable node types. Introduce addWithoutUnique. diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Sun Sep 15 22:33:09 2013 +0200 @@ -222,6 +222,24 @@ * @return the node which was added to the graph */ public T add(T node) { + if (node.getNodeClass().valueNumberable()) { + throw new IllegalStateException("Using add for value numberable node. Consider using either unique or addWithoutUnique."); + } + return addHelper(node); + } + + public T addWithoutUnique(T node) { + return addHelper(node); + } + + public T addOrUnique(T node) { + if (node.getNodeClass().valueNumberable()) { + return uniqueHelper(node); + } + return add(node); + } + + private T addHelper(T node) { node.initialize(this); return node; } @@ -260,9 +278,13 @@ * @return the node which was added to the graph or a similar which was already in the * graph. */ - @SuppressWarnings("unchecked") public T unique(T node) { assert checkValueNumberable(node); + return uniqueHelper(node); + } + + @SuppressWarnings("unchecked") + private T uniqueHelper(T node) { for (Node input : node.inputs()) { if (input != null) { @@ -271,14 +293,14 @@ return (T) usage; } } - return add(node); + return addHelper(node); } } Node cachedNode = cachedNodes.get(new CacheEntry(node)); if (cachedNode != null && cachedNode.isAlive()) { return (T) cachedNode; } else { - Node result = add(node); + Node result = addHelper(node); cachedNodes.put(new CacheEntry(node), result); return (T) result; } diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sun Sep 15 22:33:09 2013 +0200 @@ -616,7 +616,7 @@ value = checkcast; } } else { - LoadHubNode arrayClass = graph.add(new LoadHubNode(array, wordKind, boundsCheck.asNode())); + LoadHubNode arrayClass = graph.unique(new LoadHubNode(array, wordKind, boundsCheck.asNode())); LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, config.arrayClassElementOffset, graph); /* * Anchor the read of the element klass to the cfg, because it is only valid @@ -870,7 +870,7 @@ private FloatingReadNode createReadHub(StructuredGraph graph, Kind wordKind, ValueNode object, GuardingNode guard) { LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, config.hubOffset, graph); assert !object.isConstant() || object.asConstant().isNull(); - return graph.add(new FloatingReadNode(object, location, null, StampFactory.forKind(wordKind()), guard, BarrierType.NONE, useCompressedKlassPointers())); + return graph.unique(new FloatingReadNode(object, location, null, StampFactory.forKind(wordKind()), guard, BarrierType.NONE, useCompressedKlassPointers())); } private WriteNode createWriteHub(StructuredGraph graph, Kind wordKind, ValueNode object, ValueNode value) { diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java Sun Sep 15 22:33:09 2013 +0200 @@ -195,7 +195,7 @@ return null; } - PhiNode phi = graph.add(new PhiNode(currentValue.kind(), block)); + PhiNode phi = graph.addWithoutUnique(new PhiNode(currentValue.kind(), block)); for (int i = 0; i < block.phiPredecessorCount(); i++) { phi.addInput(currentValue); } @@ -293,7 +293,7 @@ } assert !block.isPhiAtMerge(value) : "phi function for this block already created"; - PhiNode phi = graph.add(new PhiNode(value.kind(), block)); + PhiNode phi = graph.addWithoutUnique(new PhiNode(value.kind(), block)); phi.addInput(value); return phi; } diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Sun Sep 15 22:33:09 2013 +0200 @@ -295,7 +295,7 @@ final ValueNode replaceWith; ProxyNode newVpn = getDuplicatedNode(vpn); if (newVpn != null) { - PhiNode phi = graph.add(vpn.type() == PhiType.Value ? new PhiNode(vpn.kind(), merge) : new PhiNode(vpn.type(), merge, vpn.getIdentity())); + PhiNode phi = graph.addWithoutUnique(vpn.type() == PhiType.Value ? new PhiNode(vpn.kind(), merge) : new PhiNode(vpn.type(), merge, vpn.getIdentity())); phi.addInput(vpn); phi.addInput(newVpn); replaceWith = phi; diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java Sun Sep 15 22:33:09 2013 +0200 @@ -160,7 +160,7 @@ } // create a new phi (we don't patch the old one since some usages of the old one may // still be valid) - PhiNode newPhi = graph.add(phi.type() == PhiType.Value ? new PhiNode(phi.kind(), loopBegin) : new PhiNode(phi.type(), loopBegin, phi.getIdentity())); + PhiNode newPhi = graph.addWithoutUnique(phi.type() == PhiType.Value ? new PhiNode(phi.kind(), loopBegin) : new PhiNode(phi.type(), loopBegin, phi.getIdentity())); newPhi.addInput(first); for (LoopEndNode end : loopBegin.orderedLoopEnds()) { newPhi.addInput(phi.valueAt(end)); @@ -250,7 +250,7 @@ } for (final PhiNode phi : loopBegin.phis().snapshot()) { - final PhiNode firstPhi = graph.add(phi.type() == PhiType.Value ? new PhiNode(phi.kind(), newExitMerge) : new PhiNode(phi.type(), newExitMerge, phi.getIdentity())); + final PhiNode firstPhi = graph.addWithoutUnique(phi.type() == PhiType.Value ? new PhiNode(phi.kind(), newExitMerge) : new PhiNode(phi.type(), newExitMerge, phi.getIdentity())); for (AbstractEndNode end : newExitMerge.forwardEnds()) { LoopEndNode loopEnd = reverseEnds.get(end); ValueNode prim = prim(phi.valueAt(loopEnd)); diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Sun Sep 15 22:33:09 2013 +0200 @@ -81,7 +81,7 @@ throw new GraalInternalError("Cannot create guards in after-guard lowering"); } FixedGuardNode guard = graph().add(new FixedGuardNode(condition, reason, action, negated)); - PiNode pi = graph().add(new PiNode(object, stamp(), guard)); + PiNode pi = graph().unique(new PiNode(object, stamp(), guard)); replaceAtUsages(pi); graph().replaceFixedWithFixed(this, guard); } diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Sun Sep 15 22:33:09 2013 +0200 @@ -578,7 +578,7 @@ // removed MergeNode newMerge = graph().add(new MergeNode()); PhiNode oldPhi = (PhiNode) oldMerge.usages().first(); - PhiNode newPhi = graph().add(new PhiNode(oldPhi.stamp(), newMerge)); + PhiNode newPhi = graph().addWithoutUnique(new PhiNode(oldPhi.stamp(), newMerge)); for (AbstractEndNode end : ends) { newPhi.addInput(phiValues.get(end)); diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Sun Sep 15 22:33:09 2013 +0200 @@ -52,7 +52,7 @@ // Only null profiling is not beneficial enough to keep the node around. return object; } - return object.graph().add(new TypeProfileProxyNode(object, profile)); + return object.graph().addWithoutUnique(new TypeProfileProxyNode(object, profile)); } private TypeProfileProxyNode(ValueNode object, JavaTypeProfile profile) { diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java Sun Sep 15 22:33:09 2013 +0200 @@ -116,7 +116,7 @@ } private ConditionalNode(ValueNode type, ValueNode object) { - this(type.graph().add(new InstanceOfDynamicNode(type, object))); + this(type.graph().unique(new InstanceOfDynamicNode(type, object))); } @NodeIntrinsic diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Sun Sep 15 22:33:09 2013 +0200 @@ -97,7 +97,7 @@ */ @Override public void lower(LoweringTool tool) { - InstanceOfNode typeTest = graph().add(new InstanceOfNode(type, object, profile)); + InstanceOfNode typeTest = graph().addWithoutUnique(new InstanceOfNode(type, object, profile)); Stamp stamp = StampFactory.declared(type); if (stamp() instanceof ObjectStamp && object().stamp() instanceof ObjectStamp) { stamp = ((ObjectStamp) object().stamp()).castTo((ObjectStamp) stamp); diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Sun Sep 15 22:33:09 2013 +0200 @@ -100,7 +100,7 @@ } constants[i] = constantValue; } - PhiNode newPhi = graph().add(new PhiNode(stamp(), phi.merge())); + PhiNode newPhi = graph().addWithoutUnique(new PhiNode(stamp(), phi.merge())); for (int i = 0; i < phi.valueCount(); i++) { newPhi.addInput(ConstantNode.forConstant(constants[i], runtime, graph())); } diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/EliminatePartiallyRedundantGuardsPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/EliminatePartiallyRedundantGuardsPhase.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/EliminatePartiallyRedundantGuardsPhase.java Sun Sep 15 22:33:09 2013 +0200 @@ -133,7 +133,7 @@ } Graph graph = merge.graph(); for (GuardNode guard : hits) { - PhiNode phi = graph.add(new PhiNode(PhiType.Guard, merge, null)); + PhiNode phi = graph.addWithoutUnique(new PhiNode(PhiType.Guard, merge, null)); for (AbstractEndNode otherEnd : merge.forwardEnds()) { phi.addInput(graph.unique(new GuardNode(guard.condition(), AbstractBeginNode.prevBegin(otherEnd), guard.reason(), guard.action(), guard.negated()))); } diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java Sun Sep 15 22:33:09 2013 +0200 @@ -213,7 +213,7 @@ } else if (merged == null) { merged = last; } else { - PhiNode phi = merge.graph().add(new PhiNode(PhiType.Memory, merge, key)); + PhiNode phi = merge.graph().addWithoutUnique(new PhiNode(PhiType.Memory, merge, key)); for (int j = 0; j < mergedStatesCount; j++) { phi.addInput(merged); } @@ -257,7 +257,7 @@ Map phis = new HashMap<>(); for (LocationIdentity location : modifiedLocations) { - PhiNode phi = loop.graph().add(new PhiNode(PhiType.Memory, loop, location)); + PhiNode phi = loop.graph().addWithoutUnique(new PhiNode(PhiType.Memory, loop, location)); phi.addInput(initialState.getLastLocationAccess(location)); phis.put(location, phi); initialState.lastMemorySnapshot.put(location, phi); diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Sun Sep 15 22:33:09 2013 +0200 @@ -478,7 +478,7 @@ private void createGuard(StructuredGraph graph, MetaAccessProvider runtime) { ValueNode nonNullReceiver = InliningUtil.nonNullReceiver(invoke); ConstantNode typeHub = ConstantNode.forConstant(type.getEncoding(Representation.ObjectHub), runtime, graph); - LoadHubNode receiverHub = graph.add(new LoadHubNode(nonNullReceiver, typeHub.kind(), null)); + LoadHubNode receiverHub = graph.unique(new LoadHubNode(nonNullReceiver, typeHub.kind(), null)); CompareNode typeCheck = CompareNode.createCompareNode(Condition.EQ, receiverHub, typeHub); FixedGuardNode guard = graph.add(new FixedGuardNode(typeCheck, DeoptimizationReason.TypeCheckedInliningViolated, DeoptimizationAction.InvalidateReprofile)); @@ -608,7 +608,7 @@ PhiNode returnValuePhi = null; if (invoke.asNode().kind() != Kind.Void) { - returnValuePhi = graph.add(new PhiNode(invoke.asNode().kind(), returnMerge)); + returnValuePhi = graph.addWithoutUnique(new PhiNode(invoke.asNode().kind(), returnMerge)); } MergeNode exceptionMerge = null; @@ -764,7 +764,7 @@ assert ptypes.size() >= 1; ValueNode nonNullReceiver = nonNullReceiver(invoke); Kind hubKind = ((MethodCallTargetNode) invoke.callTarget()).targetMethod().getDeclaringClass().getEncoding(Representation.ObjectHub).getKind(); - LoadHubNode hub = graph.add(new LoadHubNode(nonNullReceiver, hubKind, null)); + LoadHubNode hub = graph.unique(new LoadHubNode(nonNullReceiver, hubKind, null)); if (!invokeIsOnlySuccessor && chooseMethodDispatch()) { assert successors.length == concretes.size() + 1; diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ReadEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ReadEliminationPhase.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ReadEliminationPhase.java Sun Sep 15 22:33:09 2013 +0200 @@ -87,7 +87,7 @@ } if (lastLocationAccess instanceof PhiNode) { PhiNode phi = (PhiNode) lastLocationAccess; - PhiNode newPhi = phi.graph().add(new PhiNode(n.kind(), phi.merge())); + PhiNode newPhi = phi.graph().addWithoutUnique(new PhiNode(n.kind(), phi.merge())); nodeMap.set(lastLocationAccess, newPhi); for (ValueNode value : phi.values()) { newPhi.addInput(getValue(n, value, nodeMap)); diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Sun Sep 15 22:33:09 2013 +0200 @@ -476,7 +476,7 @@ // introduce a new phi PhiNode newPhi = bottomPhis.get(node); if (newPhi == null) { - newPhi = graph.add(new PhiNode(node.kind(), newBottomMerge)); + newPhi = graph.addWithoutUnique(new PhiNode(node.kind(), newBottomMerge)); bottomPhis.put(node, newPhi); newPhi.addInput(node); } diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java --- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java Sun Sep 15 22:33:09 2013 +0200 @@ -172,7 +172,7 @@ // Convert node are replaced by the placeholder which in turn is replaced by the // snippet. - LocalNode replacee = graph.add(new LocalNode(Integer.MAX_VALUE, convert.stamp())); + LocalNode replacee = graph.addWithoutUnique(new LocalNode(Integer.MAX_VALUE, convert.stamp())); convert.replaceAtUsages(replacee); Arguments args = new Arguments(key); args.add("input", convert.value()); diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Sun Sep 15 22:33:09 2013 +0200 @@ -89,7 +89,7 @@ Node newInstance = createNodeInstance(c, parameterTypes, returnType, intrinsic.setStampFromReturnType(), nodeConstructorArguments); // Replace the invoke with the new node. - methodCallTargetNode.graph().add(newInstance); + newInstance = methodCallTargetNode.graph().addOrUnique(newInstance); methodCallTargetNode.invoke().intrinsify(newInstance); // Clean up checkcast instructions inserted by javac if the return type is generic. @@ -137,7 +137,7 @@ /** * Converts the arguments of an invoke node to object values suitable for use as the arguments * to a reflective invocation of a Java constructor or method. - * + * * @param folding specifies if the invocation is for handling a {@link Fold} annotation * @return the arguments for the reflective invocation or null if an argument of {@code invoke} * that is expected to be constant isn't diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java Sun Sep 15 22:33:09 2013 +0200 @@ -44,7 +44,7 @@ @Override public MaterializedObjectState duplicateWithVirtualState() { - return graph().add(new MaterializedObjectState(object(), materializedValue)); + return graph().addWithoutUnique(new MaterializedObjectState(object(), materializedValue)); } @Override diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java Sun Sep 15 22:33:09 2013 +0200 @@ -53,7 +53,7 @@ @Override public VirtualObjectState duplicateWithVirtualState() { - return graph().add(new VirtualObjectState(object(), fieldValues)); + return graph().addWithoutUnique(new VirtualObjectState(object(), fieldValues)); } @Override diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/GraphEffectList.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/GraphEffectList.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/GraphEffectList.java Sun Sep 15 22:33:09 2013 +0200 @@ -113,7 +113,7 @@ @Override public void apply(StructuredGraph graph, ArrayList obsoleteNodes) { assert !node.isAlive() && !node.isDeleted() : node + " " + cause; - graph.add(node); + graph.addWithoutUnique(node); } }); } @@ -187,7 +187,7 @@ stateAfter.virtualObjectMappings().remove(i); } } - stateAfter.addVirtualObjectMapping(graph.add(state)); + stateAfter.addVirtualObjectMapping(graph.addWithoutUnique(state)); } @Override @@ -328,7 +328,7 @@ @Override public void apply(StructuredGraph graph, ArrayList obsoleteNodes) { for (ValueNode otherAllocation : otherAllocations) { - graph.add(otherAllocation); + graph.addWithoutUnique(otherAllocation); if (otherAllocation instanceof FixedWithNextNode) { graph.addBeforeFixed(position, (FixedWithNextNode) otherAllocation); } else { @@ -344,7 +344,7 @@ graph.addBeforeFixed(position, commit); } for (AllocatedObjectNode obj : objects) { - graph.add(obj); + graph.addWithoutUnique(obj); commit.getVirtualObjects().add(obj.getVirtualObject()); obj.setCommit(commit); } diff -r 44d5989ae745 -r f091e0d6f4f3 graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Sun Sep 15 19:03:38 2013 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Sun Sep 15 22:33:09 2013 +0200 @@ -282,7 +282,7 @@ private ValueNode nodeClassOp(StructuredGraph graph, Class nodeClass, ValueNode left, ValueNode right, Invoke invoke) { try { Constructor constructor = nodeClass.getConstructor(Kind.class, ValueNode.class, ValueNode.class); - ValueNode result = graph.add(constructor.newInstance(wordKind, left, right)); + ValueNode result = graph.addOrUnique(constructor.newInstance(wordKind, left, right)); if (result instanceof FixedWithNextNode) { graph.addBeforeFixed(invoke.asNode(), (FixedWithNextNode) result); }