# HG changeset patch # User Christos Kotselidis # Date 1383576147 -3600 # Node ID a2b1ee69ce4625e71968975a9cc9e092b827f81d # Parent 55b23f75d3b0a584a233ed182a964ab86ea0748e Loose unnecessary input dependencies from write barriers diff -r 55b23f75d3b0 -r a2b1ee69ce46 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PostWriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PostWriteBarrier.java Mon Nov 04 12:17:37 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PostWriteBarrier.java Mon Nov 04 15:42:27 2013 +0100 @@ -27,7 +27,14 @@ public class G1PostWriteBarrier extends WriteBarrier { - public G1PostWriteBarrier(ValueNode object, ValueNode value, LocationNode location, boolean precise) { + private boolean alwaysNull; + + public G1PostWriteBarrier(ValueNode object, ValueNode value, LocationNode location, boolean precise, boolean alwaysNull) { super(object, value, location, precise); + this.alwaysNull = alwaysNull; + } + + public boolean alwaysNull() { + return alwaysNull; } } diff -r 55b23f75d3b0 -r a2b1ee69ce46 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialWriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialWriteBarrier.java Mon Nov 04 12:17:37 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialWriteBarrier.java Mon Nov 04 15:42:27 2013 +0100 @@ -27,7 +27,14 @@ public class SerialWriteBarrier extends WriteBarrier { - public SerialWriteBarrier(ValueNode object, ValueNode value, LocationNode location, boolean precise) { - super(object, value, location, precise); + private boolean alwaysNull; + + public SerialWriteBarrier(ValueNode object, LocationNode location, boolean precise, boolean alwaysNull) { + super(object, null, location, precise); + this.alwaysNull = alwaysNull; + } + + public boolean alwaysNull() { + return alwaysNull; } } diff -r 55b23f75d3b0 -r a2b1ee69ce46 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Mon Nov 04 12:17:37 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Mon Nov 04 15:42:27 2013 +0100 @@ -26,10 +26,11 @@ import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.nodes.*; +import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; +import com.oracle.graal.nodes.type.*; import com.oracle.graal.phases.*; public class WriteBarrierAdditionPhase extends Phase { @@ -74,11 +75,14 @@ } protected void addG1PostWriteBarrier(AccessNode node, ValueNode object, ValueNode value, LocationNode location, boolean precise, StructuredGraph graph) { - graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(object, value, location, precise))); + final boolean alwaysNull = ObjectStamp.isObjectAlwaysNull(value); + graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(object, value, location, precise, alwaysNull))); } protected void addSerialPostWriteBarrier(AccessNode node, ValueNode object, ValueNode value, LocationNode location, boolean precise, StructuredGraph graph) { - graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(object, value, location, precise))); + final boolean alwaysNull = ObjectStamp.isObjectAlwaysNull(value); + final LocationNode loc = (precise ? location : null); + graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(object, loc, precise, alwaysNull))); } private void addWriteNodeBarriers(WriteNode node, StructuredGraph graph) { diff -r 55b23f75d3b0 -r a2b1ee69ce46 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Mon Nov 04 12:17:37 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Mon Nov 04 15:42:27 2013 +0100 @@ -36,7 +36,6 @@ import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.type.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.util.*; import com.oracle.graal.replacements.*; @@ -346,7 +345,7 @@ args.add("object", writeBarrier.getObject()); args.add("location", writeBarrier.getLocation()); args.addConst("usePrecise", writeBarrier.usePrecise()); - args.addConst("alwaysNull", ObjectStamp.isObjectAlwaysNull(writeBarrier.getValue())); + args.addConst("alwaysNull", writeBarrier.alwaysNull()); template(args).instantiate(providers.getMetaAccess(), writeBarrier, DEFAULT_REPLACER, args); } @@ -386,7 +385,7 @@ args.add("value", writeBarrierPost.getValue()); args.add("location", writeBarrierPost.getLocation()); args.addConst("usePrecise", writeBarrierPost.usePrecise()); - args.addConst("alwaysNull", ObjectStamp.isObjectAlwaysNull(writeBarrierPost.getValue())); + args.addConst("alwaysNull", writeBarrierPost.alwaysNull()); args.addConst("trace", traceBarrier()); template(args).instantiate(providers.getMetaAccess(), writeBarrierPost, DEFAULT_REPLACER, args); }