Mercurial > hg > graal-compiler
changeset 15442:0f919919fd63
[flow-sensitive] NullCheckNode turned into equivalent FixedGuardNode
author | Miguel Garcia <miguel.m.garcia@oracle.com> |
---|---|
date | Tue, 29 Apr 2014 17:14:49 +0200 |
parents | 97e0f9ec5752 |
children | f5a837e3b65f |
files | graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowSensitiveReduction.java |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowSensitiveReduction.java Tue Apr 29 16:55:05 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowSensitiveReduction.java Tue Apr 29 17:14:49 2014 +0200 @@ -26,6 +26,7 @@ import com.oracle.graal.graph.Node; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.FloatingNode; +import com.oracle.graal.nodes.calc.IsNullNode; import com.oracle.graal.nodes.extended.LoadHubNode; import com.oracle.graal.nodes.extended.NullCheckNode; import com.oracle.graal.nodes.java.*; @@ -37,6 +38,7 @@ import java.lang.reflect.Modifier; +import static com.oracle.graal.api.meta.DeoptimizationAction.InvalidateReprofile; import static com.oracle.graal.api.meta.DeoptimizationReason.*; /** @@ -437,6 +439,8 @@ * <ul> * <li>is known to be null, an unconditional deopt is added.</li> * <li>is known to be non-null, the NullCheckNode is removed.</li> + * <li>otherwise, the NullCheckNode is lowered to a FixedGuardNode which then allows using it as + * anchor for state-tracking.</li> * </ul> * * <p> @@ -459,7 +463,17 @@ graph.removeFixed(ncn); return; } - // TODO ANCHOR NEEDED: state.trackNN(object, ncn); + /* + * Lower the NullCheckNode to a FixedGuardNode which then allows using it as anchor for + * state-tracking. TODO the assumption here is that the code emitted for the resulting + * FixedGuardNode is as efficient as for NullCheckNode. + */ + IsNullNode isNN = graph.unique(new IsNullNode(object)); + reasoner.added.add(isNN); + FixedGuardNode nullCheck = graph.add(new FixedGuardNode(isNN, UnreachedCode, InvalidateReprofile, true)); + graph.replaceFixedWithFixed(ncn, nullCheck); + + state.trackNN(object, nullCheck); } /**