fix JIT regressions on amd64

This commit is contained in:
Joel Dice 2007-12-23 12:18:34 -07:00
parent 15857135c0
commit f87a78833b
3 changed files with 16 additions and 33 deletions

View File

@ -28,7 +28,7 @@ src = src
classpath = classpath classpath = classpath
test = test test = test
input = $(test-build)/Threads.class input = $(test-build)/List.class
build-cxx = g++ build-cxx = g++
build-cc = gcc build-cc = gcc

View File

@ -18,7 +18,7 @@ vmJump(void* address, void* base, void* stack, void* thread);
namespace { namespace {
const bool Verbose = false; const bool Verbose = true;
const bool DebugTraces = false; const bool DebugTraces = false;
class MyThread: public Thread { class MyThread: public Thread {
@ -613,10 +613,10 @@ class Frame {
} }
void pushLong(Operand* o) { void pushLong(Operand* o) {
stack = c->push(stack, o);
if (BytesPerWord == 8) { if (BytesPerWord == 8) {
stack = c->push(stack, 1); stack = c->push(stack, 1);
} }
stack = c->push(stack, o);
pushedInt(); pushedInt();
pushedInt(); pushedInt();
@ -673,10 +673,10 @@ class Frame {
} }
void popLong(Operand* o) { void popLong(Operand* o) {
stack = c->pop(stack, o);
if (BytesPerWord == 8) { if (BytesPerWord == 8) {
stack = c->pop(stack, 1); stack = c->pop(stack, 1);
} }
stack = c->pop(stack, o);
poppedInt(); poppedInt();
poppedInt(); poppedInt();
@ -702,10 +702,7 @@ class Frame {
assert(t, index < parameterFootprint(t, method) assert(t, index < parameterFootprint(t, method)
or getBit(map, index + 1 - parameterFootprint(t, method)) == 0); or getBit(map, index + 1 - parameterFootprint(t, method)) == 0);
pushLong pushLong
(c->select8 (c->select8 (c->memory (c->base(), localOffset(t, index + 1, method))));
(c->memory
(c->base(),
localOffset(t, index + (4 / BytesPerWord), method))));
} }
void loadObject(unsigned index) { void loadObject(unsigned index) {
@ -722,10 +719,7 @@ class Frame {
void storeLong(unsigned index) { void storeLong(unsigned index) {
popLong popLong
(c->select8 (c->select8(c->memory(c->base(), localOffset(t, index + 1, method))));
(c->memory
(c->base(),
localOffset(t, index + (4 / BytesPerWord), method))));
storedInt(index); storedInt(index);
storedInt(index + 1); storedInt(index + 1);
} }
@ -3084,10 +3078,10 @@ finish(MyThread* t, Compiler* c, object method, Vector* objectPool,
if (false and if (false and
strcmp(reinterpret_cast<const char*> strcmp(reinterpret_cast<const char*>
(&byteArrayBody(t, className(t, methodClass(t, method)), 0)), (&byteArrayBody(t, className(t, methodClass(t, method)), 0)),
"GC") == 0 and "Floats") == 0 and
strcmp(reinterpret_cast<const char*> strcmp(reinterpret_cast<const char*>
(&byteArrayBody(t, methodName(t, method), 0)), (&byteArrayBody(t, methodName(t, method), 0)),
"medium") == 0) "multiply") == 0)
{ {
asm("int3"); asm("int3");
} }
@ -3256,11 +3250,7 @@ invokeNative2(MyThread* t, object method)
case INT64_TYPE: case INT64_TYPE:
case DOUBLE_TYPE: { case DOUBLE_TYPE: {
if (BytesPerWord == 8) { memcpy(args + argOffset, sp - 1, 8);
memcpy(args + argOffset, sp, 8);
} else {
memcpy(args + argOffset, sp - 1, 8);
}
argOffset += (8 / BytesPerWord); argOffset += (8 / BytesPerWord);
sp -= 2; sp -= 2;
} break; } break;

View File

@ -1344,8 +1344,6 @@ RegisterOperand::accept(Context* c, Operation operation,
break; break;
case mul: case mul:
assert(c, selection == operand->selection);
rex(c, selection); rex(c, selection);
c->code.append(0x0f); c->code.append(0x0f);
c->code.append(0xaf); c->code.append(0xaf);
@ -1360,13 +1358,12 @@ void
RegisterOperand::accept(Context* c, Operation operation, RegisterOperand::accept(Context* c, Operation operation,
ImmediateOperand* operand) ImmediateOperand* operand)
{ {
assert(c, selection == DefaultSelection);
assert(c, operand->selection == DefaultSelection); assert(c, operand->selection == DefaultSelection);
switch (operation) { switch (operation) {
case add: { case add: {
if (operand->value) { if (operand->value) {
rex(c); rex(c, selection);
if (isInt8(operand->value)) { if (isInt8(operand->value)) {
c->code.append(0x83); c->code.append(0x83);
c->code.append(0xc0 | value(c)); c->code.append(0xc0 | value(c));
@ -1392,7 +1389,7 @@ RegisterOperand::accept(Context* c, Operation operation,
break; break;
case and_: { case and_: {
rex(c); rex(c, selection);
if (isInt8(operand->value)) { if (isInt8(operand->value)) {
c->code.append(0x83); c->code.append(0x83);
c->code.append(0xe0 | value(c)); c->code.append(0xe0 | value(c));
@ -1409,7 +1406,7 @@ RegisterOperand::accept(Context* c, Operation operation,
case cmp: { case cmp: {
assert(c, isInt8(operand->value)); // todo assert(c, isInt8(operand->value)); // todo
rex(c); rex(c, selection);
c->code.append(0x83); c->code.append(0x83);
c->code.append(0xf8 | value(c)); c->code.append(0xf8 | value(c));
c->code.append(operand->value); c->code.append(operand->value);
@ -1423,7 +1420,7 @@ RegisterOperand::accept(Context* c, Operation operation,
case shl: { case shl: {
if (operand->value) { if (operand->value) {
rex(c); rex(c, selection);
if (operand->value == 1) { if (operand->value == 1) {
c->code.append(0xd1); c->code.append(0xd1);
c->code.append(0xe0 | value(c)); c->code.append(0xe0 | value(c));
@ -1439,7 +1436,7 @@ RegisterOperand::accept(Context* c, Operation operation,
case sub: { case sub: {
if (operand->value) { if (operand->value) {
rex(c); rex(c, selection);
if (isInt8(operand->value)) { if (isInt8(operand->value)) {
c->code.append(0x83); c->code.append(0x83);
c->code.append(0xe8 | value(c)); c->code.append(0xe8 | value(c));
@ -1487,8 +1484,6 @@ void
RegisterOperand::accept(Context* c, Operation operation, RegisterOperand::accept(Context* c, Operation operation,
MemoryOperand* operand) MemoryOperand* operand)
{ {
assert(c, selection == DefaultSelection);
switch (operation) { switch (operation) {
case cmp: { case cmp: {
if (operand->selection == DefaultSelection if (operand->selection == DefaultSelection
@ -1943,10 +1938,8 @@ MemoryOperand::accept(Context* c, Operation operation,
} break; } break;
case mov: { case mov: {
if (operand->selection == DefaultSelection if (operand->selection == DefaultSelection) {
or operand->selection == Select4) encode(c, 0x89, operand->value(c), this, true);
{
encode(c, 0x89, operand->value(c), this, operand->selection);
} else { } else {
switch (operand->selection) { switch (operand->selection) {
case Select1: case Select1: