# HG changeset patch # User Christian Haeubl # Date 1358327949 -3600 # Node ID 5f00bf5a530d6541bb8dba1fc483376688cb48e8 # Parent 42b6e090588193f3538a2d922ec255dc205dc6c9 windows-specific bugfix diff -r 42b6e0905881 -r 5f00bf5a530d 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 Jan 16 09:08:24 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java Wed Jan 16 10:19:09 2013 +0100 @@ -70,26 +70,26 @@ addRuntimeCall(ARITHMETIC_FREM, config.arithmeticFremStub, /* temps */ null, /* ret */ ret(Kind.Float), - /* arg0: a */ jarg(0, Kind.Float), - /* arg1: b */ jarg(1, Kind.Float)); + /* arg0: a */ javaCallingConvention(Kind.Float, + /* arg1: b */ Kind.Float)); addRuntimeCall(ARITHMETIC_DREM, config.arithmeticDremStub, /* temps */ null, /* ret */ ret(Kind.Double), - /* arg0: a */ jarg(0, Kind.Double), - /* arg1: b */ jarg(1, Kind.Double)); + /* arg0: a */ javaCallingConvention(Kind.Double, + /* arg1: b */ Kind.Double)); addRuntimeCall(MONITORENTER, config.monitorEnterStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: object */ jarg(0, Kind.Object), - /* arg1: lock */ jarg(1, word)); + /* arg0: object */ javaCallingConvention(Kind.Object, + /* arg1: lock */ word)); addRuntimeCall(MONITOREXIT, config.monitorExitStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: object */ jarg(0, Kind.Object), - /* arg1: lock */ jarg(1, word)); + /* arg0: object */ javaCallingConvention(Kind.Object, + /* arg1: lock */ word)); addRuntimeCall(NEW_ARRAY, 0L, /* temps */ null, @@ -128,52 +128,52 @@ addRuntimeCall(VM_ERROR, config.vmErrorStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: where */ jarg(0, Kind.Object), - /* arg1: format */ jarg(1, Kind.Object), - /* arg2: value */ jarg(2, Kind.Long)); + /* arg0: where */ javaCallingConvention(Kind.Object, + /* arg1: format */ Kind.Object, + /* arg2: value */ Kind.Long)); addRuntimeCall(IDENTITY_HASHCODE, config.identityHashCodeStub, /* temps */ null, /* ret */ rax.asValue(Kind.Int), - /* arg0: obj */ jarg(0, Kind.Object)); + /* arg0: obj */ javaCallingConvention(Kind.Object)); addRuntimeCall(THREAD_IS_INTERRUPTED, config.threadIsInterruptedStub, /* temps */ null, /* ret */ rax.asValue(Kind.Int), - /* arg0: thread */ jarg(0, Kind.Object), - /* arg1: clearInterrupted */ jarg(1, Kind.Boolean)); + /* arg0: thread */ javaCallingConvention(Kind.Object, + /* arg1: clearInterrupted */ Kind.Boolean)); addRuntimeCall(ENCRYPT_BLOCK, config.aescryptEncryptBlockStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: in */ carg(0, word), - /* arg1: out */ carg(1, word), - /* arg2: key */ carg(2, word)); + /* arg0: in */ nativeCallingConvention(word, + /* arg1: out */ word, + /* arg2: key */ word)); addRuntimeCall(DECRYPT_BLOCK, config.aescryptDecryptBlockStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: in */ carg(0, word), - /* arg1: out */ carg(1, word), - /* arg2: key */ carg(2, word)); + /* arg0: in */ nativeCallingConvention(word, + /* arg1: out */ word, + /* arg2: key */ word)); addRuntimeCall(ENCRYPT, config.cipherBlockChainingEncryptAESCryptStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: in */ carg(0, word), - /* arg1: out */ carg(1, word), - /* arg2: key */ carg(2, word), - /* arg3: r */ carg(3, word), - /* arg4: inLength */ carg(4, Kind.Int)); + /* arg0: in */ nativeCallingConvention(word, + /* arg1: out */ word, + /* arg2: key */ word, + /* arg3: r */ word, + /* arg4: inLength */ Kind.Int)); addRuntimeCall(DECRYPT, config.cipherBlockChainingDecryptAESCryptStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: in */ carg(0, word), - /* arg1: out */ carg(1, word), - /* arg2: key */ carg(2, word), - /* arg3: r */ carg(3, word), - /* arg4: inLength */ carg(4, Kind.Int)); + /* arg0: in */ nativeCallingConvention(word, + /* arg1: out */ word, + /* arg2: key */ word, + /* arg3: r */ word, + /* arg4: inLength */ Kind.Int)); } @Override diff -r 42b6e0905881 -r 5f00bf5a530d 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 Jan 16 09:08:24 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Wed Jan 16 10:19:09 2013 +0100 @@ -166,14 +166,31 @@ return globalStubRegConfig.getReturnRegister(kind).asValue(kind); } - protected Value jarg(int index, Kind kind) { - RegisterFlag flag = kind == Kind.Float || kind == Kind.Double ? FPU : CPU; - return globalStubRegConfig.getCallingConventionRegisters(RuntimeCall, flag)[index].asValue(kind); + protected Value[] javaCallingConvention(Kind... arguments) { + return callingConvention(arguments, RuntimeCall); + } + + protected Value[] nativeCallingConvention(Kind... arguments) { + return callingConvention(arguments, NativeCall); } - protected Value carg(int index, Kind kind) { - RegisterFlag flag = kind == Kind.Float || kind == Kind.Double ? FPU : CPU; - return globalStubRegConfig.getCallingConventionRegisters(NativeCall, flag)[index].asValue(kind); + private Value[] callingConvention(Kind[] arguments, CallingConvention.Type type) { + Value[] result = new Value[arguments.length]; + + TargetDescription target = graalRuntime.getTarget(); + int currentStackOffset = 0; + for (int i = 0; i < arguments.length; i++) { + Kind kind = arguments[i]; + RegisterFlag flag = kind == Kind.Float || kind == Kind.Double ? FPU : CPU; + Register[] ccRegs = globalStubRegConfig.getCallingConventionRegisters(type, flag); + if (i < ccRegs.length) { + result[i] = ccRegs[i].asValue(kind); + } else { + result[i] = StackSlot.get(kind.getStackKind(), currentStackOffset, false); + currentStackOffset += Math.max(target.sizeInBytes(kind), target.wordSize); + } + } + return result; } protected Value scratch(Kind kind) { @@ -189,17 +206,17 @@ addRuntimeCall(UNWIND_EXCEPTION, config.unwindExceptionStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: exception */ jarg(0, Kind.Object)); + /* arg0: exception */ javaCallingConvention(Kind.Object)); addRuntimeCall(OnStackReplacementPhase.OSR_MIGRATION_END, config.osrMigrationEndStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: long */ jarg(0, Kind.Long)); + /* arg0: long */ javaCallingConvention(Kind.Long)); addRuntimeCall(REGISTER_FINALIZER, config.registerFinalizerStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: object */ jarg(0, Kind.Object)); + /* arg0: object */ javaCallingConvention(Kind.Object)); addRuntimeCall(CREATE_NULL_POINTER_EXCEPTION, config.createNullPointerExceptionStub, /* temps */ null, @@ -208,7 +225,7 @@ addRuntimeCall(CREATE_OUT_OF_BOUNDS_EXCEPTION, config.createOutOfBoundsExceptionStub, /* temps */ null, /* ret */ ret(Kind.Object), - /* arg0: index */ jarg(0, Kind.Int)); + /* arg0: index */ javaCallingConvention(Kind.Int)); addRuntimeCall(JAVA_TIME_MILLIS, config.javaTimeMillisStub, /* temps */ null, @@ -221,38 +238,38 @@ addRuntimeCall(ARITHMETIC_SIN, config.arithmeticSinStub, /* temps */ null, /* ret */ ret(Kind.Double), - /* arg0: index */ jarg(0, Kind.Double)); + /* arg0: index */ javaCallingConvention(Kind.Double)); addRuntimeCall(ARITHMETIC_COS, config.arithmeticCosStub, /* temps */ null, /* ret */ ret(Kind.Double), - /* arg0: index */ jarg(0, Kind.Double)); + /* arg0: index */ javaCallingConvention(Kind.Double)); addRuntimeCall(ARITHMETIC_TAN, config.arithmeticTanStub, /* temps */ null, /* ret */ ret(Kind.Double), - /* arg0: index */ jarg(0, Kind.Double)); + /* arg0: index */ javaCallingConvention(Kind.Double)); addRuntimeCall(LOG_PRIMITIVE, config.logPrimitiveStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: typeChar */ jarg(0, Kind.Int), - /* arg1: value */ jarg(1, Kind.Long), - /* arg2: newline */ jarg(2, Kind.Boolean)); + /* arg0: typeChar */ javaCallingConvention(Kind.Int, + /* arg1: value */ Kind.Long, + /* arg2: newline */ Kind.Boolean)); addRuntimeCall(LOG_PRINTF, config.logPrintfStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: format */ jarg(0, Kind.Object), - /* arg1: value */ jarg(1, Kind.Long), - /* arg2: value */ jarg(2, Kind.Long), - /* arg3: value */ jarg(3, Kind.Long)); + /* arg0: format */ javaCallingConvention(Kind.Object, + /* arg1: value */ Kind.Long, + /* arg2: value */ Kind.Long, + /* arg3: value */ Kind.Long)); addRuntimeCall(LOG_OBJECT, config.logObjectStub, /* temps */ null, /* ret */ ret(Kind.Void), - /* arg0: object */ jarg(0, Kind.Object), - /* arg1: flags */ jarg(1, Kind.Int)); + /* arg0: object */ javaCallingConvention(Kind.Object, + /* arg1: flags */ Kind.Int)); } diff -r 42b6e0905881 -r 5f00bf5a530d graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Wed Jan 16 09:08:24 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Wed Jan 16 10:19:09 2013 +0100 @@ -53,7 +53,7 @@ public static int MaximumRecursiveInlining = 1; public static int SmallCompiledCodeSize = 2200; public static boolean LimitInlinedProbability = ____; - public static boolean UseRelevanceBasedInlining = true; + public static boolean UseRelevanceBasedInlining = ____; // WeightBasedInliningPolicy (0) public static float InliningSizePenaltyExp = 20; public static float MaximumInlineWeight = 1.25f;