# HG changeset patch # User Doug Simon # Date 1369253610 -7200 # Node ID d734ee4f97382d04970f9652a8d120b11fe3e300 # Parent 7f92277c3a374b916495281eb418eec1500a4e33# Parent e92fdf3e155883083119adfab976d623e7f9a11a Merge. diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocationIdentity.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocationIdentity.java Wed May 22 22:13:30 2013 +0200 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.api.meta; + +/** + * Marker interface for location identities. Apart from the special values {@link #ANY_LOCATION} and + * {@link #FINAL_LOCATION}, a different location identity of two memory accesses guarantees that the + * two accesses do not interfere. + */ +public interface LocationIdentity { + + /** + * Denotes any location. A write to such a location kills all values in a memory map during an + * 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"); + + /** + * Denotes the location of a value that is guaranteed to be final. + */ + LocationIdentity FINAL_LOCATION = new NamedLocationIdentity("FINAL_LOCATION"); + +} diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Wed May 22 22:13:30 2013 +0200 @@ -96,8 +96,15 @@ Constant readUnsafeConstant(Kind kind, Object base, long displacement); /** - * Determines if a given foreign call has a side-effect. Deoptimization cannot return execution - * to a point before a foreign call that has a side effect. + * Determines if a given foreign call is side-effect free. Deoptimization cannot return + * execution to a point before a foreign call that has a side effect. */ - boolean hasSideEffect(ForeignCallDescriptor descriptor); + boolean isReexecutable(ForeignCallDescriptor descriptor); + + /** + * Gets the set of memory locations killed by a given foreign call. Returning the special value + * {@link LocationIdentity#ANY_LOCATION} denotes that the call kills all memory locations. + * Returning any empty array denotes that the call does not kill any memory locations. + */ + LocationIdentity[] getKilledLocationIdentities(ForeignCallDescriptor descriptor); } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NamedLocationIdentity.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NamedLocationIdentity.java Wed May 22 22:13:30 2013 +0200 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.api.meta; + +import java.util.*; + +/** + * A {@link LocationIdentity} with a name. + */ +public class NamedLocationIdentity implements LocationIdentity { + + protected final String name; + + /** + * 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; + } + + @Override + public String toString() { + return name; + } + + /** + * 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 + * two distinct arrays are accessed. + */ + public static LocationIdentity getArrayLocation(Kind elementKind) { + return ARRAY_LOCATIONS.get(elementKind); + } + + private static final EnumMap ARRAY_LOCATIONS = initArrayLocations(); + + private static EnumMap initArrayLocations() { + EnumMap result = new EnumMap<>(Kind.class); + for (Kind kind : Kind.values()) { + result.put(kind, new NamedLocationIdentity("Array: " + kind.getJavaName())); + } + return result; + } +} diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java Wed May 22 22:13:30 2013 +0200 @@ -25,6 +25,7 @@ import org.junit.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; import com.oracle.graal.debug.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; @@ -95,7 +96,7 @@ for (FloatingReadNode node : graph.getNodes(LocalNode.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() == LocationNode.FINAL_LOCATION); + Assert.assertTrue(node.location().getLocationIdentity() == LocationIdentity.FINAL_LOCATION); } } }); diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/WriteBarrierVerificationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/WriteBarrierVerificationTest.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/WriteBarrierVerificationTest.java Wed May 22 22:13:30 2013 +0200 @@ -33,7 +33,6 @@ import com.oracle.graal.debug.internal.*; import com.oracle.graal.hotspot.phases.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.phases.*; diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java Wed May 22 22:13:30 2013 +0200 @@ -24,6 +24,7 @@ import static com.oracle.graal.amd64.AMD64.*; import static com.oracle.graal.api.code.CallingConvention.Type.*; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.api.meta.Value.*; import static com.oracle.graal.hotspot.HotSpotBackend.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.*; @@ -60,14 +61,14 @@ RegisterValue exception = rax.asValue(Kind.Object); RegisterValue exceptionPc = rdx.asValue(word); CallingConvention exceptionCc = new CallingConvention(0, ILLEGAL, exception, exceptionPc); - register(new HotSpotForeignCallLinkage(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF, exceptionCc)); - register(new HotSpotForeignCallLinkage(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF, exceptionCc)); + register(new HotSpotForeignCallLinkage(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF, exceptionCc, NOT_REEXECUTABLE, ANY_LOCATION)); + register(new HotSpotForeignCallLinkage(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF, exceptionCc, NOT_REEXECUTABLE, ANY_LOCATION)); // The x86 crypto stubs do callee saving - registerForeignCall(ENCRYPT_BLOCK, config.aescryptEncryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF); - registerForeignCall(DECRYPT_BLOCK, config.aescryptDecryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF); - registerForeignCall(ENCRYPT, config.cipherBlockChainingEncryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF); - registerForeignCall(DECRYPT, config.cipherBlockChainingDecryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF); + registerForeignCall(ENCRYPT_BLOCK, config.aescryptEncryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION); + registerForeignCall(DECRYPT_BLOCK, config.aescryptDecryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION); + registerForeignCall(ENCRYPT, config.cipherBlockChainingEncryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION); + registerForeignCall(DECRYPT, config.cipherBlockChainingDecryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION); convertSnippets = new AMD64ConvertSnippets.Templates(this, replacements, graalRuntime.getTarget()); super.registerReplacements(replacements); diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkage.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkage.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkage.java Wed May 22 22:13:30 2013 +0200 @@ -88,11 +88,18 @@ private final Transition transition; /** - * The locations defined/killed by the call. + * The registers and stack slots defined/killed by the call. */ private Value[] temporaries = AllocatableValue.NONE; /** + * The memory locations killed by the call. + */ + private final LocationIdentity[] killedLocations; + + private final boolean reexecutable; + + /** * Creates a {@link HotSpotForeignCallLinkage}. * * @param descriptor the descriptor of the call @@ -101,10 +108,15 @@ * temporaries which are always destroyed) * @param ccType calling convention type * @param transition specifies if this is a {@linkplain #isLeaf() leaf} call + * @param reexecutable specifies if the call can be re-executed without (meaningful) side + * effects. Deoptimization will not return to a point before a call that cannot be + * re-executed. + * @param killedLocations the memory locations killed by the call */ - public static HotSpotForeignCallLinkage create(ForeignCallDescriptor descriptor, long address, RegisterEffect effect, Type ccType, Transition transition) { + public static HotSpotForeignCallLinkage create(ForeignCallDescriptor descriptor, long address, RegisterEffect effect, Type ccType, Transition transition, boolean reexecutable, + LocationIdentity... killedLocations) { CallingConvention targetCc = createCallingConvention(descriptor, ccType); - return new HotSpotForeignCallLinkage(descriptor, address, effect, transition, targetCc); + return new HotSpotForeignCallLinkage(descriptor, address, effect, transition, targetCc, reexecutable, killedLocations); } /** @@ -130,12 +142,15 @@ } } - public HotSpotForeignCallLinkage(ForeignCallDescriptor descriptor, long address, RegisterEffect effect, Transition transition, CallingConvention cc) { + public HotSpotForeignCallLinkage(ForeignCallDescriptor descriptor, long address, RegisterEffect effect, Transition transition, CallingConvention cc, boolean reexecutable, + LocationIdentity... killedLocations) { this.address = address; this.effect = effect; this.transition = transition; this.descriptor = descriptor; this.cc = cc; + this.reexecutable = reexecutable; + this.killedLocations = killedLocations; } @Override @@ -153,6 +168,14 @@ return sb.toString(); } + public boolean isReexecutable() { + return reexecutable; + } + + public LocationIdentity[] getKilledLocations() { + return killedLocations; + } + public CallingConvention getCallingConvention() { return cc; } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Wed May 22 22:13:30 2013 +0200 @@ -31,7 +31,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.hotspot.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.phases.*; import com.oracle.graal.replacements.*; diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Wed May 22 22:13:30 2013 +0200 @@ -26,6 +26,7 @@ import static com.oracle.graal.api.code.DeoptimizationAction.*; import static com.oracle.graal.api.code.MemoryBarriers.*; import static com.oracle.graal.api.meta.DeoptimizationReason.*; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.graph.UnsafeAccess.*; import static com.oracle.graal.hotspot.HotSpotBackend.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*; @@ -38,6 +39,7 @@ import static com.oracle.graal.hotspot.nodes.VMErrorNode.*; import static com.oracle.graal.hotspot.nodes.WriteBarrierPostStubCall.*; import static com.oracle.graal.hotspot.nodes.WriteBarrierPreStubCall.*; +import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.hotspot.replacements.MonitorSnippets.*; import static com.oracle.graal.hotspot.replacements.SystemSubstitutions.*; import static com.oracle.graal.hotspot.replacements.ThreadSubstitutions.*; @@ -190,18 +192,29 @@ /** * Creates and registers the details for linking a foreign call to a {@link Stub}. + * + * @param reexecutable specifies if the stub call can be re-executed without (meaningful) side + * effects. Deoptimization will not return to a point before a stub call that cannot + * be re-executed. + * @param killedLocations the memory locations killed by the stub call */ - protected HotSpotForeignCallLinkage registerStubCall(ForeignCallDescriptor descriptor) { - return register(HotSpotForeignCallLinkage.create(descriptor, 0L, PRESERVES_REGISTERS, JavaCallee, NOT_LEAF)); + protected HotSpotForeignCallLinkage registerStubCall(ForeignCallDescriptor descriptor, boolean reexecutable, LocationIdentity... killedLocations) { + return register(HotSpotForeignCallLinkage.create(descriptor, 0L, PRESERVES_REGISTERS, JavaCallee, NOT_LEAF, reexecutable, killedLocations)); } /** * Creates and registers the linkage for a foreign call. + * + * @param reexecutable specifies if the stub call can be re-executed without (meaningful) side + * effects. Deoptimization will not return to a point before a stub call that cannot + * be re-executed. + * @param killedLocations the memory locations killed by the stub call */ - protected HotSpotForeignCallLinkage registerForeignCall(ForeignCallDescriptor descriptor, long address, CallingConvention.Type ccType, RegisterEffect effect, Transition transition) { + protected HotSpotForeignCallLinkage registerForeignCall(ForeignCallDescriptor descriptor, long address, CallingConvention.Type ccType, RegisterEffect effect, Transition transition, + boolean reexecutable, LocationIdentity... killedLocations) { Class resultType = descriptor.getResultType(); assert resultType.isPrimitive() || Word.class.isAssignableFrom(resultType) : "foreign calls must return objects in thread local storage: " + descriptor; - return register(HotSpotForeignCallLinkage.create(descriptor, address, effect, ccType, transition)); + return register(HotSpotForeignCallLinkage.create(descriptor, address, effect, ccType, transition, reexecutable, killedLocations)); } private static void link(Stub stub) { @@ -215,9 +228,13 @@ * @param address the address of the code to call * @param prependThread true if the JavaThread value for the current thread is to be prepended * to the arguments for the call to {@code address} + * @param reexecutable specifies if the foreign call can be re-executed without (meaningful) + * side effects. Deoptimization will not return to a point before a foreign call that + * cannot be re-executed. + * @param killedLocations the memory locations killed by the foreign call */ - private void linkForeignCall(ForeignCallDescriptor descriptor, long address, boolean prependThread, Replacements replacements) { - ForeignCallStub stub = new ForeignCallStub(address, descriptor, prependThread, this, replacements); + private void linkForeignCall(Replacements replacements, ForeignCallDescriptor descriptor, long address, boolean prependThread, boolean reexecutable, LocationIdentity... killedLocations) { + ForeignCallStub stub = new ForeignCallStub(this, replacements, address, descriptor, prependThread, reexecutable, killedLocations); HotSpotForeignCallLinkage linkage = stub.getLinkage(); HotSpotForeignCallLinkage targetLinkage = stub.getTargetLinkage(); linkage.setCompiledStub(stub); @@ -225,78 +242,86 @@ register(targetLinkage); } - public void registerReplacements(Replacements replacements) { + public static final boolean PREPEND_THREAD = true; + public static final boolean DONT_PREPEND_THREAD = !PREPEND_THREAD; + + public static final boolean REEXECUTABLE = true; + public static final boolean NOT_REEXECUTABLE = !REEXECUTABLE; + + public static final LocationIdentity[] NO_LOCATIONS = {}; + + public void registerReplacements(Replacements r) { HotSpotVMConfig c = config; TargetDescription target = getTarget(); - registerForeignCall(UNCOMMON_TRAP, c.uncommonTrapStub, NativeCall, PRESERVES_REGISTERS, LEAF); - registerForeignCall(DEOPT_HANDLER, c.handleDeoptStub, NativeCall, PRESERVES_REGISTERS, LEAF); - registerForeignCall(IC_MISS_HANDLER, c.inlineCacheMissStub, NativeCall, PRESERVES_REGISTERS, LEAF); + registerForeignCall(UNCOMMON_TRAP, c.uncommonTrapStub, NativeCall, PRESERVES_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); + registerForeignCall(DEOPT_HANDLER, c.handleDeoptStub, NativeCall, PRESERVES_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); + registerForeignCall(IC_MISS_HANDLER, c.inlineCacheMissStub, NativeCall, PRESERVES_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); - registerForeignCall(JAVA_TIME_MILLIS, c.javaTimeMillisAddress, NativeCall, DESTROYS_REGISTERS, LEAF); - registerForeignCall(JAVA_TIME_NANOS, c.javaTimeNanosAddress, NativeCall, DESTROYS_REGISTERS, LEAF); - registerForeignCall(ARITHMETIC_SIN, c.arithmeticSinAddress, NativeCall, DESTROYS_REGISTERS, LEAF); - registerForeignCall(ARITHMETIC_COS, c.arithmeticCosAddress, NativeCall, DESTROYS_REGISTERS, LEAF); - registerForeignCall(ARITHMETIC_TAN, c.arithmeticTanAddress, NativeCall, DESTROYS_REGISTERS, LEAF); + registerForeignCall(JAVA_TIME_MILLIS, c.javaTimeMillisAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); + registerForeignCall(JAVA_TIME_NANOS, c.javaTimeNanosAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); + registerForeignCall(ARITHMETIC_SIN, c.arithmeticSinAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); + registerForeignCall(ARITHMETIC_COS, c.arithmeticCosAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); + registerForeignCall(ARITHMETIC_TAN, c.arithmeticTanAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); - registerForeignCall(EXCEPTION_HANDLER_FOR_PC, c.exceptionHandlerForPcAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF); - registerForeignCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, c.exceptionHandlerForReturnAddressAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF); - registerForeignCall(NEW_ARRAY_C, c.newArrayAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF); - registerForeignCall(NEW_INSTANCE_C, c.newInstanceAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF); - registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF); + registerForeignCall(EXCEPTION_HANDLER_FOR_PC, c.exceptionHandlerForPcAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); + registerForeignCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, c.exceptionHandlerForReturnAddressAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); + registerForeignCall(NEW_ARRAY_C, c.newArrayAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); + registerForeignCall(NEW_INSTANCE_C, c.newInstanceAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); + registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, NO_LOCATIONS); - link(new NewInstanceStub(this, replacements, target, registerStubCall(NEW_INSTANCE))); - link(new NewArrayStub(this, replacements, target, registerStubCall(NEW_ARRAY))); - link(new ExceptionHandlerStub(this, replacements, target, foreignCalls.get(EXCEPTION_HANDLER))); - link(new UnwindExceptionToCallerStub(this, replacements, target, registerStubCall(UNWIND_EXCEPTION_TO_CALLER))); - link(new VerifyOopStub(this, replacements, target, registerStubCall(VERIFY_OOP))); + link(new NewInstanceStub(this, r, target, registerStubCall(NEW_INSTANCE, REEXECUTABLE, ANY_LOCATION))); + link(new NewArrayStub(this, r, target, registerStubCall(NEW_ARRAY, REEXECUTABLE, ANY_LOCATION))); + link(new ExceptionHandlerStub(this, r, target, foreignCalls.get(EXCEPTION_HANDLER))); + link(new UnwindExceptionToCallerStub(this, r, target, registerStubCall(UNWIND_EXCEPTION_TO_CALLER, NOT_REEXECUTABLE, ANY_LOCATION))); + link(new VerifyOopStub(this, r, target, registerStubCall(VERIFY_OOP, REEXECUTABLE, NO_LOCATIONS))); - linkForeignCall(IDENTITY_HASHCODE, c.identityHashCodeAddress, true, replacements); - linkForeignCall(REGISTER_FINALIZER, c.registerFinalizerAddress, true, replacements); - linkForeignCall(CREATE_NULL_POINTER_EXCEPTION, c.createNullPointerExceptionAddress, true, replacements); - linkForeignCall(CREATE_OUT_OF_BOUNDS_EXCEPTION, c.createOutOfBoundsExceptionAddress, true, replacements); - linkForeignCall(MONITORENTER, c.monitorenterAddress, true, replacements); - linkForeignCall(MONITOREXIT, c.monitorexitAddress, true, replacements); - linkForeignCall(WRITE_BARRIER_PRE, c.writeBarrierPreAddress, true, replacements); - linkForeignCall(WRITE_BARRIER_POST, c.writeBarrierPostAddress, true, replacements); - linkForeignCall(NEW_MULTI_ARRAY, c.newMultiArrayAddress, true, replacements); - linkForeignCall(LOG_PRINTF, c.logPrintfAddress, true, replacements); - linkForeignCall(LOG_OBJECT, c.logObjectAddress, true, replacements); - linkForeignCall(LOG_PRIMITIVE, c.logPrimitiveAddress, true, replacements); - linkForeignCall(THREAD_IS_INTERRUPTED, c.threadIsInterruptedAddress, true, replacements); - linkForeignCall(VM_ERROR, c.vmErrorAddress, true, replacements); - linkForeignCall(OSR_MIGRATION_END, c.osrMigrationEndAddress, false, replacements); + linkForeignCall(r, IDENTITY_HASHCODE, c.identityHashCodeAddress, PREPEND_THREAD, NOT_REEXECUTABLE, MARK_WORD_LOCATION); + linkForeignCall(r, REGISTER_FINALIZER, c.registerFinalizerAddress, PREPEND_THREAD, NOT_REEXECUTABLE, ANY_LOCATION); + linkForeignCall(r, CREATE_NULL_POINTER_EXCEPTION, c.createNullPointerExceptionAddress, PREPEND_THREAD, REEXECUTABLE, ANY_LOCATION); + linkForeignCall(r, CREATE_OUT_OF_BOUNDS_EXCEPTION, c.createOutOfBoundsExceptionAddress, PREPEND_THREAD, REEXECUTABLE, ANY_LOCATION); + linkForeignCall(r, MONITORENTER, c.monitorenterAddress, PREPEND_THREAD, NOT_REEXECUTABLE, ANY_LOCATION); + linkForeignCall(r, MONITOREXIT, c.monitorexitAddress, PREPEND_THREAD, NOT_REEXECUTABLE, ANY_LOCATION); + linkForeignCall(r, WRITE_BARRIER_PRE, c.writeBarrierPreAddress, PREPEND_THREAD, NOT_REEXECUTABLE, ANY_LOCATION); + linkForeignCall(r, WRITE_BARRIER_POST, c.writeBarrierPostAddress, PREPEND_THREAD, NOT_REEXECUTABLE, ANY_LOCATION); + linkForeignCall(r, NEW_MULTI_ARRAY, c.newMultiArrayAddress, PREPEND_THREAD, NOT_REEXECUTABLE, ANY_LOCATION); + linkForeignCall(r, LOG_PRINTF, c.logPrintfAddress, PREPEND_THREAD, REEXECUTABLE, NO_LOCATIONS); + linkForeignCall(r, LOG_OBJECT, c.logObjectAddress, PREPEND_THREAD, REEXECUTABLE, NO_LOCATIONS); + linkForeignCall(r, LOG_PRIMITIVE, c.logPrimitiveAddress, PREPEND_THREAD, REEXECUTABLE, NO_LOCATIONS); + linkForeignCall(r, THREAD_IS_INTERRUPTED, c.threadIsInterruptedAddress, PREPEND_THREAD, NOT_REEXECUTABLE, ANY_LOCATION); + linkForeignCall(r, VM_ERROR, c.vmErrorAddress, PREPEND_THREAD, REEXECUTABLE, NO_LOCATIONS); + linkForeignCall(r, OSR_MIGRATION_END, c.osrMigrationEndAddress, DONT_PREPEND_THREAD, NOT_REEXECUTABLE, NO_LOCATIONS); if (GraalOptions.IntrinsifyObjectMethods) { - replacements.registerSubstitutions(ObjectSubstitutions.class); + r.registerSubstitutions(ObjectSubstitutions.class); } if (GraalOptions.IntrinsifySystemMethods) { - replacements.registerSubstitutions(SystemSubstitutions.class); + r.registerSubstitutions(SystemSubstitutions.class); } if (GraalOptions.IntrinsifyThreadMethods) { - replacements.registerSubstitutions(ThreadSubstitutions.class); + r.registerSubstitutions(ThreadSubstitutions.class); } if (GraalOptions.IntrinsifyUnsafeMethods) { - replacements.registerSubstitutions(UnsafeSubstitutions.class); + r.registerSubstitutions(UnsafeSubstitutions.class); } if (GraalOptions.IntrinsifyClassMethods) { - replacements.registerSubstitutions(ClassSubstitutions.class); + r.registerSubstitutions(ClassSubstitutions.class); } if (GraalOptions.IntrinsifyAESMethods) { - replacements.registerSubstitutions(AESCryptSubstitutions.class); - replacements.registerSubstitutions(CipherBlockChainingSubstitutions.class); + r.registerSubstitutions(AESCryptSubstitutions.class); + r.registerSubstitutions(CipherBlockChainingSubstitutions.class); } if (GraalOptions.IntrinsifyReflectionMethods) { - replacements.registerSubstitutions(ReflectionSubstitutions.class); + r.registerSubstitutions(ReflectionSubstitutions.class); } - checkcastSnippets = new CheckCastSnippets.Templates(this, replacements, graalRuntime.getTarget()); - instanceofSnippets = new InstanceOfSnippets.Templates(this, replacements, graalRuntime.getTarget()); - newObjectSnippets = new NewObjectSnippets.Templates(this, replacements, graalRuntime.getTarget()); - monitorSnippets = new MonitorSnippets.Templates(this, replacements, graalRuntime.getTarget(), c.useFastLocking); - writeBarrierSnippets = new WriteBarrierSnippets.Templates(this, replacements, graalRuntime.getTarget()); - boxingSnippets = new BoxingSnippets.Templates(this, replacements, graalRuntime.getTarget()); - exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(this, replacements, graalRuntime.getTarget()); + checkcastSnippets = new CheckCastSnippets.Templates(this, r, graalRuntime.getTarget()); + instanceofSnippets = new InstanceOfSnippets.Templates(this, r, graalRuntime.getTarget()); + newObjectSnippets = new NewObjectSnippets.Templates(this, r, graalRuntime.getTarget()); + monitorSnippets = new MonitorSnippets.Templates(this, r, graalRuntime.getTarget(), c.useFastLocking); + writeBarrierSnippets = new WriteBarrierSnippets.Templates(this, r, graalRuntime.getTarget()); + boxingSnippets = new BoxingSnippets.Templates(this, r, graalRuntime.getTarget()); + exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(this, r, graalRuntime.getTarget()); } public HotSpotGraalRuntime getGraalRuntime() { @@ -449,7 +474,7 @@ if (n instanceof ArrayLengthNode) { ArrayLengthNode arrayLengthNode = (ArrayLengthNode) n; ValueNode array = arrayLengthNode.array(); - ReadNode arrayLengthRead = graph.add(new ReadNode(array, ConstantLocationNode.create(LocationNode.FINAL_LOCATION, Kind.Int, config.arrayLengthOffset, graph), StampFactory.positiveInt())); + ReadNode arrayLengthRead = graph.add(new ReadNode(array, ConstantLocationNode.create(FINAL_LOCATION, Kind.Int, config.arrayLengthOffset, graph), StampFactory.positiveInt())); tool.createNullCheckGuard(arrayLengthRead, array); graph.replaceFixedWithFixed(arrayLengthNode, arrayLengthRead); } else if (n instanceof Invoke) { @@ -476,7 +501,7 @@ // We use LocationNode.ANY_LOCATION for the reads that access the // compiled code entry as HotSpot does not guarantee they are final // values. - ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, ConstantLocationNode.create(LocationNode.ANY_LOCATION, wordKind, config.methodCompiledEntryOffset, graph), + ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, ConstantLocationNode.create(ANY_LOCATION, wordKind, config.methodCompiledEntryOffset, graph), StampFactory.forKind(wordKind()))); loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(), @@ -532,7 +557,7 @@ } else if (n instanceof CompareAndSwapNode) { // Separate out GC barrier semantics CompareAndSwapNode cas = (CompareAndSwapNode) n; - LocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, cas.expected().kind(), cas.displacement(), cas.offset(), graph, 1); + LocationNode location = IndexedLocationNode.create(ANY_LOCATION, cas.expected().kind(), cas.displacement(), cas.offset(), graph, 1); cas.setLocation(location); cas.setWriteBarrierType(getCompareAndSwapBarrier(cas)); } else if (n instanceof LoadIndexedNode) { @@ -562,7 +587,7 @@ } } else { LoadHubNode arrayClass = graph.add(new LoadHubNode(array, wordKind)); - LocationNode location = ConstantLocationNode.create(LocationNode.FINAL_LOCATION, wordKind, config.arrayClassElementOffset, graph); + LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, config.arrayClassElementOffset, graph); FloatingReadNode arrayElementKlass = graph.unique(new FloatingReadNode(arrayClass, location, null, StampFactory.forKind(wordKind()))); CheckCastDynamicNode checkcast = graph.add(new CheckCastDynamicNode(arrayElementKlass, value, true)); graph.addBeforeFixed(storeIndexed, checkcast); @@ -579,7 +604,7 @@ } else if (n instanceof UnsafeLoadNode) { UnsafeLoadNode load = (UnsafeLoadNode) n; assert load.kind() != Kind.Illegal; - IndexedLocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, 1); + IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, 1); ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp())); // An unsafe read must not floating outside its block as may float above an explicit // null check on its object. @@ -587,7 +612,7 @@ graph.replaceFixedWithFixed(load, memoryRead); } else if (n instanceof UnsafeStoreNode) { UnsafeStoreNode store = (UnsafeStoreNode) n; - IndexedLocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, store.accessKind(), store.displacement(), store.offset(), graph, 1); + IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, store.accessKind(), store.displacement(), store.offset(), graph, 1); ValueNode object = store.object(); WriteBarrierType barrierType = getUnsafeStoreBarrierType(store); WriteNode write = graph.add(new WriteNode(object, store.value(), location, barrierType)); @@ -683,8 +708,8 @@ OSRStartNode osrStart = (OSRStartNode) n; StartNode newStart = graph.add(new StartNode()); LocalNode buffer = graph.unique(new LocalNode(0, StampFactory.forKind(wordKind()))); - ForeignCallNode migrationEnd = graph.add(new ForeignCallNode(OSR_MIGRATION_END, buffer)); - newStart.setStateAfter(osrStart.stateAfter()); + ForeignCallNode migrationEnd = graph.add(new ForeignCallNode(this, OSR_MIGRATION_END, buffer)); + migrationEnd.setStateAfter(osrStart.stateAfter()); newStart.setNext(migrationEnd); FixedNode next = osrStart.next(); @@ -749,12 +774,12 @@ assert vtableEntryOffset > 0; // We use LocationNode.ANY_LOCATION for the reads that access the vtable // entry as HotSpot does not guarantee that this is a final value. - ReadNode metaspaceMethod = graph.add(new ReadNode(hub, ConstantLocationNode.create(LocationNode.ANY_LOCATION, wordKind, vtableEntryOffset, graph), StampFactory.forKind(wordKind()))); + ReadNode metaspaceMethod = graph.add(new ReadNode(hub, ConstantLocationNode.create(ANY_LOCATION, wordKind, vtableEntryOffset, graph), StampFactory.forKind(wordKind()))); return metaspaceMethod; } private ReadNode createReadHub(LoweringTool tool, StructuredGraph graph, Kind wordKind, ValueNode object) { - LocationNode location = ConstantLocationNode.create(LocationNode.FINAL_LOCATION, wordKind, config.hubOffset, graph); + LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, config.hubOffset, graph); assert !object.isConstant() || object.asConstant().isNull(); ReadNode hub = graph.add(new ReadNode(object, location, StampFactory.forKind(wordKind()))); tool.createNullCheckGuard(hub, object); @@ -809,7 +834,7 @@ protected IndexedLocationNode createArrayLocation(Graph graph, Kind elementKind, ValueNode index) { int scale = this.graalRuntime.getTarget().arch.getSizeInBytes(elementKind); - return IndexedLocationNode.create(LocationNode.getArrayLocation(elementKind), elementKind, getArrayBaseOffset(elementKind), index, graph, scale); + return IndexedLocationNode.create(NamedLocationIdentity.getArrayLocation(elementKind), elementKind, getArrayBaseOffset(elementKind), index, graph, scale); } private static GuardingNode createBoundsCheck(AccessIndexedNode n, LoweringTool tool) { @@ -967,12 +992,12 @@ } @Override - public boolean hasSideEffect(ForeignCallDescriptor descriptor) { - // Only these two foreign calls are expected to be made with - // a node that implements StateSplit. They need to be a state - // split so that the stack trace they produce is accurate. - assert descriptor == CREATE_NULL_POINTER_EXCEPTION || descriptor == CREATE_OUT_OF_BOUNDS_EXCEPTION : descriptor; - return false; + public boolean isReexecutable(ForeignCallDescriptor descriptor) { + return foreignCalls.get(descriptor).isReexecutable(); + } + + public LocationIdentity[] getKilledLocationIdentities(ForeignCallDescriptor descriptor) { + return foreignCalls.get(descriptor).getKilledLocations(); } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.hotspot.nodes; +import static com.oracle.graal.api.meta.LocationIdentity.*; + import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.gen.*; @@ -29,7 +31,6 @@ import com.oracle.graal.hotspot.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.type.*; import com.oracle.graal.word.*; @@ -55,7 +56,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,11 +22,11 @@ */ package com.oracle.graal.hotspot.nodes; +import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.gen.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.word.*; diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,11 +22,13 @@ */ package com.oracle.graal.hotspot.nodes; +import static com.oracle.graal.api.meta.LocationIdentity.*; + +import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.gen.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.type.*; /** @@ -46,7 +48,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotNmethodExecuteNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotNmethodExecuteNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotNmethodExecuteNode.java Wed May 22 22:13:30 2013 +0200 @@ -30,7 +30,6 @@ import com.oracle.graal.hotspot.replacements.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -49,7 +48,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{LocationIdentity.ANY_LOCATION}; } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Wed May 22 22:13:30 2013 +0200 @@ -43,8 +43,8 @@ public static final ForeignCallDescriptor NEW_MULTI_ARRAY = new ForeignCallDescriptor("new_multi_array", Object.class, Word.class, int.class, Word.class); - public NewMultiArrayStubCall(ValueNode hub, int rank, ValueNode dims) { - super(NEW_MULTI_ARRAY, defaultStamp); + public NewMultiArrayStubCall(MetaAccessProvider runtime, ValueNode hub, int rank, ValueNode dims) { + super(runtime, NEW_MULTI_ARRAY, defaultStamp); this.hub = hub; this.rank = rank; this.dims = dims; diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AESCryptSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AESCryptSubstitutions.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AESCryptSubstitutions.java Wed May 22 22:13:30 2013 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.graal.hotspot.replacements; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import sun.misc.*; diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopySnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopySnippets.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopySnippets.java Wed May 22 22:13:30 2013 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.graal.hotspot.replacements; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.replacements.nodes.BranchProbabilityNode.*; diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CheckCastSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CheckCastSnippets.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CheckCastSnippets.java Wed May 22 22:13:30 2013 +0200 @@ -31,6 +31,7 @@ import static com.oracle.graal.replacements.nodes.BranchProbabilityNode.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.Node.NodeIntrinsic; import com.oracle.graal.hotspot.meta.*; @@ -94,7 +95,7 @@ isNull.inc(); } else { Word objectHub = loadHub(object); - if (objectHub.readWord(superCheckOffset, FINAL_LOCATION).notEqual(hub)) { + if (objectHub.readWord(superCheckOffset, LocationIdentity.FINAL_LOCATION).notEqual(hub)) { displayMiss.inc(); DeoptimizeNode.deopt(InvalidateReprofile, ClassCastException); } @@ -187,7 +188,7 @@ args = new Arguments(secondary); args.add("hub", hub); args.add("object", object); - args.addVarargs("hints", Word.class, StampFactory.forKind(wordKind()), hints); + args.addVarargs("hints", Word.class, StampFactory.forKind(getWordKind()), hints); } args.addConst("checkNull", !object.stamp().nonNull()); diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CipherBlockChainingSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CipherBlockChainingSubstitutions.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CipherBlockChainingSubstitutions.java Wed May 22 22:13:30 2013 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.graal.hotspot.replacements; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import sun.misc.*; diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassSubstitutions.java Wed May 22 22:13:30 2013 +0200 @@ -27,6 +27,7 @@ import java.lang.reflect.*; +import com.oracle.graal.api.meta.*; import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.word.*; @@ -44,7 +45,7 @@ // Class for primitive type return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC; } else { - return klass.readInt(klassModifierFlagsOffset(), FINAL_LOCATION); + return klass.readInt(klassModifierFlagsOffset(), LocationIdentity.FINAL_LOCATION); } } @@ -54,7 +55,7 @@ if (klass.equal(0)) { return false; } else { - int accessFlags = klass.readInt(klassAccessFlagsOffset(), FINAL_LOCATION); + int accessFlags = klass.readInt(klassAccessFlagsOffset(), LocationIdentity.FINAL_LOCATION); return (accessFlags & Modifier.INTERFACE) != 0; } } @@ -79,16 +80,16 @@ public static Class getSuperclass(final Class thisObj) { Word klass = loadWordFromObject(thisObj, klassOffset()); if (klass.notEqual(0)) { - int accessFlags = klass.readInt(klassAccessFlagsOffset(), FINAL_LOCATION); + int accessFlags = klass.readInt(klassAccessFlagsOffset(), LocationIdentity.FINAL_LOCATION); if ((accessFlags & Modifier.INTERFACE) == 0) { if ((readLayoutHelper(klass) & arrayKlassLayoutHelperIdentifier()) != 0) { return Object.class; } else { - Word superKlass = klass.readWord(klassSuperKlassOffset(), FINAL_LOCATION); + Word superKlass = klass.readWord(klassSuperKlassOffset(), LocationIdentity.FINAL_LOCATION); if (superKlass.equal(0)) { return null; } else { - return unsafeCast(superKlass.readObject(classMirrorOffset(), FINAL_LOCATION), Class.class, true, true); + return unsafeCast(superKlass.readObject(classMirrorOffset(), LocationIdentity.FINAL_LOCATION), Class.class, true, true); } } } @@ -101,7 +102,7 @@ Word klass = loadWordFromObject(thisObj, klassOffset()); if (klass.notEqual(0)) { if ((readLayoutHelper(klass) & arrayKlassLayoutHelperIdentifier()) != 0) { - return unsafeCast(klass.readObject(arrayKlassComponentMirrorOffset(), FINAL_LOCATION), Class.class, true, true); + return unsafeCast(klass.readObject(arrayKlassComponentMirrorOffset(), LocationIdentity.FINAL_LOCATION), Class.class, true, true); } } return null; diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Wed May 22 22:13:30 2013 +0200 @@ -34,7 +34,6 @@ import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.replacements.Snippet.Fold; import com.oracle.graal.replacements.nodes.*; import com.oracle.graal.word.*; @@ -46,9 +45,6 @@ */ public class HotSpotReplacementsUtil { - public static final LocationIdentity ANY_LOCATION = LocationNode.ANY_LOCATION; - public static final LocationIdentity FINAL_LOCATION = LocationNode.FINAL_LOCATION; - public static HotSpotVMConfig config() { return graalRuntime().getConfig(); } @@ -63,7 +59,7 @@ return config().verifyOops; } - public static final LocationIdentity EXCEPTION_OOP_LOCATION = LocationNode.createLocation("ExceptionOop"); + public static final LocationIdentity EXCEPTION_OOP_LOCATION = new NamedLocationIdentity("ExceptionOop"); /** * @see HotSpotVMConfig#threadExceptionOopOffset @@ -73,35 +69,35 @@ return config().threadExceptionOopOffset; } - public static final LocationIdentity EXCEPTION_PC_LOCATION = LocationNode.createLocation("ExceptionPc"); + public static final LocationIdentity EXCEPTION_PC_LOCATION = new NamedLocationIdentity("ExceptionPc"); @Fold public static int threadExceptionPcOffset() { return config().threadExceptionPcOffset; } - public static final LocationIdentity TLAB_TOP_LOCATION = LocationNode.createLocation("TlabTop"); + public static final LocationIdentity TLAB_TOP_LOCATION = new NamedLocationIdentity("TlabTop"); @Fold public static int threadTlabTopOffset() { return config().threadTlabTopOffset; } - public static final LocationIdentity TLAB_END_LOCATION = LocationNode.createLocation("TlabEnd"); + public static final LocationIdentity TLAB_END_LOCATION = new NamedLocationIdentity("TlabEnd"); @Fold private static int threadTlabEndOffset() { return config().threadTlabEndOffset; } - public static final LocationIdentity TLAB_START_LOCATION = LocationNode.createLocation("TlabStart"); + public static final LocationIdentity TLAB_START_LOCATION = new NamedLocationIdentity("TlabStart"); @Fold private static int threadTlabStartOffset() { return config().threadTlabStartOffset; } - public static final LocationIdentity PENDING_EXCEPTION_LOCATION = LocationNode.createLocation("PendingException"); + public static final LocationIdentity PENDING_EXCEPTION_LOCATION = new NamedLocationIdentity("PendingException"); /** * @see HotSpotVMConfig#pendingExceptionOffset @@ -111,7 +107,7 @@ return config().pendingExceptionOffset; } - public static final LocationIdentity OBJECT_RESULT_LOCATION = LocationNode.createLocation("ObjectResult"); + public static final LocationIdentity OBJECT_RESULT_LOCATION = new NamedLocationIdentity("ObjectResult"); @Fold private static int objectResultOffset() { @@ -200,7 +196,7 @@ } @Fold - public static Kind wordKind() { + public static Kind getWordKind() { return graalRuntime().getTarget().wordKind; } @@ -224,7 +220,7 @@ return Unsafe.getUnsafe().pageSize(); } - public static final LocationIdentity PROTOTYPE_MARK_WORD_LOCATION = LocationNode.createLocation("PrototypeMarkWord"); + public static final LocationIdentity PROTOTYPE_MARK_WORD_LOCATION = new NamedLocationIdentity("PrototypeMarkWord"); @Fold public static int prototypeMarkWordOffset() { @@ -247,7 +243,7 @@ } public static int readLayoutHelper(Word hub) { - return hub.readInt(klassLayoutHelperOffset(), FINAL_LOCATION); + return hub.readInt(klassLayoutHelperOffset(), LocationIdentity.FINAL_LOCATION); } @Fold @@ -265,14 +261,14 @@ return config().klassSuperKlassOffset; } - public static final LocationIdentity MARK_WORD_LOCATION = LocationNode.createLocation("MarkWord"); + public static final LocationIdentity MARK_WORD_LOCATION = new NamedLocationIdentity("MarkWord"); @Fold public static int markOffset() { return config().markOffset; } - public static final LocationIdentity HUB_LOCATION = LocationNode.createLocation("Hub"); + public static final LocationIdentity HUB_LOCATION = new NamedLocationIdentity("Hub"); @Fold private static int hubOffset() { @@ -399,21 +395,21 @@ return config().superCheckOffsetOffset; } - public static final LocationIdentity SECONDARY_SUPER_CACHE_LOCATION = LocationNode.createLocation("SecondarySuperCache"); + public static final LocationIdentity SECONDARY_SUPER_CACHE_LOCATION = new NamedLocationIdentity("SecondarySuperCache"); @Fold public static int secondarySuperCacheOffset() { return config().secondarySuperCacheOffset; } - public static final LocationIdentity SECONDARY_SUPERS_LOCATION = LocationNode.createLocation("SecondarySupers"); + public static final LocationIdentity SECONDARY_SUPERS_LOCATION = new NamedLocationIdentity("SecondarySupers"); @Fold public static int secondarySupersOffset() { return config().secondarySupersOffset; } - public static final LocationIdentity DISPLACED_MARK_WORD_LOCATION = LocationNode.createLocation("DisplacedMarkWord"); + public static final LocationIdentity DISPLACED_MARK_WORD_LOCATION = new NamedLocationIdentity("DisplacedMarkWord"); @Fold public static int lockDisplacedMarkOffset() { @@ -444,7 +440,7 @@ * Loads the hub from a object, null checking it first. */ public static Word loadHub(Object object) { - return loadHubIntrinsic(object, wordKind()); + return loadHubIntrinsic(object, getWordKind()); } public static Object verifyOop(Object object) { @@ -472,7 +468,7 @@ } public static Word loadWordFromObject(Object object, int offset) { - return loadWordFromObjectIntrinsic(object, 0, offset, wordKind()); + return loadWordFromObjectIntrinsic(object, 0, offset, getWordKind()); } @NodeIntrinsic(value = ReadRegisterNode.class, setStampFromReturnType = true) @@ -495,7 +491,7 @@ return CodeUtil.log2(wordSize()); } - public static final LocationIdentity CLASS_STATE_LOCATION = LocationNode.createLocation("ClassState"); + public static final LocationIdentity CLASS_STATE_LOCATION = new NamedLocationIdentity("ClassState"); @Fold public static int klassStateOffset() { @@ -527,14 +523,14 @@ return config().klassInstanceSizeOffset; } - public static final LocationIdentity HEAP_TOP_LOCATION = LocationNode.createLocation("HeapTop"); + public static final LocationIdentity HEAP_TOP_LOCATION = new NamedLocationIdentity("HeapTop"); @Fold public static long heapTopAddress() { return config().heapTopAddress; } - public static final LocationIdentity HEAP_END_LOCATION = LocationNode.createLocation("HeapEnd"); + public static final LocationIdentity HEAP_END_LOCATION = new NamedLocationIdentity("HeapEnd"); @Fold public static long heapEndAddress() { @@ -556,42 +552,42 @@ return config().tlabAlignmentReserve; } - public static final LocationIdentity TLAB_SIZE_LOCATION = LocationNode.createLocation("TlabSize"); + public static final LocationIdentity TLAB_SIZE_LOCATION = new NamedLocationIdentity("TlabSize"); @Fold public static int threadTlabSizeOffset() { return config().threadTlabSizeOffset; } - public static final LocationIdentity TLAB_THREAD_ALLOCATED_BYTES_LOCATION = LocationNode.createLocation("TlabThreadAllocatedBytes"); + public static final LocationIdentity TLAB_THREAD_ALLOCATED_BYTES_LOCATION = new NamedLocationIdentity("TlabThreadAllocatedBytes"); @Fold public static int threadAllocatedBytesOffset() { return config().threadAllocatedBytesOffset; } - public static final LocationIdentity TLAB_REFILL_WASTE_LIMIT_LOCATION = LocationNode.createLocation("RefillWasteLimit"); + public static final LocationIdentity TLAB_REFILL_WASTE_LIMIT_LOCATION = new NamedLocationIdentity("RefillWasteLimit"); @Fold public static int tlabRefillWasteLimitOffset() { return config().tlabRefillWasteLimitOffset; } - public static final LocationIdentity TLAB_NOF_REFILLS_LOCATION = LocationNode.createLocation("TlabNOfRefills"); + public static final LocationIdentity TLAB_NOF_REFILLS_LOCATION = new NamedLocationIdentity("TlabNOfRefills"); @Fold public static int tlabNumberOfRefillsOffset() { return config().tlabNumberOfRefillsOffset; } - public static final LocationIdentity TLAB_FAST_REFILL_WASTE_LOCATION = LocationNode.createLocation("TlabFastRefillWaste"); + public static final LocationIdentity TLAB_FAST_REFILL_WASTE_LOCATION = new NamedLocationIdentity("TlabFastRefillWaste"); @Fold public static int tlabFastRefillWasteOffset() { return config().tlabFastRefillWasteOffset; } - public static final LocationIdentity TLAB_SLOW_ALLOCATIONS_LOCATION = LocationNode.createLocation("TlabSlowAllocations"); + public static final LocationIdentity TLAB_SLOW_ALLOCATIONS_LOCATION = new NamedLocationIdentity("TlabSlowAllocations"); @Fold public static int tlabSlowAllocationsOffset() { diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java Wed May 22 22:13:30 2013 +0200 @@ -81,7 +81,7 @@ return falseValue; } Word objectHub = loadHub(object); - if (probability(NOT_LIKELY_PROBABILITY, objectHub.readWord(superCheckOffset, FINAL_LOCATION).notEqual(hub))) { + if (probability(NOT_LIKELY_PROBABILITY, objectHub.readWord(superCheckOffset, LocationIdentity.FINAL_LOCATION).notEqual(hub))) { displayMiss.inc(); return falseValue; } @@ -171,7 +171,7 @@ args = new Arguments(instanceofSecondary); args.add("hub", hub); args.add("object", object); - args.addVarargs("hints", Word.class, StampFactory.forKind(wordKind()), hints.hubs); + args.addVarargs("hints", Word.class, StampFactory.forKind(getWordKind()), hints.hubs); args.addVarargs("hintIsPositive", boolean.class, StampFactory.forKind(Kind.Boolean), hints.isPositive); } args.add("trueValue", replacer.trueValue); diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java Wed May 22 22:13:30 2013 +0200 @@ -41,7 +41,6 @@ import com.oracle.graal.hotspot.nodes.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; import com.oracle.graal.nodes.spi.*; @@ -345,7 +344,7 @@ */ private static final boolean ENABLE_BREAKPOINT = false; - private static final LocationIdentity MONITOR_COUNTER_LOCATION = LocationNode.createLocation("MonitorCounter"); + private static final LocationIdentity MONITOR_COUNTER_LOCATION = new NamedLocationIdentity("MonitorCounter"); @NodeIntrinsic(BreakpointNode.class) static native void bkpt(Object object, Word mark, Word tmp, Word value); diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java Wed May 22 22:13:30 2013 +0200 @@ -23,6 +23,7 @@ package com.oracle.graal.hotspot.replacements; import static com.oracle.graal.api.code.UnsignedMath.*; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.nodes.extended.UnsafeArrayCastNode.*; import static com.oracle.graal.nodes.extended.UnsafeCastNode.*; diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneSnippets.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneSnippets.java Wed May 22 22:13:30 2013 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.graal.hotspot.replacements; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.replacements.nodes.BranchProbabilityNode.*; diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectSubstitutions.java Wed May 22 22:13:30 2013 +0200 @@ -25,8 +25,8 @@ import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.nodes.extended.UnsafeCastNode.*; +import com.oracle.graal.api.meta.*; import com.oracle.graal.api.replacements.*; -import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.word.*; @@ -40,7 +40,7 @@ @MethodSubstitution(isStatic = false) public static Class getClass(final Object thisObj) { Word hub = loadHub(thisObj); - return unsafeCast(hub.readObject(Word.signed(classMirrorOffset()), LocationNode.FINAL_LOCATION), Class.class, true, true); + return unsafeCast(hub.readObject(Word.signed(classMirrorOffset()), LocationIdentity.FINAL_LOCATION), Class.class, true, true); } @MethodSubstitution(isStatic = false) diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java Wed May 22 22:13:30 2013 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.graal.hotspot.replacements; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import java.lang.reflect.*; @@ -43,15 +44,15 @@ @MethodSubstitution public static Thread currentThread() { - return (Thread) CurrentJavaThreadNode.get().readObject(threadObjectOffset(), FINAL_LOCATION); + return (Thread) CurrentJavaThreadNode.get().readObject(threadObjectOffset(), LocationIdentity.FINAL_LOCATION); } @MethodSubstitution(isStatic = false) public static boolean isInterrupted(final Thread thisObject, boolean clearInterrupted) { Word javaThread = CurrentJavaThreadNode.get(); - Object thread = javaThread.readObject(threadObjectOffset(), FINAL_LOCATION); + Object thread = javaThread.readObject(threadObjectOffset(), LocationIdentity.FINAL_LOCATION); if (thisObject == thread) { - Word osThread = javaThread.readWord(osThreadOffset(), FINAL_LOCATION); + Word osThread = javaThread.readWord(osThreadOffset(), LocationIdentity.FINAL_LOCATION); boolean interrupted = osThread.readInt(osThreadInterruptedOffset(), ANY_LOCATION) != 0; if (!interrupted || !clearInterrupted) { return interrupted; diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java Wed May 22 22:13:30 2013 +0200 @@ -32,8 +32,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.phases.*; import com.oracle.graal.replacements.*; import com.oracle.graal.word.*; @@ -45,7 +43,7 @@ */ public class TypeCheckSnippetUtils { - public static final LocationIdentity TYPE_DISPLAY_LOCATION = LocationNode.createLocation("TypeDisplay"); + public static final LocationIdentity TYPE_DISPLAY_LOCATION = new NamedLocationIdentity("TypeDisplay"); static boolean checkSecondarySubType(Word t, Word s) { // if (S.cache == T) return true @@ -59,7 +57,7 @@ static boolean checkUnknownSubType(Word t, Word s) { // int off = T.offset - int superCheckOffset = t.readInt(superCheckOffsetOffset(), FINAL_LOCATION); + int superCheckOffset = t.readInt(superCheckOffsetOffset(), LocationIdentity.FINAL_LOCATION); boolean primary = superCheckOffset != secondarySuperCacheOffset(); // if (T = S[off]) return true @@ -90,7 +88,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(), FINAL_LOCATION); + int length = secondarySupers.readInt(metaspaceArrayLengthOffset(), LocationIdentity.FINAL_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); @@ -144,7 +142,7 @@ } static Word loadSecondarySupersElement(Word metaspaceArray, int index) { - return metaspaceArray.readWord(metaspaceArrayBaseOffset() + index * wordSize(), FINAL_LOCATION); + return metaspaceArray.readWord(metaspaceArrayBaseOffset() + index * wordSize(), LocationIdentity.FINAL_LOCATION); } private static final SnippetCounter.Group counters = GraalOptions.SnippetCounters ? new SnippetCounter.Group("TypeCheck") : null; diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Wed May 22 22:13:30 2013 +0200 @@ -80,13 +80,18 @@ * @param descriptor the signature of the call to this stub * @param prependThread true if the JavaThread value for the current thread is to be prepended * to the arguments for the call to {@code address} + * @param reexecutable specifies if the stub call can be re-executed without (meaningful) side + * effects. Deoptimization will not return to a point before a stub call that cannot + * be re-executed. + * @param killedLocations the memory locations killed by the stub call */ - public ForeignCallStub(long address, ForeignCallDescriptor descriptor, boolean prependThread, HotSpotRuntime runtime, Replacements replacements) { - super(runtime, replacements, HotSpotForeignCallLinkage.create(descriptor, 0L, PRESERVES_REGISTERS, JavaCallee, NOT_LEAF)); + public ForeignCallStub(HotSpotRuntime runtime, Replacements replacements, long address, ForeignCallDescriptor descriptor, boolean prependThread, boolean reexecutable, + LocationIdentity... killedLocations) { + super(runtime, replacements, HotSpotForeignCallLinkage.create(descriptor, 0L, PRESERVES_REGISTERS, JavaCallee, NOT_LEAF, reexecutable, killedLocations)); this.prependThread = prependThread; Class[] targetParameterTypes = createTargetParameters(descriptor); ForeignCallDescriptor targetSig = new ForeignCallDescriptor(descriptor.getName() + ":C", descriptor.getResultType(), targetParameterTypes); - target = HotSpotForeignCallLinkage.create(targetSig, address, DESTROYS_REGISTERS, NativeCall, NOT_LEAF); + target = HotSpotForeignCallLinkage.create(targetSig, address, DESTROYS_REGISTERS, NativeCall, NOT_LEAF, reexecutable, killedLocations); } /** @@ -283,9 +288,9 @@ ValueNode[] targetArguments = new ValueNode[1 + locals.length]; targetArguments[0] = thread; System.arraycopy(locals, 0, targetArguments, 1, locals.length); - return builder.append(new ForeignCallNode(target.getDescriptor(), targetArguments)); + return builder.append(new ForeignCallNode(runtime, target.getDescriptor(), targetArguments)); } else { - return builder.append(new ForeignCallNode(target.getDescriptor(), locals)); + return builder.append(new ForeignCallNode(runtime, target.getDescriptor(), locals)); } } diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java Wed May 22 22:13:30 2013 +0200 @@ -89,7 +89,7 @@ */ @Snippet private static Object newArray(Word hub, int length, @ConstantParameter Word intArrayHub) { - int layoutHelper = hub.readInt(layoutHelperOffset(), FINAL_LOCATION); + int layoutHelper = hub.readInt(layoutHelperOffset(), LocationIdentity.FINAL_LOCATION); int log2ElementSize = (layoutHelper >> layoutHelperLog2ElementSizeShift()) & layoutHelperLog2ElementSizeMask(); int headerSize = (layoutHelper >> layoutHelperHeaderSizeShift()) & layoutHelperHeaderSizeMask(); int elementKind = (layoutHelper >> layoutHelperElementTypeShift()) & layoutHelperElementTypeMask(); diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java Wed May 22 22:13:30 2013 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.graal.hotspot.stubs; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import static com.oracle.graal.hotspot.nodes.DirectCompareAndSwapNode.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; @@ -87,7 +88,7 @@ */ @Snippet private static Object newInstance(Word hub, @ConstantParameter Word intArrayHub) { - int sizeInBytes = hub.readInt(klassInstanceSizeOffset(), FINAL_LOCATION); + int sizeInBytes = hub.readInt(klassInstanceSizeOffset(), LocationIdentity.FINAL_LOCATION); if (!forceSlowPath() && inlineContiguousAllocationSupported()) { if (hub.readInt(klassStateOffset(), CLASS_STATE_LOCATION) == klassStateFullyInitialized()) { Word memory = refillAllocate(intArrayHub, sizeInBytes, logging()); diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Wed May 22 22:13:30 2013 +0200 @@ -925,7 +925,7 @@ ValueNode exception = ConstantNode.forObject(cachedNullPointerException, runtime, currentGraph); trueSucc.setNext(handleException(exception, bci())); } else { - ForeignCallStateSplitNode call = currentGraph.add(new ForeignCallStateSplitNode(runtime, CREATE_NULL_POINTER_EXCEPTION)); + ForeignCallNode call = currentGraph.add(new ForeignCallNode(runtime, CREATE_NULL_POINTER_EXCEPTION)); call.setStateAfter(frameState.create(bci())); trueSucc.setNext(call); call.setNext(handleException(call, bci())); @@ -949,7 +949,7 @@ ValueNode exception = ConstantNode.forObject(cachedArrayIndexOutOfBoundsException, runtime, currentGraph); falseSucc.setNext(handleException(exception, bci())); } else { - ForeignCallStateSplitNode call = currentGraph.add(new ForeignCallStateSplitNode(runtime, CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); + ForeignCallNode call = currentGraph.add(new ForeignCallNode(runtime, CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); call.setStateAfter(frameState.create(bci())); falseSucc.setNext(call); call.setNext(handleException(call, bci())); diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Wed May 22 22:13:30 2013 +0200 @@ -83,9 +83,4 @@ public DeoptimizationReason getDeoptimizationReason() { return reason; } - - @Override - public boolean isCallSiteDeoptimization() { - return false; - } } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizingFixedWithNextNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizingFixedWithNextNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizingFixedWithNextNode.java Wed May 22 22:13:30 2013 +0200 @@ -42,9 +42,4 @@ updateUsages(deoptState, f); deoptState = f; } - - @Override - public boolean isCallSiteDeoptimization() { - return false; - } } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizingNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizingNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizingNode.java Wed May 22 22:13:30 2013 +0200 @@ -25,29 +25,24 @@ import com.oracle.graal.api.meta.*; /** - * Interface that needs to be implemented by nodes which need deoptimization information. - * + * Interface implemented by nodes which need deoptimization information. */ public interface DeoptimizingNode { /** - * Returns true if this particular instance needs deoptimization information. - * - * @return true if this particular instance needs deoptimization information + * Determines if this node needs deoptimization information. */ boolean canDeoptimize(); /** - * Returns the deoptimization information associated with this node if any. - * - * @return the deoptimization information associated with this node if any. + * Gets the deoptimization information associated with this node if any. */ FrameState getDeoptimizationState(); /** - * Set the deoptimization information associated with this node. + * Sets the deoptimization information associated with this node. * - * @param state the FrameState which represents the deoptimization information. + * @param state the FrameState which represents the deoptimization information */ void setDeoptimizationState(FrameState state); @@ -59,13 +54,4 @@ * @return the reason for deoptimization triggered by this node. */ DeoptimizationReason getDeoptimizationReason(); - - /** - * Returns true if this node needs deoptimization information for stack-walking purposes because - * it is a call-site. While most other nodes use deoptimization information representing a state - * that happened before them, these nodes use a state that is valid during the call itself. - * - * @return true if this node needs deoptimization information for stack-walking purposes. - */ - boolean isCallSiteDeoptimization(); } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,12 +22,13 @@ */ package com.oracle.graal.nodes; +import static com.oracle.graal.api.meta.LocationIdentity.*; + import java.util.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.Stamp; import com.oracle.graal.nodes.util.*; @@ -105,7 +106,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } @Override @@ -200,11 +201,6 @@ } @Override - public boolean isCallSiteDeoptimization() { - return true; - } - - @Override public GuardingNode getGuard() { return guard; } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,12 +22,13 @@ */ package com.oracle.graal.nodes; +import static com.oracle.graal.api.meta.LocationIdentity.*; + import java.util.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.util.*; @@ -154,7 +155,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } public FrameState stateDuring() { @@ -237,11 +238,6 @@ } @Override - public boolean isCallSiteDeoptimization() { - return true; - } - - @Override public GuardingNode getGuard() { return guard; } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,8 +22,10 @@ */ package com.oracle.graal.nodes; +import static com.oracle.graal.api.meta.LocationIdentity.*; + +import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; /** * The start node of a graph. @@ -32,6 +34,6 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java Wed May 22 22:13:30 2013 +0200 @@ -91,10 +91,5 @@ deoptState = f; } - @Override - public boolean isCallSiteDeoptimization() { - return false; - } - public abstract Access asFixedNode(); } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Wed May 22 22:13:30 2013 +0200 @@ -26,7 +26,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -34,22 +33,31 @@ * Node for a {@linkplain ForeignCallDescriptor foreign} call. */ @NodeInfo(nameTemplate = "ForeignCall#{p#descriptor/s}") -public class ForeignCallNode extends DeoptimizingFixedWithNextNode implements LIRLowerable, DeoptimizingNode, MemoryCheckpoint { +public class ForeignCallNode extends AbstractStateSplit implements LIRLowerable, DeoptimizingNode, MemoryCheckpoint { @Input private final NodeInputList arguments; + private final MetaAccessProvider runtime; + @Input private FrameState deoptState; private final ForeignCallDescriptor descriptor; - public ForeignCallNode(ForeignCallDescriptor descriptor, ValueNode... arguments) { + public ForeignCallNode(MetaAccessProvider runtime, ForeignCallDescriptor descriptor, ValueNode... arguments) { super(StampFactory.forKind(Kind.fromJavaClass(descriptor.getResultType()))); this.arguments = new NodeInputList<>(this, arguments); this.descriptor = descriptor; + this.runtime = runtime; } - protected ForeignCallNode(ForeignCallDescriptor descriptor, Stamp stamp) { + protected ForeignCallNode(MetaAccessProvider runtime, ForeignCallDescriptor descriptor, Stamp stamp) { super(stamp); this.arguments = new NodeInputList<>(this); this.descriptor = descriptor; + this.runtime = runtime; + } + + @Override + public boolean hasSideEffect() { + return !runtime.isReexecutable(descriptor); } public ForeignCallDescriptor getDescriptor() { @@ -58,7 +66,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return runtime.getKilledLocationIdentities(descriptor); } protected Value[] operands(LIRGeneratorTool gen) { @@ -80,6 +88,30 @@ } @Override + public FrameState getDeoptimizationState() { + if (deoptState != null) { + return deoptState; + } else if (stateAfter() != null) { + FrameState stateDuring = stateAfter(); + if ((stateDuring.stackSize() > 0 && stateDuring.stackAt(stateDuring.stackSize() - 1) == this) || (stateDuring.stackSize() > 1 && stateDuring.stackAt(stateDuring.stackSize() - 2) == this)) { + stateDuring = stateDuring.duplicateModified(stateDuring.bci, stateDuring.rethrowException(), this.kind()); + } + setDeoptimizationState(stateDuring); + return stateDuring; + } + return null; + } + + @Override + public void setDeoptimizationState(FrameState f) { + updateUsages(deoptState, f); + if (deoptState != null) { + throw new IllegalStateException(toString(Verbosity.Debugger)); + } + deoptState = f; + } + + @Override public String toString(Verbosity verbosity) { if (verbosity == Verbosity.Name) { return super.toString(verbosity) + "#" + descriptor; diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallStateSplitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallStateSplitNode.java Wed May 22 16:28:13 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.nodes.extended; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; - -/** - * A foreign call that is also a state split. - */ -@NodeInfo(nameTemplate = "ForeignCallStateSplit#{p#descriptor/s}") -public class ForeignCallStateSplitNode extends ForeignCallNode implements LIRLowerable, StateSplit, DeoptimizingNode { - - @Input(notDataflow = true) private FrameState stateAfter; - private MetaAccessProvider runtime; - - public ForeignCallStateSplitNode(MetaAccessProvider runtime, ForeignCallDescriptor descriptor, ValueNode... arguments) { - super(descriptor, arguments); - this.runtime = runtime; - } - - public FrameState stateAfter() { - return stateAfter; - } - - public void setStateAfter(FrameState x) { - assert x == null || x.isAlive() : "frame state must be in a graph"; - updateUsages(stateAfter, x); - stateAfter = x; - } - - public boolean hasSideEffect() { - return runtime.hasSideEffect(getDescriptor()); - } - - @Override - public FrameState getDeoptimizationState() { - if (super.getDeoptimizationState() != null) { - return super.getDeoptimizationState(); - } else if (stateAfter() != null) { - FrameState stateDuring = stateAfter(); - if ((stateDuring.stackSize() > 0 && stateDuring.stackAt(stateDuring.stackSize() - 1) == this) || (stateDuring.stackSize() > 1 && stateDuring.stackAt(stateDuring.stackSize() - 2) == this)) { - stateDuring = stateDuring.duplicateModified(stateDuring.bci, stateDuring.rethrowException(), this.kind()); - } - setDeoptimizationState(stateDuring); - return stateDuring; - } - return null; - } - - @Override - public void setDeoptimizationState(FrameState f) { - if (super.getDeoptimizationState() != null) { - throw new IllegalStateException(); - } - super.setDeoptimizationState(f); - } -} diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,8 +22,6 @@ */ package com.oracle.graal.nodes.extended; -import java.util.*; - import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.Node.ValueNumberable; import com.oracle.graal.nodes.calc.*; @@ -38,61 +36,6 @@ public abstract class LocationNode extends FloatingNode implements LIRLowerable, ValueNumberable { /** - * Marker interface for location identities. Apart from the special values {@link #ANY_LOCATION} - * and {@link #FINAL_LOCATION}, a different location identity of two memory accesses guarantees - * that the two accesses do not interfere. - */ - public interface LocationIdentity { - } - - /** - * Denotes any location. A write to such a location kills all values in a memory map during an - * analysis of memory accesses in a graph. A read from this location cannot be moved or - * coalesced with other reads because its interaction with other reads is not known. - */ - public static final LocationIdentity ANY_LOCATION = createLocation("ANY_LOCATION"); - - /** - * Denotes the location of a value that is guaranteed to be final. - */ - public static final LocationIdentity FINAL_LOCATION = createLocation("FINAL_LOCATION"); - - /** - * Creates a new unique location identity for read and write operations. - * - * @param name the name of the new location identity, for debugging purposes - * @return the new location identity - */ - public static LocationIdentity createLocation(final String name) { - return new LocationIdentity() { - - @Override - public String toString() { - return name; - } - }; - } - - /** - * Returns the 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 two - * distinct arrays are accessed. - */ - public static LocationIdentity getArrayLocation(Kind elementKind) { - return ARRAY_LOCATIONS.get(elementKind); - } - - private static final EnumMap ARRAY_LOCATIONS = initArrayLocations(); - - private static EnumMap initArrayLocations() { - EnumMap result = new EnumMap<>(Kind.class); - for (Kind kind : Kind.values()) { - result.put(kind, createLocation("Array: " + kind.getJavaName())); - } - return result; - } - - /** * Marker interface for locations in snippets. */ public interface Location { diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.graal.nodes.extended; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.graph.UnsafeAccess.*; import java.lang.reflect.*; @@ -29,9 +30,9 @@ import sun.misc.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -52,7 +53,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MemoryCheckpoint.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MemoryCheckpoint.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MemoryCheckpoint.java Wed May 22 22:13:30 2013 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.graal.nodes.extended; +import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; /** * This interface marks subclasses of {@link FixedNode} that kill a set of memory locations @@ -34,7 +34,7 @@ /** * This method is used to determine which set of memory locations is killed by this node. - * Returning the special value {@link LocationNode#ANY_LOCATION} will kill all memory locations. + * Returning the special value {@link LocationIdentity#ANY_LOCATION} will kill all memory locations. * * @return the identities of all locations killed by this node. */ diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Wed May 22 22:13:30 2013 +0200 @@ -25,7 +25,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -77,7 +76,7 @@ return null; } if (runtime != null && object != null && object.isConstant()) { - if (location.getLocationIdentity() == LocationNode.FINAL_LOCATION && location instanceof ConstantLocationNode) { + if (location.getLocationIdentity() == LocationIdentity.FINAL_LOCATION && location instanceof ConstantLocationNode) { long displacement = ((ConstantLocationNode) location).getDisplacement(); Kind kind = location.getValueKind(); if (object.kind() == Kind.Object) { diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SnippetLocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SnippetLocationNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SnippetLocationNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.nodes.extended; +import static com.oracle.graal.api.meta.LocationIdentity.*; + import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; @@ -74,7 +76,7 @@ return (LocationIdentity) locationIdentity.asConstant().asObject(); } // We do not know our actual location identity yet, so be conservative. - return LocationNode.ANY_LOCATION; + return ANY_LOCATION; } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,12 +22,12 @@ */ package com.oracle.graal.nodes.extended; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.graph.UnsafeAccess.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -76,7 +76,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteMemoryCheckpointNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteMemoryCheckpointNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteMemoryCheckpointNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,8 +22,10 @@ */ package com.oracle.graal.nodes.extended; +import static com.oracle.graal.api.meta.LocationIdentity.*; + +import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -39,7 +41,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Wed May 22 22:13:30 2013 +0200 @@ -26,7 +26,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.LocationNode.Location; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,13 +22,13 @@ */ package com.oracle.graal.nodes.java; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.graph.UnsafeAccess.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -97,7 +97,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,10 +22,11 @@ */ package com.oracle.graal.nodes.java; +import static com.oracle.graal.api.meta.LocationIdentity.*; + import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -41,7 +42,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,9 +22,11 @@ */ package com.oracle.graal.nodes.java; +import static com.oracle.graal.api.meta.LocationIdentity.*; + +import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.spi.*; /** @@ -46,7 +48,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,10 +22,12 @@ */ package com.oracle.graal.nodes.java; +import static com.oracle.graal.api.meta.LocationIdentity.*; + +import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.spi.*; /** @@ -47,7 +49,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return new LocationIdentity[]{LocationNode.ANY_LOCATION}; + return new LocationIdentity[]{ANY_LOCATION}; } @Override diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Wed May 22 22:13:30 2013 +0200 @@ -106,11 +106,6 @@ return null; } - @Override - public boolean isCallSiteDeoptimization() { - return false; - } - @SuppressWarnings("unused") @NodeIntrinsic public static void register(Object thisObj) { diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java Wed May 22 22:13:30 2013 +0200 @@ -22,12 +22,14 @@ */ package com.oracle.graal.phases.common; +import static com.oracle.graal.api.meta.LocationIdentity.*; + import java.util.*; +import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.PhiNode.PhiType; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.phases.*; import com.oracle.graal.phases.graph.*; import com.oracle.graal.phases.graph.ReentrantNodeIterator.LoopInfo; @@ -45,7 +47,7 @@ public MemoryMap(StartNode start) { this(); - lastMemorySnapshot.put(LocationNode.ANY_LOCATION, start); + lastMemorySnapshot.put(ANY_LOCATION, start); } public MemoryMap() { @@ -54,12 +56,12 @@ private ValueNode getLastLocationAccess(LocationIdentity locationIdentity) { ValueNode lastLocationAccess; - if (locationIdentity == LocationNode.FINAL_LOCATION) { + if (locationIdentity == FINAL_LOCATION) { return null; } else { lastLocationAccess = lastMemorySnapshot.get(locationIdentity); if (lastLocationAccess == null) { - lastLocationAccess = lastMemorySnapshot.get(LocationNode.ANY_LOCATION); + lastLocationAccess = lastMemorySnapshot.get(ANY_LOCATION); assert lastLocationAccess != null; } return lastLocationAccess; @@ -122,7 +124,7 @@ exit.addAll(modifiedLocations); exit.addAll(initialState); } - assert !modifiedLocations.contains(LocationNode.FINAL_LOCATION); + assert !modifiedLocations.contains(FINAL_LOCATION); modifiedInLoops.put(loop, modifiedLocations); return loopInfo.exitStates; } @@ -149,7 +151,7 @@ private static void processCheckpoint(MemoryCheckpoint checkpoint, MemoryMap state) { for (LocationIdentity identity : checkpoint.getLocationIdentities()) { - if (identity == LocationNode.ANY_LOCATION) { + if (identity == ANY_LOCATION) { state.lastMemorySnapshot.clear(); } state.lastMemorySnapshot.put(identity, (ValueNode) checkpoint); @@ -160,7 +162,7 @@ StructuredGraph graph = accessNode.graph(); assert accessNode.getNullCheck() == false; LocationIdentity locationIdentity = accessNode.location().getLocationIdentity(); - if (locationIdentity != LocationNode.ANY_LOCATION) { + if (locationIdentity != ANY_LOCATION) { ValueNode lastLocationAccess = state.getLastLocationAccess(locationIdentity); FloatingAccessNode floatingNode = accessNode.asFloatingNode(lastLocationAccess); floatingNode.setNullCheck(accessNode.getNullCheck()); @@ -182,7 +184,7 @@ for (MemoryMap other : states) { keys.addAll(other.lastMemorySnapshot.keySet()); } - assert !keys.contains(LocationNode.FINAL_LOCATION); + assert !keys.contains(FINAL_LOCATION); for (LocationIdentity key : keys) { int mergedStatesCount = 0; @@ -236,7 +238,7 @@ @Override protected Map processLoop(LoopBeginNode loop, MemoryMap initialState) { Set modifiedLocations = modifiedInLoops.get(loop); - if (modifiedLocations.contains(LocationNode.ANY_LOCATION)) { + if (modifiedLocations.contains(ANY_LOCATION)) { // create phis for all locations if ANY is modified in the loop modifiedLocations = new HashSet<>(modifiedLocations); modifiedLocations.addAll(initialState.lastMemorySnapshot.keySet()); diff -r e92fdf3e1558 -r d734ee4f9738 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 Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Wed May 22 22:13:30 2013 +0200 @@ -22,8 +22,11 @@ */ package com.oracle.graal.phases.schedule; +import static com.oracle.graal.api.meta.LocationIdentity.*; + import java.util.*; +import com.oracle.graal.api.meta.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.Node.Verbosity; @@ -31,7 +34,6 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.virtual.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.graph.*; @@ -93,7 +95,7 @@ for (Iterator iter = currentState.iterator(); iter.hasNext();) { FloatingReadNode read = iter.next(); FixedNode fixed = (FixedNode) node; - if (identity == LocationNode.ANY_LOCATION || read.location().getLocationIdentity() == identity) { + if (identity == ANY_LOCATION || read.location().getLocationIdentity() == identity) { addPhantomReference(read, fixed); iter.remove(); } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MonitorTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MonitorTest.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MonitorTest.java Wed May 22 22:13:30 2013 +0200 @@ -31,32 +31,33 @@ @Test public void test0() { - test("lockObjectSimple", new Object(), new Object()); - test("lockObjectSimple", new Object(), null); +// test("lockObjectSimple", new Object(), new Object()); +// test("lockObjectSimple", new Object(), null); + test("lockObjectSimple", null, null); } - @Test + // @Test public void test0_1() { test("lockThisSimple", "test1", new Object()); test("lockThisSimple", "test1", null); } - @Test + // @Test public void test0_2() { test("lockObjectSimple", null, "test1"); } - @Test + // @Test public void test1_1() { test("lockObject", new Object(), "test1", new String[1]); } - @Test + // @Test public void test1_2() { test("lockObject", null, "test1_1", new String[1]); } - @Test + // @Test public void test2() { test("lockThis", "test2", new String[1]); } @@ -64,7 +65,7 @@ /** * Tests monitor operations on {@link PartialEscapeAnalysisPhase virtual objects}. */ - @Test + // @Test public void test3() { test("lockLocalObject", "test3", new String[1]); } @@ -72,7 +73,7 @@ /** * Tests recursive locking of objects which should be biasable. */ - @Test + // @Test public void test4() { Chars src = new Chars("1234567890".toCharArray()); Chars dst = new Chars(src.data.length); @@ -82,7 +83,7 @@ /** * Tests recursive locking of objects which do not appear to be biasable. */ - @Test + // @Test public void test5() { char[] src = "1234567890".toCharArray(); char[] dst = new char[src.length]; @@ -92,7 +93,7 @@ /** * Extends {@link #test4()} with contention. */ - @Test + // @Test public void test6() { Chars src = new Chars("1234567890".toCharArray()); Chars dst = new Chars(src.data.length); @@ -103,7 +104,7 @@ /** * Extends {@link #test5()} with contention. */ - @Test + // @Test public void test7() { char[] src = "1234567890".toCharArray(); char[] dst = new char[src.length]; diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Wed May 22 22:13:30 2013 +0200 @@ -33,7 +33,6 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.replacements.*; import com.oracle.graal.replacements.Snippet.*; import com.oracle.graal.word.*; @@ -43,7 +42,7 @@ */ public class PointerTest extends GraalCompilerTest implements Snippets { - private static final LocationIdentity ID = LocationNode.createLocation("ID"); + private static final LocationIdentity ID = new NamedLocationIdentity("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; @@ -78,7 +77,7 @@ @Test public void test_read3() { for (Kind kind : KINDS) { - assertRead(parse("read" + kind.name() + "3"), kind, false, LocationNode.ANY_LOCATION); + assertRead(parse("read" + kind.name() + "3"), kind, false, LocationIdentity.ANY_LOCATION); } } @@ -99,7 +98,7 @@ @Test public void test_write3() { for (Kind kind : KINDS) { - assertWrite(parse("write" + kind.name() + "3"), kind, false, LocationNode.ANY_LOCATION); + assertWrite(parse("write" + kind.name() + "3"), kind, false, LocationIdentity.ANY_LOCATION); } } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Wed May 22 22:13:30 2013 +0200 @@ -22,9 +22,11 @@ */ package com.oracle.graal.replacements.nodes; +import static com.oracle.graal.api.meta.LocationIdentity.*; + import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.WriteNode.*; +import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.word.*; @@ -62,7 +64,7 @@ @Override public void lower(LoweringTool tool, LoweringType loweringType) { - IndexedLocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, value.kind(), displacement, offset, graph(), 1); + IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, value.kind(), displacement, offset, graph(), 1); WriteNode write = graph().add(new WriteNode(object, value, location, WriteBarrierType.NONE)); graph().replaceFixedWithFixed(this, write); } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Wed May 22 22:13:30 2013 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.graal.virtual.phases.ea; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.virtual.phases.ea.PartialEscapeAnalysisPhase.*; import java.util.*; @@ -34,7 +35,6 @@ import com.oracle.graal.nodes.PhiNode.PhiType; import com.oracle.graal.nodes.VirtualState.NodeClosure; import com.oracle.graal.nodes.cfg.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; @@ -161,7 +161,7 @@ for (LocationIdentity identity : checkpoint.getLocationIdentities()) { if (identity instanceof ResolvedJavaField) { state.killReadCache((ResolvedJavaField) identity); - } else if (identity == LocationNode.ANY_LOCATION) { + } else if (identity == ANY_LOCATION) { state.killReadCache(); } } diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java Wed May 22 22:13:30 2013 +0200 @@ -22,8 +22,8 @@ */ package com.oracle.graal.word; +import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; public interface Pointer extends Unsigned { diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Wed May 22 22:13:30 2013 +0200 @@ -27,10 +27,10 @@ import java.lang.annotation.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; public abstract class Word implements Signed, Unsigned, Pointer { diff -r e92fdf3e1558 -r d734ee4f9738 graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Wed May 22 16:28:13 2013 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Wed May 22 22:13:30 2013 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.word.phases; +import static com.oracle.graal.api.meta.LocationIdentity.*; + import java.lang.reflect.*; import com.oracle.graal.api.meta.*; @@ -29,7 +31,6 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.type.*; @@ -164,7 +165,7 @@ Kind readKind = asKind(callTargetNode.returnType()); LocationNode location; if (arguments.size() == 2) { - location = makeLocation(graph, arguments.get(1), readKind, LocationNode.ANY_LOCATION); + location = makeLocation(graph, arguments.get(1), readKind, ANY_LOCATION); } else { location = makeLocation(graph, arguments.get(1), readKind, arguments.get(2)); } @@ -176,7 +177,7 @@ Kind writeKind = asKind(targetMethod.getSignature().getParameterType(1, targetMethod.getDeclaringClass())); LocationNode location; if (arguments.size() == 3) { - location = makeLocation(graph, arguments.get(1), writeKind, LocationNode.ANY_LOCATION); + location = makeLocation(graph, arguments.get(1), writeKind, LocationIdentity.ANY_LOCATION); } else { location = makeLocation(graph, arguments.get(1), writeKind, arguments.get(3)); }