--- old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/LocationIdentity.java 2017-03-20 17:37:07.000000000 -0700 +++ new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/LocationIdentity.java 2017-03-20 17:37:07.000000000 -0700 @@ -22,8 +22,6 @@ */ package org.graalvm.compiler.core.common; -import java.util.IdentityHashMap; - // JaCoCo Exclude /** @@ -32,7 +30,7 @@ * * Clients of {@link LocationIdentity} must use {@link #equals(Object)}, not {@code ==}, when * comparing two {@link LocationIdentity} values for equality. Likewise, they must not use - * {@link IdentityHashMap}s with {@link LocationIdentity} values as keys. + * {@link java.util.IdentityHashMap}s with {@link LocationIdentity} values as keys. */ public abstract class LocationIdentity { @@ -48,13 +46,40 @@ } } + private static final class InitLocationIdentity extends LocationIdentity { + @Override + public boolean isImmutable() { + return true; + } + + @Override + public String toString() { + return "INIT_LOCATION"; + } + } + public static final LocationIdentity ANY_LOCATION = new AnyLocationIdentity(); + public static final LocationIdentity INIT_LOCATION = new InitLocationIdentity(); + /** + * Indicates that the given location is the union of all possible mutable locations. A write to + * such a location kill all reads from mutable locations and a read from this location is killed + * by any write (except for initialization writes). + */ public static LocationIdentity any() { return ANY_LOCATION; } /** + * Location only allowed to be used for writes. Indicates that a completely new memory location + * is written. Kills no read. The previous value at the given location must be either + * uninitialized or null. Writes to this location do not need a GC pre-barrier. + */ + public static LocationIdentity init() { + return INIT_LOCATION; + } + + /** * Denotes a location is unchanging in all cases. Not that this is different than the Java * notion of final which only requires definite assignment. */ @@ -68,6 +93,10 @@ return this == ANY_LOCATION; } + public final boolean isInit() { + return this == INIT_LOCATION; + } + public final boolean isSingle() { return this != ANY_LOCATION; }