changeset 18259:e1b2489393f4

added global map to ensure each NamedLocationIdentity object has a unique name which can be used for implementing .equals() and .hashCode()
author Doug Simon <doug.simon@oracle.com>
date Wed, 05 Nov 2014 17:04:18 +0100
parents 6faee2dcebbf
children 0f23e16288c5
files graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocationIdentity.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NamedLocationIdentity.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILHotSpotReplacementsUtil.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UncommonTrapStub.java graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetCounter.java
diffstat 12 files changed, 124 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocationIdentity.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocationIdentity.java	Wed Nov 05 17:04:18 2014 +0100
@@ -34,17 +34,17 @@
      * analysis of memory accesses. A read from this location cannot be moved or coalesced with
      * other reads because its interaction with other reads is not known.
      */
-    LocationIdentity ANY_LOCATION = new NamedLocationIdentity("ANY_LOCATION");
+    LocationIdentity ANY_LOCATION = NamedLocationIdentity.create("ANY_LOCATION", false);
 
     /**
      * Denotes the location of a value that is guaranteed to be unchanging.
      */
-    LocationIdentity FINAL_LOCATION = new NamedLocationIdentity("FINAL_LOCATION", true);
+    LocationIdentity FINAL_LOCATION = NamedLocationIdentity.create("FINAL_LOCATION", true);
 
     /**
      * Denotes the location of the length field of a Java array.
      */
-    LocationIdentity ARRAY_LENGTH_LOCATION = new NamedLocationIdentity("[].length", true);
+    LocationIdentity ARRAY_LENGTH_LOCATION = NamedLocationIdentity.create("[].length", true);
 
     /**
      * Denotes a location is unchanging in all cases. Not that this is different than the Java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NamedLocationIdentity.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NamedLocationIdentity.java	Wed Nov 05 17:04:18 2014 +0100
@@ -27,20 +27,35 @@
 /**
  * A {@link LocationIdentity} with a name.
  */
