additional unproxying that shouldn't hurt

Garcia Gutierrez Miguel Alfredo miguelalfredo.garcia at epfl.ch
Thu Dec 26 13:18:35 PST 2013


I'm looking into Graal again, following the usual trail: GraphBuilderPhase, ConditionalEliminationPhase, and so on so forth.

Regarding ConditionalEliminationPhase, the keys of `State.knownNonNull` (resp `knownNull`) must be in "unproxified form", at least that's what the following helper method suggests:

        public boolean isNull(ValueNode value) {
            return ObjectStamp.isObjectAlwaysNull(value) || knownNull.contains(GraphUtil.unproxify(value));
        }

Using that helper method is simple: the argument need not be un-proxified beforehand.

In contrast, when directly querying the underlying map (using `contains` resp `containsKey`), the caller must unproxify the argument, right?

Well, assuming the above, the following diff shows two places where unproxying appears to be necessary. In any case, it shouldn't hurt :)

diff -r 72e2ec923b7b graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java  Sat Dec 21 13:47:36 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java  Thu Dec 26 22:05:23 2013 +0100
@@ -160,14 +160,14 @@
             if (!(merge instanceof LoopBeginNode)) {
                 for (PhiNode phi : merge.phis()) {
                     if (phi.type() == PhiType.Value && phi.kind() == Kind.Object) {
-                        ValueNode firstValue = phi.valueAt(0);
+                        ValueNode firstValue = GraphUtil.unproxify(phi.valueAt(0));
                         ResolvedJavaType type = getNodeType(firstValue);
                         boolean nonNull = knownNonNull.contains(firstValue);
                         boolean isNull = knownNull.contains(firstValue);

                         for (int i = 0; i < withStates.size(); i++) {
                             State otherState = withStates.get(i);
-                            ValueNode value = phi.valueAt(i + 1);
+                            ValueNode value = GraphUtil.unproxify(phi.valueAt(i + 1));
                             ResolvedJavaType otherType = otherState.getNodeType(value);
                             type = widen(type, otherType);
                             nonNull &= otherState.knownNonNull.contains(value);


Miguel

--
Miguel Garcia
Swiss Federal Institute of Technology
EPFL - IC - LAMP1 - INR 328 - Station 14
CH-1015 Lausanne - Switzerland
http://lamp.epfl.ch/~magarcia/


More information about the graal-dev mailing list