# HG changeset patch # User Tom Rodriguez # Date 1415062168 28800 # Node ID 06bc22024f371e662c54c8a4c52f3392eb73342f # Parent 31832ebd40cf45ba15a9708bbddd37d61979f29a# Parent 95b2f8b8250e41c05eda5e4c7ce5e3be8c3c3c8d Merge diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocationIdentity.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocationIdentity.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocationIdentity.java Mon Nov 03 16:49:28 2014 -0800 @@ -37,12 +37,20 @@ LocationIdentity ANY_LOCATION = new NamedLocationIdentity("ANY_LOCATION"); /** - * Denotes the location of a value that is guaranteed to be final. + * Denotes the location of a value that is guaranteed to be unchanging. */ - LocationIdentity FINAL_LOCATION = new NamedLocationIdentity("FINAL_LOCATION"); + LocationIdentity FINAL_LOCATION = new NamedLocationIdentity("FINAL_LOCATION", true); /** * Denotes the location of the length field of a Java array. */ - LocationIdentity ARRAY_LENGTH_LOCATION = new NamedLocationIdentity("[].length"); + LocationIdentity ARRAY_LENGTH_LOCATION = new NamedLocationIdentity("[].length", true); + + /** + * Denotes a location is unchanging in all cases. Not that this is different than the Java + * notion of final which only requires definite assignment. + */ + default boolean isImmutable() { + return false; + } } diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NamedLocationIdentity.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NamedLocationIdentity.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NamedLocationIdentity.java Mon Nov 03 16:49:28 2014 -0800 @@ -31,13 +31,26 @@ 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) { this.name = name; + this.immutable = false; + } + + /** + * Creates a named unique location identity for read and write operations. + * + * @param name the name of the new location identity + */ + public NamedLocationIdentity(String name, boolean immutable) { + this.name = name; + this.immutable = immutable; } @Override @@ -45,6 +58,10 @@ return name; } + public boolean isImmutable() { + return immutable; + } + /** * Returns the named location identity for an array of the given element kind. Array accesses of * the same kind must have the same location identity unless an alias analysis guarantees that diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java Mon Nov 03 16:49:28 2014 -0800 @@ -25,7 +25,6 @@ import org.junit.*; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.nodes.*; @@ -95,7 +94,7 @@ for (FloatingReadNode node : graph.getNodes(ParameterNode.class).first().usages().filter(FloatingReadNode.class)) { // Checking that the parameter a is not directly used for the access to field // x10 (because x10 must be guarded by the checkcast). - Assert.assertTrue(node.location().getLocationIdentity() == LocationIdentity.FINAL_LOCATION); + Assert.assertTrue(node.location().getLocationIdentity().isImmutable()); } } catch (Throwable e) { throw Debug.handle(e); diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Mon Nov 03 16:49:28 2014 -0800 @@ -824,7 +824,6 @@ @HotSpotVMField(name = "Klass::_modifier_flags", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassModifierFlagsOffset; @HotSpotVMField(name = "Klass::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int klassAccessFlagsOffset; @HotSpotVMField(name = "Klass::_layout_helper", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassLayoutHelperOffset; - @HotSpotVMField(name = "Klass::_layout_helper", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassInstanceSizeOffset; @HotSpotVMConstant(name = "Klass::_lh_neutral_value") @Stable public int klassLayoutHelperNeutralValue; @HotSpotVMConstant(name = "Klass::_lh_instance_slow_path_bit") @Stable public int klassLayoutHelperInstanceSlowPathBit; diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java Mon Nov 03 16:49:28 2014 -0800 @@ -250,7 +250,7 @@ @Override protected ValueNode createReadArrayComponentHub(StructuredGraph graph, ValueNode arrayHub, FixedNode anchor) { Kind wordKind = runtime.getTarget().wordKind; - LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, runtime.getConfig().arrayClassElementOffset, graph); + LocationNode location = ConstantLocationNode.create(OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION, wordKind, runtime.getConfig().arrayClassElementOffset, graph); /* * Anchor the read of the element klass to the cfg, because it is only valid when arrayClass * is an object class, which might not be the case in other parts of the compiled method. @@ -401,7 +401,7 @@ protected ValueNode createReadHub(StructuredGraph graph, ValueNode object, GuardingNode guard) { Kind wordKind = target.wordKind; HotSpotVMConfig config = runtime.getConfig(); - LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, config.hubOffset, graph); + LocationNode location = ConstantLocationNode.create(HUB_LOCATION, wordKind, config.hubOffset, graph); assert !object.isConstant() || object.asJavaConstant().isNull(); Stamp hubStamp; @@ -421,7 +421,7 @@ private WriteNode createWriteHub(StructuredGraph graph, Kind wordKind, ValueNode object, ValueNode value) { HotSpotVMConfig config = runtime.getConfig(); - LocationNode location = ConstantLocationNode.create(HUB_LOCATION, wordKind, config.hubOffset, graph); + LocationNode location = ConstantLocationNode.create(HUB_WRITE_LOCATION, wordKind, config.hubOffset, graph); assert !object.isConstant() || object.asJavaConstant().isNull(); ValueNode writeValue = value; diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java Mon Nov 03 16:49:28 2014 -0800 @@ -23,6 +23,7 @@ package com.oracle.graal.hotspot.phases; import static com.oracle.graal.api.meta.LocationIdentity.*; +import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.nodes.ConstantNode.*; import com.oracle.graal.api.meta.*; @@ -65,7 +66,7 @@ JavaConstant klass; LocationNode location; if (type instanceof HotSpotResolvedObjectType) { - location = ConstantLocationNode.create(FINAL_LOCATION, Kind.Object, classMirrorOffset, graph); + location = ConstantLocationNode.create(CLASS_MIRROR_LOCATION, Kind.Object, classMirrorOffset, graph); klass = ((HotSpotResolvedObjectType) type).klass(); } else { /* diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java Mon Nov 03 16:49:28 2014 -0800 @@ -27,7 +27,6 @@ import java.lang.reflect.*; -import com.oracle.graal.api.meta.*; import com.oracle.graal.api.replacements.*; import com.oracle.graal.hotspot.nodes.*; import com.oracle.graal.nodes.calc.*; @@ -48,7 +47,7 @@ // Class for primitive type return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC; } else { - return klass.readInt(klassModifierFlagsOffset(), LocationIdentity.FINAL_LOCATION); + return klass.readInt(klassModifierFlagsOffset(), KLASS_MODIFIER_FLAGS_LOCATION); } } @@ -59,7 +58,7 @@ if (klass.equal(0)) { return false; } else { - int accessFlags = klass.readInt(klassAccessFlagsOffset(), LocationIdentity.FINAL_LOCATION); + int accessFlags = klass.readInt(klassAccessFlagsOffset(), KLASS_ACCESS_FLAGS_LOCATION); return (accessFlags & Modifier.INTERFACE) != 0; } } @@ -90,16 +89,16 @@ public static Class getSuperclass(final Class thisObj) { Word klass = loadWordFromObject(thisObj, klassOffset()); if (klass.notEqual(0)) { - int accessFlags = klass.readInt(klassAccessFlagsOffset(), LocationIdentity.FINAL_LOCATION); + int accessFlags = klass.readInt(klassAccessFlagsOffset(), KLASS_ACCESS_FLAGS_LOCATION); if ((accessFlags & Modifier.INTERFACE) == 0) { if (klassIsArray(klass)) { return Object.class; } else { - Word superKlass = klass.readWord(klassSuperKlassOffset(), LocationIdentity.FINAL_LOCATION); + Word superKlass = klass.readWord(klassSuperKlassOffset(), KLASS_SUPER_KLASS_LOCATION); if (superKlass.equal(0)) { return null; } else { - return piCastExactNonNull(superKlass.readObject(classMirrorOffset(), LocationIdentity.FINAL_LOCATION), Class.class); + return piCastExactNonNull(superKlass.readObject(classMirrorOffset(), CLASS_MIRROR_LOCATION), Class.class); } } } @@ -113,7 +112,7 @@ Word klass = loadWordFromObject(thisObj, klassOffset()); if (klass.notEqual(0)) { if (klassIsArray(klass)) { - return piCastExactNonNull(klass.readObject(arrayKlassComponentMirrorOffset(), LocationIdentity.FINAL_LOCATION), Class.class); + return piCastExactNonNull(klass.readObject(arrayKlassComponentMirrorOffset(), ARRAY_KLASS_COMPONENT_MIRROR), Class.class); } } return null; diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Mon Nov 03 16:49:28 2014 -0800 @@ -232,11 +232,15 @@ return result; } + public static final LocationIdentity JAVA_THREAD_THREAD_OBJECT_LOCATION = new NamedLocationIdentity("JavaThread::_threadObj"); + @Fold public static int threadObjectOffset() { return config().threadObjectOffset; } + public static final LocationIdentity JAVA_THREAD_OSTHREAD_LOCATION = new NamedLocationIdentity("JavaThread::_osthread"); + @Fold public static int osThreadOffset() { return config().osThreadOffset; @@ -279,18 +283,22 @@ return config().arrayPrototypeMarkWord(); } + public static final LocationIdentity KLASS_ACCESS_FLAGS_LOCATION = new NamedLocationIdentity("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); + @Fold public static int klassLayoutHelperOffset() { return config().klassLayoutHelperOffset; } public static int readLayoutHelper(Word hub) { - return hub.readInt(klassLayoutHelperOffset(), LocationIdentity.FINAL_LOCATION); + return hub.readInt(klassLayoutHelperOffset(), KLASS_LAYOUT_HELPER_LOCATION); } /** @@ -311,11 +319,15 @@ return (layoutHelper < layoutHelperNeutralValue); } + public static final LocationIdentity ARRAY_KLASS_COMPONENT_MIRROR = new NamedLocationIdentity("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); + @Fold public static int klassSuperKlassOffset() { return config().klassSuperKlassOffset; @@ -328,7 +340,9 @@ return config().markOffset; } - public static final LocationIdentity HUB_LOCATION = new NamedLocationIdentity("Hub"); + public static final LocationIdentity HUB_WRITE_LOCATION = new NamedLocationIdentity("Hub"); + + public static final LocationIdentity HUB_LOCATION = new NamedLocationIdentity("Hub", true); @Fold private static int hubOffset() { @@ -465,6 +479,8 @@ return config().g1SATBQueueBufferOffset(); } + public static final LocationIdentity KLASS_SUPER_CHECK_OFFSET_LOCATION = new NamedLocationIdentity("Klass::_super_check_offset", true); + @Fold public static int superCheckOffsetOffset() { return config().superCheckOffsetOffset; @@ -607,6 +623,8 @@ return hub.readByte(instanceKlassInitStateOffset(), CLASS_STATE_LOCATION); } + public static final LocationIdentity KLASS_MODIFIER_FLAGS_LOCATION = new NamedLocationIdentity("Klass::_modifier_flags", true); + @Fold public static int klassModifierFlagsOffset() { return config().klassModifierFlagsOffset; @@ -629,16 +647,13 @@ return config().instanceKlassNodeClassOffset; } + public static final LocationIdentity CLASS_MIRROR_LOCATION = new NamedLocationIdentity("Klass::_java_mirror", true); + @Fold public static int classMirrorOffset() { return config().classMirrorOffset; } - @Fold - public static int klassInstanceSizeOffset() { - return config().klassInstanceSizeOffset; - } - public static final LocationIdentity HEAP_TOP_LOCATION = new NamedLocationIdentity("HeapTop"); @Fold @@ -802,4 +817,12 @@ throw new GraalInternalError(e); } } + + public static final LocationIdentity OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION = new NamedLocationIdentity("ObjArrayKlass::_element_klass", true); + + public static final LocationIdentity PRIMARY_SUPERS_LOCATION = new NamedLocationIdentity("PrimarySupers", true); + + public static final LocationIdentity METASPACE_ARRAY_LENGTH_LOCATION = new NamedLocationIdentity("MetaspaceArrayLength", true); + + public static final LocationIdentity SECONDARY_SUPERS_ELEMENT_LOCATION = new NamedLocationIdentity("SecondarySupersElement", true); } diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java Mon Nov 03 16:49:28 2014 -0800 @@ -141,7 +141,7 @@ } GuardingNode anchorNode = SnippetAnchorNode.anchor(); Word objectHub = loadHubIntrinsic(object, getWordKind(), anchorNode); - if (probability(NOT_LIKELY_PROBABILITY, objectHub.readWord(superCheckOffset, LocationIdentity.FINAL_LOCATION).notEqual(hub))) { + if (probability(NOT_LIKELY_PROBABILITY, objectHub.readWord(superCheckOffset, PRIMARY_SUPERS_LOCATION).notEqual(hub))) { displayMiss.inc(); return falseValue; } diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectSubstitutions.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectSubstitutions.java Mon Nov 03 16:49:28 2014 -0800 @@ -25,7 +25,6 @@ import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.nodes.PiNode.*; -import com.oracle.graal.api.meta.*; import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; @@ -41,7 +40,7 @@ @MethodSubstitution(isStatic = false, forced = true) public static Class getClass(final Object thisObj) { Word hub = loadHub(thisObj); - return piCastExactNonNull(hub.readObject(Word.signed(classMirrorOffset()), LocationIdentity.FINAL_LOCATION), Class.class); + return piCastExactNonNull(hub.readObject(Word.signed(classMirrorOffset()), CLASS_MIRROR_LOCATION), Class.class); } @MethodSubstitution(isStatic = false) diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java Mon Nov 03 16:49:28 2014 -0800 @@ -45,15 +45,15 @@ @MethodSubstitution public static Thread currentThread() { - return PiNode.piCastNonNull(CurrentJavaThreadNode.get(getWordKind()).readObject(threadObjectOffset(), LocationIdentity.FINAL_LOCATION), Thread.class); + return PiNode.piCastNonNull(CurrentJavaThreadNode.get(getWordKind()).readObject(threadObjectOffset(), JAVA_THREAD_THREAD_OBJECT_LOCATION), Thread.class); } @MethodSubstitution(isStatic = false) public static boolean isInterrupted(final Thread thisObject, boolean clearInterrupted) { Word javaThread = CurrentJavaThreadNode.get(getWordKind()); - Object thread = javaThread.readObject(threadObjectOffset(), LocationIdentity.FINAL_LOCATION); + Object thread = javaThread.readObject(threadObjectOffset(), JAVA_THREAD_THREAD_OBJECT_LOCATION); if (thisObject == thread) { - Word osThread = javaThread.readWord(osThreadOffset(), LocationIdentity.FINAL_LOCATION); + Word osThread = javaThread.readWord(osThreadOffset(), JAVA_THREAD_OSTHREAD_LOCATION); boolean interrupted = osThread.readInt(osThreadInterruptedOffset(), ANY_LOCATION) != 0; if (!interrupted || !clearInterrupted) { return interrupted; diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java Mon Nov 03 16:49:28 2014 -0800 @@ -42,8 +42,6 @@ */ public class TypeCheckSnippetUtils { - public static final LocationIdentity TYPE_DISPLAY_LOCATION = new NamedLocationIdentity("TypeDisplay"); - static boolean checkSecondarySubType(Word t, Word s) { // if (S.cache == T) return true if (s.readWord(secondarySuperCacheOffset(), SECONDARY_SUPER_CACHE_LOCATION).equal(t)) { @@ -56,11 +54,11 @@ static boolean checkUnknownSubType(Word t, Word s) { // int off = T.offset - int superCheckOffset = t.readInt(superCheckOffsetOffset(), LocationIdentity.FINAL_LOCATION); + int superCheckOffset = t.readInt(superCheckOffsetOffset(), KLASS_SUPER_CHECK_OFFSET_LOCATION); boolean primary = superCheckOffset != secondarySuperCacheOffset(); // if (T = S[off]) return true - if (s.readWord(superCheckOffset, TYPE_DISPLAY_LOCATION).equal(t)) { + if (s.readWord(superCheckOffset, PRIMARY_SUPERS_LOCATION).equal(t)) { if (primary) { cacheHit.inc(); } else { @@ -87,7 +85,7 @@ // if (S.scan_s_s_array(T)) { S.cache = T; return true; } Word secondarySupers = s.readWord(secondarySupersOffset(), SECONDARY_SUPERS_LOCATION); - int length = secondarySupers.readInt(metaspaceArrayLengthOffset(), LocationIdentity.FINAL_LOCATION); + int length = secondarySupers.readInt(metaspaceArrayLengthOffset(), METASPACE_ARRAY_LENGTH_LOCATION); for (int i = 0; i < length; i++) { if (probability(NOT_LIKELY_PROBABILITY, t.equal(loadSecondarySupersElement(secondarySupers, i)))) { s.writeWord(secondarySuperCacheOffset(), t, SECONDARY_SUPER_CACHE_LOCATION); @@ -141,7 +139,7 @@ } static Word loadSecondarySupersElement(Word metaspaceArray, int index) { - return metaspaceArray.readWord(metaspaceArrayBaseOffset() + index * wordSize(), LocationIdentity.FINAL_LOCATION); + return metaspaceArray.readWord(metaspaceArrayBaseOffset() + index * wordSize(), SECONDARY_SUPERS_ELEMENT_LOCATION); } private static final SnippetCounter.Group counters = SnippetCounters.getValue() ? new SnippetCounter.Group("TypeCheck") : null; diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java Mon Nov 03 16:49:28 2014 -0800 @@ -83,7 +83,7 @@ */ @Snippet private static Object newArray(Word hub, int length, @ConstantParameter Word intArrayHub, @ConstantParameter Register threadRegister) { - int layoutHelper = hub.readInt(klassLayoutHelperOffset(), LocationIdentity.FINAL_LOCATION); + int layoutHelper = hub.readInt(klassLayoutHelperOffset(), KLASS_LAYOUT_HELPER_LOCATION); int log2ElementSize = (layoutHelper >> layoutHelperLog2ElementSizeShift()) & layoutHelperLog2ElementSizeMask(); int headerSize = (layoutHelper >> layoutHelperHeaderSizeShift()) & layoutHelperHeaderSizeMask(); int elementKind = (layoutHelper >> layoutHelperElementTypeShift()) & layoutHelperElementTypeMask(); diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java Mon Nov 03 16:49:28 2014 -0800 @@ -96,7 +96,11 @@ */ @Snippet private static Object newInstance(Word hub, @ConstantParameter Word intArrayHub, @ConstantParameter Register threadRegister) { - int sizeInBytes = hub.readInt(klassInstanceSizeOffset(), LocationIdentity.FINAL_LOCATION); + /* + * The type is known to be an instance so Klass::_layout_helper is the instance size as a + * raw number + */ + int sizeInBytes = hub.readInt(klassLayoutHelperOffset(), KLASS_LAYOUT_HELPER_LOCATION); Word thread = registerAsWord(threadRegister); if (!forceSlowPath() && inlineContiguousAllocationSupported()) { if (isInstanceKlassFullyInitialized(hub)) { diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryMapNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryMapNode.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryMapNode.java Mon Nov 03 16:49:28 2014 -0800 @@ -73,7 +73,7 @@ } public MemoryNode getLastLocationAccess(LocationIdentity locationIdentity) { - if (locationIdentity == FINAL_LOCATION) { + if (locationIdentity.isImmutable()) { return null; } else { int index = locationIdentities.indexOf(locationIdentity); diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Mon Nov 03 16:49:28 2014 -0800 @@ -120,8 +120,7 @@ MetaAccessProvider metaAccess = tool.getMetaAccess(); if (tool.canonicalizeReads()) { if (metaAccess != null && object != null && object.isConstant()) { - if ((location.getLocationIdentity() == LocationIdentity.FINAL_LOCATION || location.getLocationIdentity() == LocationIdentity.ARRAY_LENGTH_LOCATION) && - location instanceof ConstantLocationNode) { + if ((location.getLocationIdentity().isImmutable()) && location instanceof ConstantLocationNode) { long displacement = ((ConstantLocationNode) location).getDisplacement(); JavaConstant base = object.asJavaConstant(); if (base != null) { diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java Mon Nov 03 16:49:28 2014 -0800 @@ -67,7 +67,7 @@ @Override public MemoryNode getLastLocationAccess(LocationIdentity locationIdentity) { MemoryNode lastLocationAccess; - if (locationIdentity == FINAL_LOCATION) { + if (locationIdentity.isImmutable()) { return null; } else { lastLocationAccess = lastMemorySnapshot.get(locationIdentity); @@ -157,7 +157,7 @@ for (MemoryMap other : states) { keys.addAll(other.getLocations()); } - assert !keys.contains(FINAL_LOCATION); + assert checkNoImmutableLocations(keys); Map existingPhis = null; if (updateExistingPhis) { @@ -209,6 +209,13 @@ } + private static boolean checkNoImmutableLocations(Set keys) { + keys.forEach(t -> { + assert !t.isImmutable(); + }); + return true; + } + public static class CollectMemoryCheckpointsClosure extends NodeIteratorClosure> { private final Map> modifiedInLoops; @@ -254,7 +261,7 @@ exit.addAll(modifiedLocations); exit.addAll(initialState); } - assert !modifiedLocations.contains(FINAL_LOCATION); + assert checkNoImmutableLocations(modifiedLocations); modifiedInLoops.put(loop, modifiedLocations); return loopInfo.exitStates; } diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Mon Nov 03 16:49:28 2014 -0800 @@ -437,7 +437,7 @@ break; case LATEST: case LATEST_OUT_OF_LOOPS: - boolean scheduleRead = memsched == MemoryScheduling.OPTIMAL && node instanceof FloatingReadNode && ((FloatingReadNode) node).location().getLocationIdentity() != FINAL_LOCATION; + boolean scheduleRead = memsched == MemoryScheduling.OPTIMAL && node instanceof FloatingReadNode && !((FloatingReadNode) node).location().getLocationIdentity().isImmutable(); if (scheduleRead) { FloatingReadNode read = (FloatingReadNode) node; block = optimalBlock(read, strategy); @@ -508,7 +508,7 @@ assert memsched == MemoryScheduling.OPTIMAL; LocationIdentity locid = n.location().getLocationIdentity(); - assert locid != FINAL_LOCATION; + assert !locid.isImmutable(); Block upperBoundBlock = blockForMemoryNode(n.getLastLocationAccess()); Block earliestBlock = earliestBlock(n); @@ -996,7 +996,7 @@ for (ScheduledNode i : instructions) { if (i instanceof FloatingReadNode) { FloatingReadNode frn = (FloatingReadNode) i; - if (frn.location().getLocationIdentity() != FINAL_LOCATION) { + if (!frn.location().getLocationIdentity().isImmutable()) { state.addRead(frn); if (nodesFor(b).contains(frn.getLastLocationAccess())) { assert !state.isBeforeLastLocation(frn); @@ -1043,7 +1043,7 @@ private void processKillLocation(Node node, LocationIdentity identity, SortState state) { for (FloatingReadNode frn : state.readsSnapshot()) { LocationIdentity readLocation = frn.location().getLocationIdentity(); - assert readLocation != FINAL_LOCATION; + assert !readLocation.isImmutable(); if (frn.getLastLocationAccess() == node) { assert identity == ANY_LOCATION || readLocation == identity || node instanceof MemoryCheckpoint.Multi : "location doesn't match: " + readLocation + ", " + identity; state.clearBeforeLastLocation(frn); diff -r 95b2f8b8250e -r 06bc22024f37 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Tue Nov 04 00:13:30 2014 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Mon Nov 03 16:49:28 2014 -0800 @@ -952,7 +952,7 @@ for (Node usage : oldNode.usages().snapshot()) { LocationIdentity identity = getLocationIdentity(usage); boolean usageReplaced = false; - if (identity != null && identity != FINAL_LOCATION) { + if (identity != null && !identity.isImmutable()) { // lastLocationAccess points into the snippet graph. find a proper // MemoryCheckPoint inside the snippet graph MemoryNode lastAccess = mmap.getLastLocationAccess(identity);