# HG changeset patch # User Thomas Wuerthinger # Date 1433272045 -7200 # Node ID 942793d2a513ae8c66ca02eba99c7213112ada42 # Parent ffe693cc427f20762754e92b89473551e384d41c Turn BoxNode from floating to fixed node. diff -r ffe693cc427f -r 942793d2a513 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Tue Jun 02 18:29:35 2015 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Tue Jun 02 21:07:25 2015 +0200 @@ -26,10 +26,8 @@ import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; -import com.oracle.graal.graph.spi.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -41,13 +39,15 @@ * methods in Integer, Long, etc. */ @NodeInfo -public final class BoxNode extends UnaryNode implements VirtualizableAllocation, Lowerable { +public final class BoxNode extends FixedWithNextNode implements VirtualizableAllocation, Lowerable { public static final NodeClass TYPE = NodeClass.create(BoxNode.class); - protected final Kind boxingKind; + @Input private ValueNode value; + private final Kind boxingKind; public BoxNode(ValueNode value, ResolvedJavaType resultType, Kind boxingKind) { - super(TYPE, StampFactory.exactNonNull(resultType), value); + super(TYPE, StampFactory.exactNonNull(resultType)); + this.value = value; this.boxingKind = boxingKind; } @@ -55,18 +55,13 @@ return boxingKind; } - @Override - public void lower(LoweringTool tool) { - tool.getLowerer().lower(this, tool); + public ValueNode getValue() { + return value; } @Override - public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) { - /* - * Constant values are not canonicalized into their constant boxing objects because this - * would mean that the information that they came from a valueOf is lost. - */ - return this; + public void lower(LoweringTool tool) { + tool.getLowerer().lower(this, tool); } @Override diff -r ffe693cc427f -r 942793d2a513 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java Tue Jun 02 18:29:35 2015 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java Tue Jun 02 21:07:25 2015 +0200 @@ -33,7 +33,6 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.util.*; import com.oracle.graal.phases.util.*; import com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates; import com.oracle.graal.replacements.SnippetTemplate.Arguments; @@ -185,15 +184,14 @@ FloatingNode canonical = canonicalizeBoxing(box, providers.getMetaAccess(), providers.getConstantReflection()); // if in AOT mode, we don't want to embed boxed constants. if (canonical != null && !ImmutableCode.getValue()) { - box.graph().replaceFloating(box, canonical); + box.graph().replaceFixedWithFloating(box, canonical); } else { Arguments args = new Arguments(boxSnippets.get(box.getBoxingKind()), box.graph().getGuardsStage(), tool.getLoweringStage()); args.add("value", box.getValue()); SnippetTemplate template = template(args); Debug.log("Lowering integerValueOf in %s: node=%s, template=%s, arguments=%s", box.graph(), box, template, args); - template.instantiate(providers.getMetaAccess(), box, DEFAULT_REPLACER, tool, args); - GraphUtil.killWithUnusedFloatingInputs(box); + template.instantiate(providers.getMetaAccess(), box, DEFAULT_REPLACER, args); } } diff -r ffe693cc427f -r 942793d2a513 graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/NativeCallStubGraphBuilder.java --- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/NativeCallStubGraphBuilder.java Tue Jun 02 18:29:35 2015 +0200 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/NativeCallStubGraphBuilder.java Tue Jun 02 21:07:25 2015 +0200 @@ -90,13 +90,14 @@ throw new IllegalArgumentException("Return type not supported: " + returnType.getName()); } ResolvedJavaType type = providers.getMetaAccess().lookupJavaType(callNode.getKind().toBoxedJavaClass()); - boxedResult = g.unique(new BoxNode(callNode, type, callNode.getKind())); + boxedResult = g.add(new BoxNode(callNode, type, callNode.getKind())); } else { - boxedResult = g.unique(new BoxNode(ConstantNode.forLong(0, g), providers.getMetaAccess().lookupJavaType(Long.class), Kind.Long)); + boxedResult = g.add(new BoxNode(ConstantNode.forLong(0, g), providers.getMetaAccess().lookupJavaType(Long.class), Kind.Long)); } + callNode.setNext(boxedResult); ReturnNode returnNode = g.add(new ReturnNode(boxedResult)); - callNode.setNext(returnNode); + boxedResult.setNext(returnNode); return g; } catch (NoSuchMethodException e) { throw JVMCIError.shouldNotReachHere("Call Stub method not found");