Mercurial > hg > truffle
changeset 12404:47eb670c1634
Merge.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 14 Oct 2013 18:48:21 +0200 |
parents | 52caeb1c19a0 (current diff) 28d80a9260cd (diff) |
children | 139b84d713bc 5ae8c9cf46e9 5f022aa41631 |
files | |
diffstat | 2 files changed, 8 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Mon Oct 14 18:35:48 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Mon Oct 14 18:48:21 2013 +0200 @@ -77,9 +77,6 @@ @Override public void lower(LoweringTool tool) { - if (graph().getGuardsStage() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { - throw new GraalInternalError("Cannot create guards in after-guard lowering"); - } GuardingNode guard = tool.createGuard(condition, reason, action, negated); ValueAnchorNode anchor = graph().add(new ValueAnchorNode((ValueNode) guard)); PiNode pi = graph().unique(new PiNode(object, stamp(), (ValueNode) guard));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Mon Oct 14 18:35:48 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Mon Oct 14 18:48:21 2013 +0200 @@ -91,13 +91,12 @@ * 2: B b = guardingPi(a instanceof B, a, stamp(B, non-null)) * </pre> * - * Note: we use {@link Graph#add} as opposed to {@link Graph#unique} for the new + * Note: we use {@link Graph#addWithoutUnique} as opposed to {@link Graph#unique} for the new * {@link InstanceOfNode} to maintain the invariant checked by * {@code LoweringPhase.checkUsagesAreScheduled()}. */ @Override public void lower(LoweringTool tool) { - 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); @@ -108,17 +107,20 @@ condition = LogicConstantNode.contradiction(graph()); stamp = StampFactory.declared(type); } else if (ObjectStamp.isObjectNonNull(object)) { - condition = typeTest; + condition = graph().addWithoutUnique(new InstanceOfNode(type, object, profile)); } else { if (profile != null && profile.getNullSeen() == TriState.FALSE) { - FixedGuardNode nullGuard = graph().add(new FixedGuardNode(graph().unique(new IsNullNode(object)), UnreachedCode, DeoptimizationAction.InvalidateReprofile, true)); - graph().addBeforeFixed(this, nullGuard); + FixedGuardNode nullCheck = graph().add(new FixedGuardNode(graph().unique(new IsNullNode(object)), UnreachedCode, InvalidateReprofile, true)); + PiNode nullGuarded = graph().unique(new PiNode(object, object().stamp().join(StampFactory.objectNonNull()), nullCheck)); + InstanceOfNode typeTest = graph().addWithoutUnique(new InstanceOfNode(type, nullGuarded, profile)); + graph().addBeforeFixed(this, nullCheck); condition = typeTest; stamp = stamp.join(StampFactory.objectNonNull()); - nullGuard.lower(tool); + nullCheck.lower(tool); } else { // TODO (ds) replace with probability of null-seen when available double shortCircuitProbability = NOT_FREQUENT_PROBABILITY; + InstanceOfNode typeTest = graph().addWithoutUnique(new InstanceOfNode(type, object, profile)); condition = LogicNode.or(graph().unique(new IsNullNode(object)), typeTest, shortCircuitProbability); } }