-public class NamedLocationIdentity implements LocationIdentity {
+public final class NamedLocationIdentity implements LocationIdentity {
+
+    /**
+     * Canonicalizing map for {@link NamedLocationIdentity} instances. This is in a separate class
+     * to work around class initialization issues.
+     */
+    static class DB {
+        private static final HashMap<String, NamedLocationIdentity> map = new HashMap<>();
+
+        static synchronized NamedLocationIdentity register(NamedLocationIdentity identity) {
+            NamedLocationIdentity oldValue = map.put(identity.name, identity);
+            if (oldValue != null) {
+                throw new IllegalArgumentException("identity " + identity + " already exists");
+            }
+            return identity;
+        }
+
+        static synchronized NamedLocationIdentity lookup(String name) {
+            return map.get(name);
+        }
+    }
 
     protected final String name;
 
     protected final boolean immutable;
 
-    /**
-     * Creates a named unique location identity for read and write operations.
-     *
-     * @param name the name of the new location identity
-     */
-    public NamedLocationIdentity(String name) {
+    private NamedLocationIdentity(String name, boolean immutable) {
         this.name = name;
-        this.immutable = false;
+        this.immutable = immutable;
     }
 
     /**
@@ -48,14 +63,46 @@
      *
      * @param name the name of the new location identity
      */
-    public NamedLocationIdentity(String name, boolean immutable) {
-        this.name = name;
-        this.immutable = immutable;
+    public static NamedLocationIdentity create(String name) {
+        return create(name, false);
+    }
+
+    /**
+     * Creates a named unique location identity for read and write operations.
+     *
+     * @param name the name of the new location identity
+     */
+    public static NamedLocationIdentity create(String name, boolean immutable) {
+        return DB.register(new NamedLocationIdentity(name, immutable));
+    }
+
+    /**
+     * Gets the unique {@link NamedLocationIdentity} (if any) for a given name.
+     */
+    public static NamedLocationIdentity lookup(String name) {
+        return DB.lookup(name);
+    }
+
+    @Override
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        }
+        if (obj instanceof NamedLocationIdentity) {
+            NamedLocationIdentity that = (NamedLocationIdentity) obj;
+            return this.name.equals(that.name);
+        }
+        return false;
     }
 
     @Override
     public String toString() {
-        return name;
+        return name + (immutable ? ":immutable" : ":mutable");
     }
 
     public boolean isImmutable() {
@@ -76,7 +123,7 @@
     private static EnumMap<Kind, LocationIdentity> initArrayLocations() {
         EnumMap<Kind, LocationIdentity> result = new EnumMap<>(Kind.class);
         for (Kind kind : Kind.values()) {
-            result.put(kind, new NamedLocationIdentity("Array: " + kind.getJavaName()));
+            result.put(kind, NamedLocationIdentity.create("Array: " + kind.getJavaName()));
         }
         return result;
     }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java	Wed Nov 05 17:04:18 2014 +0100
@@ -206,6 +206,7 @@
             new VerifyUsageWithEquals(JavaType.class).apply(graph, context);
             new VerifyUsageWithEquals(JavaMethod.class).apply(graph, context);
             new VerifyUsageWithEquals(JavaField.class).apply(graph, context);
+            new VerifyUsageWithEquals(LocationIdentity.class).apply(graph, context);
             new VerifyUsageWithEquals(LIRKind.class).apply(graph, context);
         }
         new VerifyDebugUsage().apply(graph, context);
--- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILHotSpotReplacementsUtil.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILHotSpotReplacementsUtil.java	Wed Nov 05 17:04:18 2014 +0100
@@ -43,18 +43,18 @@
         hsailRegisters = registers;
     }
 
-    public static final LocationIdentity TLAB_INFO_LOCATION = new NamedLocationIdentity("TlabInfo");
-    public static final LocationIdentity TLABINFO_LASTGOODTOP_LOCATION = new NamedLocationIdentity("TlabInfoLastGoodTop");
-    public static final LocationIdentity TLABINFO_END_LOCATION = new NamedLocationIdentity("TlabInfoEnd");
-    public static final LocationIdentity TLABINFO_TOP_LOCATION = new NamedLocationIdentity("TlabInfoTop");
-    public static final LocationIdentity TLABINFO_START_LOCATION = new NamedLocationIdentity("TlabInfoStart");
-    public static final LocationIdentity TLABINFO_ALLOCINFO_LOCATION = new NamedLocationIdentity("TlabInfoAllocInfo");
-    public static final LocationIdentity TLABINFO_ORIGINALTOP_LOCATION = new NamedLocationIdentity("TlabInfoOriginalTop");
-    public static final LocationIdentity TLABINFO_TLAB_LOCATION = new NamedLocationIdentity("TlabInfoTlab");
+    public static final LocationIdentity TLAB_INFO_LOCATION = NamedLocationIdentity.create("TlabInfo");
+    public static final LocationIdentity TLABINFO_LASTGOODTOP_LOCATION = NamedLocationIdentity.create("TlabInfoLastGoodTop");
+    public static final LocationIdentity TLABINFO_END_LOCATION = NamedLocationIdentity.create("TlabInfoEnd");
+    public static final LocationIdentity TLABINFO_TOP_LOCATION = NamedLocationIdentity.create("TlabInfoTop");
+    public static final LocationIdentity TLABINFO_START_LOCATION = NamedLocationIdentity.create("TlabInfoStart");
+    public static final LocationIdentity TLABINFO_ALLOCINFO_LOCATION = NamedLocationIdentity.create("TlabInfoAllocInfo");
+    public static final LocationIdentity TLABINFO_ORIGINALTOP_LOCATION = NamedLocationIdentity.create("TlabInfoOriginalTop");
+    public static final LocationIdentity TLABINFO_TLAB_LOCATION = NamedLocationIdentity.create("TlabInfoTlab");
 
-    public static final LocationIdentity ALLOCINFO_TLABINFOSPOOLNEXT_LOCATION = new NamedLocationIdentity("AllocInfoTlabInfosPoolNext");
-    public static final LocationIdentity ALLOCINFO_TLABINFOSPOOLEND_LOCATION = new NamedLocationIdentity("AllocInfoTlabInfosPoolEnd");
-    public static final LocationIdentity ALLOCINFO_TLABALIGNRESERVEBYTES_LOCATION = new NamedLocationIdentity("AllocInfoTlabAlignreservebytes");
+    public static final LocationIdentity ALLOCINFO_TLABINFOSPOOLNEXT_LOCATION = NamedLocationIdentity.create("AllocInfoTlabInfosPoolNext");
+    public static final LocationIdentity ALLOCINFO_TLABINFOSPOOLEND_LOCATION = NamedLocationIdentity.create("AllocInfoTlabInfosPoolEnd");
+    public static final LocationIdentity ALLOCINFO_TLABALIGNRESERVEBYTES_LOCATION = NamedLocationIdentity.create("AllocInfoTlabAlignreservebytes");
 
     /**
      * Gets the value of the thread register as a Word. There is a level of indirection here. Thread
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java	Wed Nov 05 17:04:18 2014 +0100
@@ -63,7 +63,7 @@
         return config().verifyOops;
     }
 
-    public static final LocationIdentity EXCEPTION_OOP_LOCATION = new NamedLocationIdentity("ExceptionOop");
+    public static final LocationIdentity EXCEPTION_OOP_LOCATION = NamedLocationIdentity.create("ExceptionOop");
 
     /**
      * @see HotSpotVMConfig#threadExceptionOopOffset
@@ -73,49 +73,49 @@
         return config().threadExceptionOopOffset;
     }
 
-    public static final LocationIdentity EXCEPTION_PC_LOCATION = new NamedLocationIdentity("ExceptionPc");
+    public static final LocationIdentity EXCEPTION_PC_LOCATION = NamedLocationIdentity.create("ExceptionPc");
 
     @Fold
     public static int threadExceptionPcOffset() {
         return config().threadExceptionPcOffset;
     }
 
-    public static final LocationIdentity LAST_JAVA_PC_LOCATION = new NamedLocationIdentity("LastJavaPc");
+    public static final LocationIdentity LAST_JAVA_PC_LOCATION = NamedLocationIdentity.create("LastJavaPc");
 
     @Fold
     public static int threadLastJavaPcOffset() {
         return config().threadLastJavaPcOffset();
     }
 
-    public static final LocationIdentity LAST_JAVA_FP_LOCATION = new NamedLocationIdentity("LastJavaFp");
+    public static final LocationIdentity LAST_JAVA_FP_LOCATION = NamedLocationIdentity.create("LastJavaFp");
 
     @Fold
     public static int threadLastJavaFpOffset() {
         return config().threadLastJavaFpOffset();
     }
 
-    public static final LocationIdentity TLAB_TOP_LOCATION = new NamedLocationIdentity("TlabTop");
+    public static final LocationIdentity TLAB_TOP_LOCATION = NamedLocationIdentity.create("TlabTop");
 
     @Fold
     public static int threadTlabTopOffset() {
         return config().threadTlabTopOffset();
     }
 
-    public static final LocationIdentity TLAB_END_LOCATION = new NamedLocationIdentity("TlabEnd");
+    public static final LocationIdentity TLAB_END_LOCATION = NamedLocationIdentity.create("TlabEnd");
 
     @Fold
     private static int threadTlabEndOffset() {
         return config().threadTlabEndOffset();
     }
 
-    public static final LocationIdentity TLAB_START_LOCATION = new NamedLocationIdentity("TlabStart");
+    public static final LocationIdentity TLAB_START_LOCATION = NamedLocationIdentity.create("TlabStart");
 
     @Fold
     private static int threadTlabStartOffset() {
         return config().threadTlabStartOffset();
     }
 
-    public static final LocationIdentity PENDING_EXCEPTION_LOCATION = new NamedLocationIdentity("PendingException");
+    public static final LocationIdentity PENDING_EXCEPTION_LOCATION = NamedLocationIdentity.create("PendingException");
 
     /**
      * @see HotSpotVMConfig#pendingExceptionOffset
@@ -125,7 +125,7 @@
         return config().pendingExceptionOffset;
     }
 
-    public static final LocationIdentity PENDING_DEOPTIMIZATION_LOCATION = new NamedLocationIdentity("PendingDeoptimization");
+    public static final LocationIdentity PENDING_DEOPTIMIZATION_LOCATION = NamedLocationIdentity.create("PendingDeoptimization");
 
     /**
      * @see HotSpotVMConfig#pendingDeoptimizationOffset
@@ -135,7 +135,7 @@
         return config().pendingDeoptimizationOffset;
     }
 
-    public static final LocationIdentity OBJECT_RESULT_LOCATION = new NamedLocationIdentity("ObjectResult");
+    public static final LocationIdentity OBJECT_RESULT_LOCATION = NamedLocationIdentity.create("ObjectResult");
 
     @Fold
     private static int objectResultOffset() {
@@ -232,14 +232,14 @@
         return result;
     }
 
-    public static final LocationIdentity JAVA_THREAD_THREAD_OBJECT_LOCATION = new NamedLocationIdentity("JavaThread::_threadObj");
+    public static final LocationIdentity JAVA_THREAD_THREAD_OBJECT_LOCATION = NamedLocationIdentity.create("JavaThread::_threadObj");
 
     @Fold
     public static int threadObjectOffset() {
         return config().threadObjectOffset;
     }
 
-    public static final LocationIdentity JAVA_THREAD_OSTHREAD_LOCATION = new NamedLocationIdentity("JavaThread::_osthread");
+    public static final LocationIdentity JAVA_THREAD_OSTHREAD_LOCATION = NamedLocationIdentity.create("JavaThread::_osthread");
 
     @Fold
     public static int osThreadOffset() {
@@ -271,7 +271,7 @@
         return config().heapWordSize;
     }
 
-    public static final LocationIdentity PROTOTYPE_MARK_WORD_LOCATION = new NamedLocationIdentity("PrototypeMarkWord");
+    public static final LocationIdentity PROTOTYPE_MARK_WORD_LOCATION = NamedLocationIdentity.create("PrototypeMarkWord");
 
     @Fold
     public static int prototypeMarkWordOffset() {
@@ -283,14 +283,14 @@
         return config().arrayPrototypeMarkWord();
     }
 
-    public static final LocationIdentity KLASS_ACCESS_FLAGS_LOCATION = new NamedLocationIdentity("Klass::_access_flags", true);
+    public static final LocationIdentity KLASS_ACCESS_FLAGS_LOCATION = NamedLocationIdentity.create("Klass::_access_flags", true);
 
     @Fold
     public static int klassAccessFlagsOffset() {
         return config().klassAccessFlagsOffset;
     }
 
-    public static final LocationIdentity KLASS_LAYOUT_HELPER_LOCATION = new NamedLocationIdentity("Klass::_layout_helper", true);
+    public static final LocationIdentity KLASS_LAYOUT_HELPER_LOCATION = NamedLocationIdentity.create("Klass::_layout_helper", true);
 
     @Fold
     public static int klassLayoutHelperOffset() {
@@ -319,30 +319,30 @@
         return (layoutHelper < layoutHelperNeutralValue);
     }
 
-    public static final LocationIdentity ARRAY_KLASS_COMPONENT_MIRROR = new NamedLocationIdentity("ArrayKlass::_component_mirror", true);
+    public static final LocationIdentity ARRAY_KLASS_COMPONENT_MIRROR = NamedLocationIdentity.create("ArrayKlass::_component_mirror", true);
 
     @Fold
     public static int arrayKlassComponentMirrorOffset() {
         return config().arrayKlassComponentMirrorOffset;
     }
 
-    public static final LocationIdentity KLASS_SUPER_KLASS_LOCATION = new NamedLocationIdentity("Klass::_super", true);
+    public static final LocationIdentity KLASS_SUPER_KLASS_LOCATION = NamedLocationIdentity.create("Klass::_super", true);
 
     @Fold
     public static int klassSuperKlassOffset() {
         return config().klassSuperKlassOffset;
     }
 
-    public static final LocationIdentity MARK_WORD_LOCATION = new NamedLocationIdentity("MarkWord");
+    public static final LocationIdentity MARK_WORD_LOCATION = NamedLocationIdentity.create("MarkWord");
 
     @Fold
     public static int markOffset() {
         return config().markOffset;
     }
 
-    public static final LocationIdentity HUB_WRITE_LOCATION = new NamedLocationIdentity("Hub");
+    public static final LocationIdentity HUB_WRITE_LOCATION = NamedLocationIdentity.create("Hub:write");
 
-    public static final LocationIdentity HUB_LOCATION = new NamedLocationIdentity("Hub", true);
+    public static final LocationIdentity HUB_LOCATION = NamedLocationIdentity.create("Hub", true);
 
     @Fold
     private static int hubOffset() {
@@ -479,28 +479,28 @@
         return config().g1SATBQueueBufferOffset();
     }
 
-    public static final LocationIdentity KLASS_SUPER_CHECK_OFFSET_LOCATION = new NamedLocationIdentity("Klass::_super_check_offset", true);
+    public static final LocationIdentity KLASS_SUPER_CHECK_OFFSET_LOCATION = NamedLocationIdentity.create("Klass::_super_check_offset", true);
 
     @Fold
     public static int superCheckOffsetOffset() {
         return config().superCheckOffsetOffset;
     }
 
-    public static final LocationIdentity SECONDARY_SUPER_CACHE_LOCATION = new NamedLocationIdentity("SecondarySuperCache");
+    public static final LocationIdentity SECONDARY_SUPER_CACHE_LOCATION = NamedLocationIdentity.create("SecondarySuperCache");
 
     @Fold
     public static int secondarySuperCacheOffset() {
         return config().secondarySuperCacheOffset;
     }
 
-    public static final LocationIdentity SECONDARY_SUPERS_LOCATION = new NamedLocationIdentity("SecondarySupers");
+    public static final LocationIdentity SECONDARY_SUPERS_LOCATION = NamedLocationIdentity.create("SecondarySupers");
 
     @Fold
     public static int secondarySupersOffset() {
         return config().secondarySupersOffset;
     }
 
-    public static final LocationIdentity DISPLACED_MARK_WORD_LOCATION = new NamedLocationIdentity("DisplacedMarkWord");
+    public static final LocationIdentity DISPLACED_MARK_WORD_LOCATION = NamedLocationIdentity.create("DisplacedMarkWord");
 
     @Fold
     public static int lockDisplacedMarkOffset() {
@@ -598,7 +598,7 @@
         return CodeUtil.log2(wordSize());
     }
 
-    public static final LocationIdentity CLASS_STATE_LOCATION = new NamedLocationIdentity("ClassState");
+    public static final LocationIdentity CLASS_STATE_LOCATION = NamedLocationIdentity.create("ClassState");
 
     @Fold
     public static int instanceKlassInitStateOffset() {
@@ -623,7 +623,7 @@
         return hub.readByte(instanceKlassInitStateOffset(), CLASS_STATE_LOCATION);
     }
 
-    public static final LocationIdentity KLASS_MODIFIER_FLAGS_LOCATION = new NamedLocationIdentity("Klass::_modifier_flags", true);
+    public static final LocationIdentity KLASS_MODIFIER_FLAGS_LOCATION = NamedLocationIdentity.create("Klass::_modifier_flags", true);
 
     @Fold
     public static int klassModifierFlagsOffset() {
@@ -640,28 +640,28 @@
         return config().arrayKlassOffset;
     }
 
-    public static final LocationIdentity KLASS_NODE_CLASS = new NamedLocationIdentity("KlassNodeClass");
+    public static final LocationIdentity KLASS_NODE_CLASS = NamedLocationIdentity.create("KlassNodeClass");
 
     @Fold
     public static int instanceKlassNodeClassOffset() {
         return config().instanceKlassNodeClassOffset;
     }
 
-    public static final LocationIdentity CLASS_MIRROR_LOCATION = new NamedLocationIdentity("Klass::_java_mirror", true);
+    public static final LocationIdentity CLASS_MIRROR_LOCATION = NamedLocationIdentity.create("Klass::_java_mirror", true);
 
     @Fold
     public static int classMirrorOffset() {
         return config().classMirrorOffset;
     }
 
-    public static final LocationIdentity HEAP_TOP_LOCATION = new NamedLocationIdentity("HeapTop");
+    public static final LocationIdentity HEAP_TOP_LOCATION = NamedLocationIdentity.create("HeapTop");
 
     @Fold
     public static long heapTopAddress() {
         return config().heapTopAddress;
     }
 
-    public static final LocationIdentity HEAP_END_LOCATION = new NamedLocationIdentity("HeapEnd");
+    public static final LocationIdentity HEAP_END_LOCATION = NamedLocationIdentity.create("HeapEnd");
 
     @Fold
     public static long heapEndAddress() {
@@ -683,42 +683,42 @@
         return config().tlabAlignmentReserve;
     }
 
-    public static final LocationIdentity TLAB_SIZE_LOCATION = new NamedLocationIdentity("TlabSize");
+    public static final LocationIdentity TLAB_SIZE_LOCATION = NamedLocationIdentity.create("TlabSize");
 
     @Fold
     public static int threadTlabSizeOffset() {
         return config().threadTlabSizeOffset();
     }
 
-    public static final LocationIdentity TLAB_THREAD_ALLOCATED_BYTES_LOCATION = new NamedLocationIdentity("TlabThreadAllocatedBytes");
+    public static final LocationIdentity TLAB_THREAD_ALLOCATED_BYTES_LOCATION = NamedLocationIdentity.create("TlabThreadAllocatedBytes");
 
     @Fold
     public static int threadAllocatedBytesOffset() {
         return config().threadAllocatedBytesOffset;
     }
 
-    public static final LocationIdentity TLAB_REFILL_WASTE_LIMIT_LOCATION = new NamedLocationIdentity("RefillWasteLimit");
+    public static final LocationIdentity TLAB_REFILL_WASTE_LIMIT_LOCATION = NamedLocationIdentity.create("RefillWasteLimit");
 
     @Fold
     public static int tlabRefillWasteLimitOffset() {
         return config().tlabRefillWasteLimitOffset();
     }
 
-    public static final LocationIdentity TLAB_NOF_REFILLS_LOCATION = new NamedLocationIdentity("TlabNOfRefills");
+    public static final LocationIdentity TLAB_NOF_REFILLS_LOCATION = NamedLocationIdentity.create("TlabNOfRefills");
 
     @Fold
     public static int tlabNumberOfRefillsOffset() {
         return config().tlabNumberOfRefillsOffset();
     }
 
-    public static final LocationIdentity TLAB_FAST_REFILL_WASTE_LOCATION = new NamedLocationIdentity("TlabFastRefillWaste");
+    public static final LocationIdentity TLAB_FAST_REFILL_WASTE_LOCATION = NamedLocationIdentity.create("TlabFastRefillWaste");
 
     @Fold
     public static int tlabFastRefillWasteOffset() {
         return config().tlabFastRefillWasteOffset();
     }
 
-    public static final LocationIdentity TLAB_SLOW_ALLOCATIONS_LOCATION = new NamedLocationIdentity("TlabSlowAllocations");
+    public static final LocationIdentity TLAB_SLOW_ALLOCATIONS_LOCATION = NamedLocationIdentity.create("TlabSlowAllocations");
 
     @Fold
     public static int tlabSlowAllocationsOffset() {
@@ -818,11 +818,11 @@
         }
     }
 
-    public static final LocationIdentity OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION = new NamedLocationIdentity("ObjArrayKlass::_element_klass", true);
+    public static final LocationIdentity OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION = NamedLocationIdentity.create("ObjArrayKlass::_element_klass", true);
 
-    public static final LocationIdentity PRIMARY_SUPERS_LOCATION = new NamedLocationIdentity("PrimarySupers", true);
+    public static final LocationIdentity PRIMARY_SUPERS_LOCATION = NamedLocationIdentity.create("PrimarySupers", true);
 
-    public static final LocationIdentity METASPACE_ARRAY_LENGTH_LOCATION = new NamedLocationIdentity("MetaspaceArrayLength", true);
+    public static final LocationIdentity METASPACE_ARRAY_LENGTH_LOCATION = NamedLocationIdentity.create("MetaspaceArrayLength", true);
 
-    public static final LocationIdentity SECONDARY_SUPERS_ELEMENT_LOCATION = new NamedLocationIdentity("SecondarySupersElement", true);
+    public static final LocationIdentity SECONDARY_SUPERS_ELEMENT_LOCATION = NamedLocationIdentity.create("SecondarySupersElement", true);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java	Wed Nov 05 17:04:18 2014 +0100
@@ -369,7 +369,7 @@
      */
     private static final boolean ENABLE_BREAKPOINT = false;
 
-    private static final LocationIdentity MONITOR_COUNTER_LOCATION = new NamedLocationIdentity("MonitorCounter");
+    private static final LocationIdentity MONITOR_COUNTER_LOCATION = NamedLocationIdentity.create("MonitorCounter");
 
     @NodeIntrinsic(BreakpointNode.class)
     static native void bkpt(Object object, Word mark, Word tmp, Word value);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Wed Nov 05 17:04:18 2014 +0100
@@ -62,7 +62,7 @@
  */
 public class NewObjectSnippets implements Snippets {
 
-    public static final LocationIdentity INIT_LOCATION = new NamedLocationIdentity("Initialization");
+    public static final LocationIdentity INIT_LOCATION = NamedLocationIdentity.create("Initialization");
 
     static class Options {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java	Wed Nov 05 17:04:18 2014 +0100
@@ -63,9 +63,9 @@
                     "Number of effective G1 Post Write Barriers (after passing the NULL test)");
     private static final SnippetCounter g1ExecutedPostWriteBarrierCounter = new SnippetCounter(countersWriteBarriers, "g1ExecutedPostWriteBarrier", "Number of executed G1 Post Write Barriers");
 
-    public static final LocationIdentity GC_CARD_LOCATION = new NamedLocationIdentity("GC-Card");
-    public static final LocationIdentity GC_LOG_LOCATION = new NamedLocationIdentity("GC-Log");
-    public static final LocationIdentity GC_INDEX_LOCATION = new NamedLocationIdentity("GC-Index");
+    public static final LocationIdentity GC_CARD_LOCATION = NamedLocationIdentity.create("GC-Card");
+    public static final LocationIdentity GC_LOG_LOCATION = NamedLocationIdentity.create("GC-Log");
+    public static final LocationIdentity GC_INDEX_LOCATION = NamedLocationIdentity.create("GC-Index");
 
     @Snippet
     public static void serialWriteBarrier(Object object, Object location, @ConstantParameter boolean usePrecise) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UncommonTrapStub.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UncommonTrapStub.java	Wed Nov 05 17:04:18 2014 +0100
@@ -78,7 +78,7 @@
  */
 public class UncommonTrapStub extends SnippetStub {
 
-    public static final LocationIdentity STACK_BANG_LOCATION = new NamedLocationIdentity("stack bang");
+    public static final LocationIdentity STACK_BANG_LOCATION = NamedLocationIdentity.create("stack bang");
 
     private final TargetDescription target;
 
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java	Wed Nov 05 17:04:18 2014 +0100
@@ -40,7 +40,7 @@
  */
 public class ObjectAccessTest extends GraalCompilerTest implements Snippets {
 
-    private static final LocationIdentity ID = new NamedLocationIdentity("ID");
+    private static final LocationIdentity ID = NamedLocationIdentity.create("ObjectAccessTestID");
     private static final Kind[] KINDS = new Kind[]{Kind.Byte, Kind.Char, Kind.Short, Kind.Int, Kind.Long, Kind.Float, Kind.Double, Kind.Object};
     private final ReplacementsImpl installer;
 
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java	Wed Nov 05 17:04:18 2014 +0100
@@ -44,7 +44,7 @@
  */
 public class PointerTest extends GraalCompilerTest implements Snippets {
 
-    private static final LocationIdentity ID = new NamedLocationIdentity("ID");
+    private static final LocationIdentity ID = NamedLocationIdentity.create("ID");
     private static final Kind[] KINDS = new Kind[]{Kind.Byte, Kind.Char, Kind.Short, Kind.Int, Kind.Long, Kind.Float, Kind.Double, Kind.Object};
     private final TargetDescription target;
     private final ReplacementsImpl installer;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetCounter.java	Wed Nov 05 17:01:00 2014 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetCounter.java	Wed Nov 05 17:04:18 2014 +0100
@@ -132,7 +132,7 @@
      * usage in snippets is always possible. If a method accesses the counter via the field and the
      * snippet, the result might not be correct though.
      */
-    protected static final LocationIdentity SNIPPET_COUNTER_LOCATION = new NamedLocationIdentity("SnippetCounter");
+    protected static final LocationIdentity SNIPPET_COUNTER_LOCATION = NamedLocationIdentity.create("SnippetCounter");
 
     /**
      * Increments the value of this counter. This method can be safely used in a snippet if it is