# HG changeset patch # User Doug Simon # Date 1368714766 -7200 # Node ID 34c892fdfb6d0c4066e8500fbd39192bdce822a9 # Parent 951d5ebf3c49fe5aafa802fd745ebc2c5470225a moved responsibility for determining if a foreign call has a side effect to the runtime diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ForeignCallDescriptor.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ForeignCallDescriptor.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ForeignCallDescriptor.java Thu May 16 16:32:46 2013 +0200 @@ -38,13 +38,11 @@ public class ForeignCallDescriptor { private final String name; - private final boolean hasSideEffect; private final Class resultType; private final Class[] argumentTypes; - public ForeignCallDescriptor(String name, boolean hasSideEffect, Class resultType, Class... argumentTypes) { + public ForeignCallDescriptor(String name, Class resultType, Class... argumentTypes) { this.name = name; - this.hasSideEffect = hasSideEffect; this.resultType = resultType; this.argumentTypes = argumentTypes; } @@ -57,14 +55,6 @@ } /** - * Determines if this call changes state visible to other threads. Such calls denote boundaries - * across which deoptimization points cannot be moved. - */ - public boolean hasSideEffect() { - return hasSideEffect; - } - - /** * Gets the return type of this foreign call. */ public Class getResultType() { diff -r 951d5ebf3c49 -r 34c892fdfb6d 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 Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Thu May 16 16:32:46 2013 +0200 @@ -94,4 +94,10 @@ * value cannot be read. */ 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. + */ + boolean hasSideEffect(ForeignCallDescriptor descriptor); } diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Thu May 16 16:32:46 2013 +0200 @@ -69,8 +69,8 @@ */ public class PTXLIRGenerator extends LIRGenerator { - public static final ForeignCallDescriptor ARITHMETIC_FREM = new ForeignCallDescriptor("arithmeticFrem", false, float.class, float.class, float.class); - public static final ForeignCallDescriptor ARITHMETIC_DREM = new ForeignCallDescriptor("arithmeticDrem", false, double.class, double.class, double.class); + public static final ForeignCallDescriptor ARITHMETIC_FREM = new ForeignCallDescriptor("arithmeticFrem", float.class, float.class, float.class); + public static final ForeignCallDescriptor ARITHMETIC_DREM = new ForeignCallDescriptor("arithmeticDrem", double.class, double.class, double.class); public static class PTXSpillMoveFactory implements LIR.SpillMoveFactory { diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Thu May 16 16:32:46 2013 +0200 @@ -39,34 +39,34 @@ /** * Descriptor for SharedRuntime::deopt_blob()->uncommon_trap(). */ - public static final ForeignCallDescriptor UNCOMMON_TRAP = new ForeignCallDescriptor("deoptimize", true, void.class); + public static final ForeignCallDescriptor UNCOMMON_TRAP = new ForeignCallDescriptor("deoptimize", void.class); /** * Descriptor for {@link ExceptionHandlerStub}. This stub is called by the * {@linkplain Marks#MARK_EXCEPTION_HANDLER_ENTRY exception handler} in a compiled method. */ - public static final ForeignCallDescriptor EXCEPTION_HANDLER = new ForeignCallDescriptor("exceptionHandler", true, void.class, Object.class, Word.class); + public static final ForeignCallDescriptor EXCEPTION_HANDLER = new ForeignCallDescriptor("exceptionHandler", void.class, Object.class, Word.class); /** * Descriptor for SharedRuntime::deopt_blob()->unpack(). */ - public static final ForeignCallDescriptor DEOPT_HANDLER = new ForeignCallDescriptor("deoptHandler", true, void.class); + public static final ForeignCallDescriptor DEOPT_HANDLER = new ForeignCallDescriptor("deoptHandler", void.class); /** * Descriptor for SharedRuntime::get_ic_miss_stub(). */ - public static final ForeignCallDescriptor IC_MISS_HANDLER = new ForeignCallDescriptor("icMissHandler", true, void.class); + public static final ForeignCallDescriptor IC_MISS_HANDLER = new ForeignCallDescriptor("icMissHandler", void.class); /** * Descriptor for {@link UnwindExceptionToCallerStub}. This stub is called by code generated * from {@link UnwindNode}. */ - public static final ForeignCallDescriptor UNWIND_EXCEPTION_TO_CALLER = new ForeignCallDescriptor("unwindExceptionToCaller", true, void.class, Object.class, Word.class); + public static final ForeignCallDescriptor UNWIND_EXCEPTION_TO_CALLER = new ForeignCallDescriptor("unwindExceptionToCaller", void.class, Object.class, Word.class); /** * Descriptor for the arguments when unwinding to an exception handler in a caller. */ - public static final ForeignCallDescriptor EXCEPTION_HANDLER_IN_CALLER = new ForeignCallDescriptor("exceptionHandlerInCaller", false, void.class, Object.class, Word.class); + public static final ForeignCallDescriptor EXCEPTION_HANDLER_IN_CALLER = new ForeignCallDescriptor("exceptionHandlerInCaller", void.class, Object.class, Word.class); public HotSpotBackend(HotSpotRuntime runtime, TargetDescription target) { super(runtime, target); diff -r 951d5ebf3c49 -r 34c892fdfb6d 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 Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Thu May 16 16:32:46 2013 +0200 @@ -99,8 +99,8 @@ */ public abstract class HotSpotRuntime implements GraalCodeCacheProvider, DisassemblerProvider, BytecodeDisassemblerProvider { - public static final ForeignCallDescriptor OSR_MIGRATION_END = new ForeignCallDescriptor("OSR_migration_end", true, void.class, long.class); - public static final ForeignCallDescriptor IDENTITY_HASHCODE = new ForeignCallDescriptor("identity_hashcode", false, int.class, Object.class); + public static final ForeignCallDescriptor OSR_MIGRATION_END = new ForeignCallDescriptor("OSR_migration_end", void.class, long.class); + public static final ForeignCallDescriptor IDENTITY_HASHCODE = new ForeignCallDescriptor("identity_hashcode", int.class, Object.class); public final HotSpotVMConfig config; @@ -996,6 +996,15 @@ } @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; + } + + @Override public TargetDescription getTarget() { return graalRuntime.getTarget(); } diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorEnterStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorEnterStubCall.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorEnterStubCall.java Thu May 16 16:32:46 2013 +0200 @@ -37,7 +37,7 @@ @Input private ValueNode object; @Input private ValueNode lock; - public static final ForeignCallDescriptor MONITORENTER = new ForeignCallDescriptor("monitorenter", true, void.class, Object.class, Word.class); + public static final ForeignCallDescriptor MONITORENTER = new ForeignCallDescriptor("monitorenter", void.class, Object.class, Word.class); public MonitorEnterStubCall(ValueNode object, ValueNode lock) { super(StampFactory.forVoid()); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorExitStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorExitStubCall.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorExitStubCall.java Thu May 16 16:32:46 2013 +0200 @@ -38,7 +38,7 @@ @Input private ValueNode object; private int lockDepth; - public static final ForeignCallDescriptor MONITOREXIT = new ForeignCallDescriptor("monitorexit", true, void.class, Object.class, Word.class); + public static final ForeignCallDescriptor MONITOREXIT = new ForeignCallDescriptor("monitorexit", void.class, Object.class, Word.class); public MonitorExitStubCall(ValueNode object, int lockDepth) { super(StampFactory.forVoid()); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Thu May 16 16:32:46 2013 +0200 @@ -43,7 +43,7 @@ @Input private ValueNode hub; @Input private ValueNode length; - public static final ForeignCallDescriptor NEW_ARRAY = new ForeignCallDescriptor("new_array", false, Object.class, Word.class, int.class); + public static final ForeignCallDescriptor NEW_ARRAY = new ForeignCallDescriptor("new_array", Object.class, Word.class, int.class); public NewArrayStubCall(ValueNode hub, ValueNode length) { super(defaultStamp); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Thu May 16 16:32:46 2013 +0200 @@ -42,7 +42,7 @@ @Input private ValueNode hub; - public static final ForeignCallDescriptor NEW_INSTANCE = new ForeignCallDescriptor("new_instance", false, Object.class, Word.class); + public static final ForeignCallDescriptor NEW_INSTANCE = new ForeignCallDescriptor("new_instance", Object.class, Word.class); public NewInstanceStubCall(ValueNode hub) { super(defaultStamp); diff -r 951d5ebf3c49 -r 34c892fdfb6d 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 Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Thu May 16 16:32:46 2013 +0200 @@ -44,7 +44,7 @@ @Input private ValueNode dims; private final int rank; - public static final ForeignCallDescriptor NEW_MULTI_ARRAY = new ForeignCallDescriptor("new_multi_array", false, Object.class, Word.class, int.class, Word.class); + 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(defaultStamp); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ThreadIsInterruptedStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ThreadIsInterruptedStubCall.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ThreadIsInterruptedStubCall.java Thu May 16 16:32:46 2013 +0200 @@ -41,7 +41,7 @@ @Input private ValueNode thread; @Input private ValueNode clearIsInterrupted; - public static final ForeignCallDescriptor THREAD_IS_INTERRUPTED = new ForeignCallDescriptor("thread_is_interrupted", false, boolean.class, Object.class, boolean.class); + public static final ForeignCallDescriptor THREAD_IS_INTERRUPTED = new ForeignCallDescriptor("thread_is_interrupted", boolean.class, Object.class, boolean.class); public ThreadIsInterruptedStubCall(ValueNode thread, ValueNode clearIsInterrupted) { super(StampFactory.forInteger(Kind.Int, 0, 1)); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Thu May 16 16:32:46 2013 +0200 @@ -38,7 +38,7 @@ private final String format; @Input private ValueNode value; - public static final ForeignCallDescriptor VM_ERROR = new ForeignCallDescriptor("vm_error", false, void.class, Object.class, Object.class, long.class); + public static final ForeignCallDescriptor VM_ERROR = new ForeignCallDescriptor("vm_error", void.class, Object.class, Object.class, long.class); private VMErrorNode(String format, ValueNode value) { super(StampFactory.forVoid()); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VerifyOopStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VerifyOopStubCall.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VerifyOopStubCall.java Thu May 16 16:32:46 2013 +0200 @@ -36,7 +36,7 @@ public class VerifyOopStubCall extends DeoptimizingStubCall implements LIRGenLowerable { @Input private ValueNode object; - public static final ForeignCallDescriptor VERIFY_OOP = new ForeignCallDescriptor("verify_oop", false, Object.class, Object.class); + public static final ForeignCallDescriptor VERIFY_OOP = new ForeignCallDescriptor("verify_oop", Object.class, Object.class); public VerifyOopStubCall(ValueNode object) { super(StampFactory.objectNonNull()); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPostStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPostStubCall.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPostStubCall.java Thu May 16 16:32:46 2013 +0200 @@ -37,7 +37,7 @@ @Input private ValueNode object; @Input private ValueNode card; - public static final ForeignCallDescriptor WRITE_BARRIER_POST = new ForeignCallDescriptor("writeBarrierPost", true, void.class, Object.class, Word.class); + public static final ForeignCallDescriptor WRITE_BARRIER_POST = new ForeignCallDescriptor("writeBarrierPost", void.class, Object.class, Word.class); public WriteBarrierPostStubCall(ValueNode object, ValueNode card) { super(StampFactory.forVoid()); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPreStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPreStubCall.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPreStubCall.java Thu May 16 16:32:46 2013 +0200 @@ -35,7 +35,7 @@ public class WriteBarrierPreStubCall extends FixedWithNextNode implements LIRGenLowerable { @Input private ValueNode object; - public static final ForeignCallDescriptor WRITE_BARRIER_PRE = new ForeignCallDescriptor("writeBarrierPre", true, void.class, Object.class); + public static final ForeignCallDescriptor WRITE_BARRIER_PRE = new ForeignCallDescriptor("writeBarrierPre", void.class, Object.class); public WriteBarrierPreStubCall(ValueNode object) { super(StampFactory.forVoid()); diff -r 951d5ebf3c49 -r 34c892fdfb6d 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 Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AESCryptSubstitutions.java Thu May 16 16:32:46 2013 +0200 @@ -103,7 +103,7 @@ public static class EncryptBlockStubCall extends CryptBlockStubCall { - public static final ForeignCallDescriptor ENCRYPT_BLOCK = new ForeignCallDescriptor("encrypt_block", false, void.class, Word.class, Word.class, Word.class); + public static final ForeignCallDescriptor ENCRYPT_BLOCK = new ForeignCallDescriptor("encrypt_block", void.class, Word.class, Word.class, Word.class); public EncryptBlockStubCall(ValueNode in, ValueNode out, ValueNode key) { super(in, out, key, ENCRYPT_BLOCK); @@ -115,7 +115,7 @@ public static class DecryptBlockStubCall extends CryptBlockStubCall { - public static final ForeignCallDescriptor DECRYPT_BLOCK = new ForeignCallDescriptor("decrypt_block", false, void.class, Word.class, Word.class, Word.class); + public static final ForeignCallDescriptor DECRYPT_BLOCK = new ForeignCallDescriptor("decrypt_block", void.class, Word.class, Word.class, Word.class); public DecryptBlockStubCall(ValueNode in, ValueNode out, ValueNode key) { super(in, out, key, DECRYPT_BLOCK); diff -r 951d5ebf3c49 -r 34c892fdfb6d 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 Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CipherBlockChainingSubstitutions.java Thu May 16 16:32:46 2013 +0200 @@ -124,7 +124,7 @@ public static class EncryptAESCryptStubCall extends AESCryptStubCall { - public static final ForeignCallDescriptor ENCRYPT = new ForeignCallDescriptor("encrypt", false, void.class, Word.class, Word.class, Word.class, Word.class, int.class); + public static final ForeignCallDescriptor ENCRYPT = new ForeignCallDescriptor("encrypt", void.class, Word.class, Word.class, Word.class, Word.class, int.class); public EncryptAESCryptStubCall(ValueNode in, ValueNode out, ValueNode key, ValueNode r, ValueNode inLength) { super(in, out, key, r, inLength, ENCRYPT); @@ -136,7 +136,7 @@ public static class DecryptAESCryptStubCall extends AESCryptStubCall { - public static final ForeignCallDescriptor DECRYPT = new ForeignCallDescriptor("decrypt", false, void.class, Word.class, Word.class, Word.class, Word.class, int.class); + public static final ForeignCallDescriptor DECRYPT = new ForeignCallDescriptor("decrypt", void.class, Word.class, Word.class, Word.class, Word.class, int.class); public DecryptAESCryptStubCall(ValueNode in, ValueNode out, ValueNode key, ValueNode r, ValueNode inLength) { super(in, out, key, r, inLength, DECRYPT); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemSubstitutions.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemSubstitutions.java Thu May 16 16:32:46 2013 +0200 @@ -38,8 +38,8 @@ @ClassSubstitution(java.lang.System.class) public class SystemSubstitutions { - public static final ForeignCallDescriptor JAVA_TIME_MILLIS = new ForeignCallDescriptor("javaTimeMillis", false, long.class); - public static final ForeignCallDescriptor JAVA_TIME_NANOS = new ForeignCallDescriptor("javaTimeNanos", false, long.class); + public static final ForeignCallDescriptor JAVA_TIME_MILLIS = new ForeignCallDescriptor("javaTimeMillis", long.class); + public static final ForeignCallDescriptor JAVA_TIME_NANOS = new ForeignCallDescriptor("javaTimeNanos", long.class); @MacroSubstitution(macro = ArrayCopyNode.class) public static native void arraycopy(Object src, int srcPos, Object dest, int destPos, int length); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java Thu May 16 16:32:46 2013 +0200 @@ -125,7 +125,7 @@ return enabled || graalRuntime().getConfig().cAssertions; } - public static final ForeignCallDescriptor EXCEPTION_HANDLER_FOR_PC = descriptorFor(ExceptionHandlerStub.class, "exceptionHandlerForPc", false); + public static final ForeignCallDescriptor EXCEPTION_HANDLER_FOR_PC = descriptorFor(ExceptionHandlerStub.class, "exceptionHandlerForPc"); @NodeIntrinsic(value = CRuntimeCall.class, setStampFromReturnType = true) public static native Word exceptionHandlerForPc(@ConstantNodeParameter ForeignCallDescriptor exceptionHandlerForPc, Word thread); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/LogObjectStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/LogObjectStub.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/LogObjectStub.java Thu May 16 16:32:46 2013 +0200 @@ -50,7 +50,7 @@ logObjectC(LOG_OBJECT_C, thread(), object, flags); } - public static final ForeignCallDescriptor LOG_OBJECT_C = descriptorFor(LogObjectStub.class, "logObjectC", false); + public static final ForeignCallDescriptor LOG_OBJECT_C = descriptorFor(LogObjectStub.class, "logObjectC"); @NodeIntrinsic(CRuntimeCall.class) public static native void logObjectC(@ConstantNodeParameter ForeignCallDescriptor logObjectC, Word thread, Object object, int flags); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/LogPrimitiveStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/LogPrimitiveStub.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/LogPrimitiveStub.java Thu May 16 16:32:46 2013 +0200 @@ -50,7 +50,7 @@ logPrimitivefC(LOG_PRIMITIVE_C, thread(), typeChar, value, newline); } - public static final ForeignCallDescriptor LOG_PRIMITIVE_C = descriptorFor(LogPrimitiveStub.class, "logPrimitivefC", false); + public static final ForeignCallDescriptor LOG_PRIMITIVE_C = descriptorFor(LogPrimitiveStub.class, "logPrimitivefC"); @NodeIntrinsic(CRuntimeCall.class) public static native void logPrimitivefC(@ConstantNodeParameter ForeignCallDescriptor logPrimitivefC, Word thread, char typeChar, long value, boolean newline); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/LogPrintfStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/LogPrintfStub.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/LogPrintfStub.java Thu May 16 16:32:46 2013 +0200 @@ -50,7 +50,7 @@ logPrintfC(LOG_PRINTF_C, thread(), format, v1, v2, v3); } - public static final ForeignCallDescriptor LOG_PRINTF_C = descriptorFor(LogPrintfStub.class, "logPrintfC", false); + public static final ForeignCallDescriptor LOG_PRINTF_C = descriptorFor(LogPrintfStub.class, "logPrintfC"); @NodeIntrinsic(CRuntimeCall.class) public static native void logPrintfC(@ConstantNodeParameter ForeignCallDescriptor logPrintfC, Word thread, String format, long v1, long v2, long v3); diff -r 951d5ebf3c49 -r 34c892fdfb6d 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 Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java Thu May 16 16:32:46 2013 +0200 @@ -119,7 +119,7 @@ return verifyObject(getAndClearObjectResult(thread())); } - public static final ForeignCallDescriptor NEW_ARRAY_C = descriptorFor(NewArrayStub.class, "newArrayC", false); + public static final ForeignCallDescriptor NEW_ARRAY_C = descriptorFor(NewArrayStub.class, "newArrayC"); @NodeIntrinsic(CRuntimeCall.class) public static native void newArrayC(@ConstantNodeParameter ForeignCallDescriptor newArrayC, Word thread, Word hub, int length); diff -r 951d5ebf3c49 -r 34c892fdfb6d 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 Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java Thu May 16 16:32:46 2013 +0200 @@ -238,7 +238,7 @@ return Boolean.getBoolean("graal.newInstanceStub.forceSlowPath"); } - public static final ForeignCallDescriptor NEW_INSTANCE_C = descriptorFor(NewInstanceStub.class, "newInstanceC", false); + public static final ForeignCallDescriptor NEW_INSTANCE_C = descriptorFor(NewInstanceStub.class, "newInstanceC"); @NodeIntrinsic(CRuntimeCall.class) public static native void newInstanceC(@ConstantNodeParameter ForeignCallDescriptor newInstanceC, Word thread, Word hub); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewMultiArrayStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewMultiArrayStub.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewMultiArrayStub.java Thu May 16 16:32:46 2013 +0200 @@ -52,7 +52,7 @@ return verifyObject(getAndClearObjectResult(thread())); } - public static final ForeignCallDescriptor NEW_MULTI_ARRAY_C = descriptorFor(NewMultiArrayStub.class, "newMultiArrayC", false); + public static final ForeignCallDescriptor NEW_MULTI_ARRAY_C = descriptorFor(NewMultiArrayStub.class, "newMultiArrayC"); @NodeIntrinsic(CRuntimeCall.class) public static native void newMultiArrayC(@ConstantNodeParameter ForeignCallDescriptor newArrayC, Word thread, Word hub, int rank, Word dims); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/OSRMigrationEndStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/OSRMigrationEndStub.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/OSRMigrationEndStub.java Thu May 16 16:32:46 2013 +0200 @@ -50,7 +50,7 @@ osrMigrationEndC(OSR_MIGRATION_END_C, buffer); } - public static final ForeignCallDescriptor OSR_MIGRATION_END_C = descriptorFor(OSRMigrationEndStub.class, "osrMigrationEndC", false); + public static final ForeignCallDescriptor OSR_MIGRATION_END_C = descriptorFor(OSRMigrationEndStub.class, "osrMigrationEndC"); @NodeIntrinsic(CRuntimeCall.class) public static native void osrMigrationEndC(@ConstantNodeParameter ForeignCallDescriptor osrMigrationEndC, Word buffer); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/RuntimeCallStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/RuntimeCallStub.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/RuntimeCallStub.java Thu May 16 16:32:46 2013 +0200 @@ -78,7 +78,7 @@ super(runtime, replacements, HotSpotRuntimeCallTarget.create(sig, 0L, PRESERVES_REGISTERS, JavaCallee, NOT_LEAF)); this.prependThread = prependThread; Class[] targetParameterTypes = createTargetParameters(sig); - ForeignCallDescriptor targetSig = new ForeignCallDescriptor(sig.getName() + ":C", sig.hasSideEffect(), sig.getResultType(), targetParameterTypes); + ForeignCallDescriptor targetSig = new ForeignCallDescriptor(sig.getName() + ":C", sig.getResultType(), targetParameterTypes); target = HotSpotRuntimeCallTarget.create(targetSig, address, DESTROYS_REGISTERS, NativeCall, NOT_LEAF); } diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubUtil.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubUtil.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubUtil.java Thu May 16 16:32:46 2013 +0200 @@ -46,13 +46,13 @@ */ public class StubUtil { - public static final ForeignCallDescriptor VM_MESSAGE_C = descriptorFor(StubUtil.class, "vmMessageC", false); + public static final ForeignCallDescriptor VM_MESSAGE_C = descriptorFor(StubUtil.class, "vmMessageC"); /** * Looks for a {@link CRuntimeCall} node intrinsic named {@code name} in {@code stubClass} and * returns a {@link ForeignCallDescriptor} based on its signature and the value of {@code hasSideEffect}. */ - public static ForeignCallDescriptor descriptorFor(Class stubClass, String name, boolean hasSideEffect) { + public static ForeignCallDescriptor descriptorFor(Class stubClass, String name) { Method found = null; for (Method method : stubClass.getDeclaredMethods()) { if (Modifier.isStatic(method.getModifiers()) && method.getAnnotation(NodeIntrinsic.class) != null && method.getName().equals(name)) { @@ -67,7 +67,7 @@ assert found != null : "could not find C runtime call named " + name + " in " + stubClass; List> paramList = Arrays.asList(found.getParameterTypes()); Class[] cCallTypes = paramList.subList(1, paramList.size()).toArray(new Class[paramList.size() - 1]); - return new ForeignCallDescriptor(name, hasSideEffect, found.getReturnType(), cCallTypes); + return new ForeignCallDescriptor(name, found.getReturnType(), cCallTypes); } public static void handlePendingException(boolean isObjectResult) { diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ThreadIsInterruptedStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ThreadIsInterruptedStub.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ThreadIsInterruptedStub.java Thu May 16 16:32:46 2013 +0200 @@ -52,7 +52,7 @@ return result; } - public static final ForeignCallDescriptor THREAD_IS_INTERRUPTED_C = descriptorFor(ThreadIsInterruptedStub.class, "threadIsInterruptedC", false); + public static final ForeignCallDescriptor THREAD_IS_INTERRUPTED_C = descriptorFor(ThreadIsInterruptedStub.class, "threadIsInterruptedC"); @NodeIntrinsic(CRuntimeCall.class) public static native boolean threadIsInterruptedC(@ConstantNodeParameter ForeignCallDescriptor threadIsInterruptedC, Word thread, Thread receiverThread, boolean clearIsInterrupted); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UnwindExceptionToCallerStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UnwindExceptionToCallerStub.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UnwindExceptionToCallerStub.java Thu May 16 16:32:46 2013 +0200 @@ -97,7 +97,7 @@ return enabled || graalRuntime().getConfig().cAssertions; } - public static final ForeignCallDescriptor EXCEPTION_HANDLER_FOR_RETURN_ADDRESS = descriptorFor(UnwindExceptionToCallerStub.class, "exceptionHandlerForReturnAddress", false); + public static final ForeignCallDescriptor EXCEPTION_HANDLER_FOR_RETURN_ADDRESS = descriptorFor(UnwindExceptionToCallerStub.class, "exceptionHandlerForReturnAddress"); @NodeIntrinsic(value = CRuntimeCall.class, setStampFromReturnType = true) public static native Word exceptionHandlerForReturnAddress(@ConstantNodeParameter ForeignCallDescriptor exceptionHandlerForReturnAddress, Word thread, Word returnAddress); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/VMErrorStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/VMErrorStub.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/VMErrorStub.java Thu May 16 16:32:46 2013 +0200 @@ -50,7 +50,7 @@ vmErrorC(VM_ERROR_C, thread(), where, format, value); } - public static final ForeignCallDescriptor VM_ERROR_C = descriptorFor(VMErrorStub.class, "vmErrorC", false); + public static final ForeignCallDescriptor VM_ERROR_C = descriptorFor(VMErrorStub.class, "vmErrorC"); @NodeIntrinsic(CRuntimeCall.class) public static native void vmErrorC(@ConstantNodeParameter ForeignCallDescriptor vmErrorC, Word thread, String where, String format, long value); diff -r 951d5ebf3c49 -r 34c892fdfb6d 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 Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu May 16 16:32:46 2013 +0200 @@ -58,8 +58,8 @@ public static final class RuntimeCalls { - public static final ForeignCallDescriptor CREATE_NULL_POINTER_EXCEPTION = new ForeignCallDescriptor("createNullPointerException", true, Object.class); - public static final ForeignCallDescriptor CREATE_OUT_OF_BOUNDS_EXCEPTION = new ForeignCallDescriptor("createOutOfBoundsException", true, Object.class, int.class); + public static final ForeignCallDescriptor CREATE_NULL_POINTER_EXCEPTION = new ForeignCallDescriptor("createNullPointerException", Object.class); + public static final ForeignCallDescriptor CREATE_OUT_OF_BOUNDS_EXCEPTION = new ForeignCallDescriptor("createOutOfBoundsException", Object.class, int.class); } /** @@ -940,7 +940,7 @@ ValueNode exception = ConstantNode.forObject(cachedNullPointerException, runtime, currentGraph); trueSucc.setNext(handleException(exception, bci())); } else { - RuntimeCallStateSplitNode call = currentGraph.add(new RuntimeCallStateSplitNode(CREATE_NULL_POINTER_EXCEPTION)); + RuntimeCallStateSplitNode call = currentGraph.add(new RuntimeCallStateSplitNode(runtime, CREATE_NULL_POINTER_EXCEPTION)); call.setStateAfter(frameState.create(bci())); trueSucc.setNext(call); call.setNext(handleException(call, bci())); @@ -966,7 +966,7 @@ ValueNode exception = ConstantNode.forObject(cachedArrayIndexOutOfBoundsException, runtime, currentGraph); falseSucc.setNext(handleException(exception, bci())); } else { - RuntimeCallStateSplitNode call = currentGraph.add(new RuntimeCallStateSplitNode(CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); + RuntimeCallStateSplitNode call = currentGraph.add(new RuntimeCallStateSplitNode(runtime, CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); call.setStateAfter(frameState.create(bci())); falseSucc.setNext(call); call.setNext(handleException(call, bci())); diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/RuntimeCallStateSplitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/RuntimeCallStateSplitNode.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/RuntimeCallStateSplitNode.java Thu May 16 16:32:46 2013 +0200 @@ -34,9 +34,11 @@ public class RuntimeCallStateSplitNode extends RuntimeCallNode implements LIRLowerable, StateSplit, DeoptimizingNode { @Input(notDataflow = true) private FrameState stateAfter; + private MetaAccessProvider runtime; - public RuntimeCallStateSplitNode(ForeignCallDescriptor descriptor, ValueNode... arguments) { + public RuntimeCallStateSplitNode(MetaAccessProvider runtime, ForeignCallDescriptor descriptor, ValueNode... arguments) { super(descriptor, arguments); + this.runtime = runtime; } public FrameState stateAfter() { @@ -50,7 +52,7 @@ } public boolean hasSideEffect() { - return getDescriptor().hasSideEffect(); + return runtime.hasSideEffect(getDescriptor()); } @Override diff -r 951d5ebf3c49 -r 34c892fdfb6d 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 Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Thu May 16 16:32:46 2013 +0200 @@ -34,7 +34,7 @@ */ public final class RegisterFinalizerNode extends AbstractStateSplit implements StateSplit, Canonicalizable, LIRLowerable, Virtualizable, DeoptimizingNode { - public static final ForeignCallDescriptor REGISTER_FINALIZER = new ForeignCallDescriptor("registerFinalizer", true, void.class, Object.class); + public static final ForeignCallDescriptor REGISTER_FINALIZER = new ForeignCallDescriptor("registerFinalizer", void.class, Object.class); @Input private FrameState deoptState; @Input private ValueNode object; diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java Thu May 16 16:32:46 2013 +0200 @@ -36,9 +36,9 @@ */ public final class Log { - public static final ForeignCallDescriptor LOG_PRIMITIVE = new ForeignCallDescriptor("logPrimitive", false, void.class, int.class, long.class, boolean.class); - public static final ForeignCallDescriptor LOG_OBJECT = new ForeignCallDescriptor("logObject", false, void.class, Object.class, int.class); - public static final ForeignCallDescriptor LOG_PRINTF = new ForeignCallDescriptor("logPrintf", false, void.class, Object.class, long.class, long.class, long.class); + public static final ForeignCallDescriptor LOG_PRIMITIVE = new ForeignCallDescriptor("logPrimitive", void.class, int.class, long.class, boolean.class); + public static final ForeignCallDescriptor LOG_OBJECT = new ForeignCallDescriptor("logObject", void.class, Object.class, int.class); + public static final ForeignCallDescriptor LOG_PRINTF = new ForeignCallDescriptor("logPrintf", void.class, Object.class, long.class, long.class, long.class); // Note: Must be kept in sync with constants in graalRuntime.hpp private static final int LOG_OBJECT_NEWLINE = 0x01; diff -r 951d5ebf3c49 -r 34c892fdfb6d graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MathSubstitutionsX86.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MathSubstitutionsX86.java Thu May 16 16:17:28 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MathSubstitutionsX86.java Thu May 16 16:32:46 2013 +0200 @@ -91,9 +91,9 @@ } } - public static final ForeignCallDescriptor ARITHMETIC_SIN = new ForeignCallDescriptor("arithmeticSin", false, double.class, double.class); - public static final ForeignCallDescriptor ARITHMETIC_COS = new ForeignCallDescriptor("arithmeticCos", false, double.class, double.class); - public static final ForeignCallDescriptor ARITHMETIC_TAN = new ForeignCallDescriptor("arithmeticTan", false, double.class, double.class); + public static final ForeignCallDescriptor ARITHMETIC_SIN = new ForeignCallDescriptor("arithmeticSin", double.class, double.class); + public static final ForeignCallDescriptor ARITHMETIC_COS = new ForeignCallDescriptor("arithmeticCos", double.class, double.class); + public static final ForeignCallDescriptor ARITHMETIC_TAN = new ForeignCallDescriptor("arithmeticTan", double.class, double.class); @NodeIntrinsic(value = RuntimeCallNode.class, setStampFromReturnType = true) public static double callDouble(@ConstantNodeParameter ForeignCallDescriptor descriptor, double value) {