diff --git a/makefile b/makefile index 214888f396..9104e7bdfd 100644 --- a/makefile +++ b/makefile @@ -28,7 +28,7 @@ src = src classpath = classpath test = test -input = $(test-build)/Threads.class +input = $(test-build)/List.class build-cxx = g++ build-cc = gcc diff --git a/src/compile.cpp b/src/compile.cpp index 43f73e22f1..884d69ab3f 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -18,7 +18,7 @@ vmJump(void* address, void* base, void* stack, void* thread); namespace { -const bool Verbose = false; +const bool Verbose = true; const bool DebugTraces = false; class MyThread: public Thread { @@ -613,10 +613,10 @@ class Frame { } void pushLong(Operand* o) { - stack = c->push(stack, o); if (BytesPerWord == 8) { stack = c->push(stack, 1); } + stack = c->push(stack, o); pushedInt(); pushedInt(); @@ -673,10 +673,10 @@ class Frame { } void popLong(Operand* o) { + stack = c->pop(stack, o); if (BytesPerWord == 8) { stack = c->pop(stack, 1); } - stack = c->pop(stack, o); poppedInt(); poppedInt(); @@ -702,10 +702,7 @@ class Frame { assert(t, index < parameterFootprint(t, method) or getBit(map, index + 1 - parameterFootprint(t, method)) == 0); pushLong - (c->select8 - (c->memory - (c->base(), - localOffset(t, index + (4 / BytesPerWord), method)))); + (c->select8 (c->memory (c->base(), localOffset(t, index + 1, method)))); } void loadObject(unsigned index) { @@ -722,10 +719,7 @@ class Frame { void storeLong(unsigned index) { popLong - (c->select8 - (c->memory - (c->base(), - localOffset(t, index + (4 / BytesPerWord), method)))); + (c->select8(c->memory(c->base(), localOffset(t, index + 1, method)))); storedInt(index); storedInt(index + 1); } @@ -3084,10 +3078,10 @@ finish(MyThread* t, Compiler* c, object method, Vector* objectPool, if (false and strcmp(reinterpret_cast (&byteArrayBody(t, className(t, methodClass(t, method)), 0)), - "GC") == 0 and + "Floats") == 0 and strcmp(reinterpret_cast (&byteArrayBody(t, methodName(t, method), 0)), - "medium") == 0) + "multiply") == 0) { asm("int3"); } @@ -3256,11 +3250,7 @@ invokeNative2(MyThread* t, object method) case INT64_TYPE: case DOUBLE_TYPE: { - if (BytesPerWord == 8) { - memcpy(args + argOffset, sp, 8); - } else { - memcpy(args + argOffset, sp - 1, 8); - } + memcpy(args + argOffset, sp - 1, 8); argOffset += (8 / BytesPerWord); sp -= 2; } break; diff --git a/src/compiler.cpp b/src/compiler.cpp index ecbed45b15..352604e213 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -1344,8 +1344,6 @@ RegisterOperand::accept(Context* c, Operation operation, break; case mul: - assert(c, selection == operand->selection); - rex(c, selection); c->code.append(0x0f); c->code.append(0xaf); @@ -1360,13 +1358,12 @@ void RegisterOperand::accept(Context* c, Operation operation, ImmediateOperand* operand) { - assert(c, selection == DefaultSelection); assert(c, operand->selection == DefaultSelection); switch (operation) { case add: { if (operand->value) { - rex(c); + rex(c, selection); if (isInt8(operand->value)) { c->code.append(0x83); c->code.append(0xc0 | value(c)); @@ -1392,7 +1389,7 @@ RegisterOperand::accept(Context* c, Operation operation, break; case and_: { - rex(c); + rex(c, selection); if (isInt8(operand->value)) { c->code.append(0x83); c->code.append(0xe0 | value(c)); @@ -1409,7 +1406,7 @@ RegisterOperand::accept(Context* c, Operation operation, case cmp: { assert(c, isInt8(operand->value)); // todo - rex(c); + rex(c, selection); c->code.append(0x83); c->code.append(0xf8 | value(c)); c->code.append(operand->value); @@ -1423,7 +1420,7 @@ RegisterOperand::accept(Context* c, Operation operation, case shl: { if (operand->value) { - rex(c); + rex(c, selection); if (operand->value == 1) { c->code.append(0xd1); c->code.append(0xe0 | value(c)); @@ -1439,7 +1436,7 @@ RegisterOperand::accept(Context* c, Operation operation, case sub: { if (operand->value) { - rex(c); + rex(c, selection); if (isInt8(operand->value)) { c->code.append(0x83); c->code.append(0xe8 | value(c)); @@ -1487,8 +1484,6 @@ void RegisterOperand::accept(Context* c, Operation operation, MemoryOperand* operand) { - assert(c, selection == DefaultSelection); - switch (operation) { case cmp: { if (operand->selection == DefaultSelection @@ -1943,10 +1938,8 @@ MemoryOperand::accept(Context* c, Operation operation, } break; case mov: { - if (operand->selection == DefaultSelection - or operand->selection == Select4) - { - encode(c, 0x89, operand->value(c), this, operand->selection); + if (operand->selection == DefaultSelection) { + encode(c, 0x89, operand->value(c), this, true); } else { switch (operand->selection) { case Select1: