From 8cd18d6193cc04f3b0d854c10bca743bad077010 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sun, 23 Dec 2007 13:06:24 -0700 Subject: [PATCH] more JIT bugfixes --- makefile | 2 +- src/compile.cpp | 12 ++++++++---- src/compiler.cpp | 34 +++++++++++++++++++++------------- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/makefile b/makefile index 9104e7bdfd..4791b502cc 100644 --- a/makefile +++ b/makefile @@ -28,7 +28,7 @@ src = src classpath = classpath test = test -input = $(test-build)/List.class +input = $(test-build)/Misc.class build-cxx = g++ build-cc = gcc diff --git a/src/compile.cpp b/src/compile.cpp index 8687f2f7eb..4fb297e538 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -3081,10 +3081,10 @@ finish(MyThread* t, Compiler* c, object method, Vector* objectPool, if (false and strcmp(reinterpret_cast (&byteArrayBody(t, className(t, methodClass(t, method)), 0)), - "Floats") == 0 and + "java/lang/Math") == 0 and strcmp(reinterpret_cast (&byteArrayBody(t, methodName(t, method), 0)), - "multiply") == 0) + "max") == 0) { asm("int3"); } @@ -3562,9 +3562,13 @@ class ArgumentList { } void addLong(uint64_t v) { - memcpy(array + position, &v, 8); - objectMask[position] = false; + if (BytesPerWord == 8) { + memcpy(array + position + 1, &v, 8); + } else { + memcpy(array + position, &v, 8); + } objectMask[position] = false; + objectMask[position + 1] = false; position += 2; } diff --git a/src/compiler.cpp b/src/compiler.cpp index 352604e213..a685b0431d 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -1221,8 +1221,7 @@ RegisterOperand::apply(Context* c, Operation operation) break; case push: - if (selection == DefaultSelection or selection == Select4 - or (BytesPerWord == 8 and selection == Select8From4)) + if (selection == DefaultSelection or selection == Select4) { c->code.append(0x50 | value(c)); } else { @@ -1233,16 +1232,23 @@ RegisterOperand::apply(Context* c, Operation operation) break; case Select8From4: { - RegisterOperand* ax = temporary(c, rax); - RegisterOperand* dx = temporary(c, rdx); - - ax->accept(c, mov, register_(c, value(c))); - c->code.append(0x99); // cdq - dx->apply(c, push); - ax->apply(c, push); - - ax->release(c); - dx->release(c); + if (BytesPerWord == 8) { + RegisterOperand* fullSize = register_ + (c, reference, DefaultSelection); + fullSize->accept(c, mov, this); + fullSize->apply(c, operation); + } else { + RegisterOperand* ax = temporary(c, rax); + RegisterOperand* dx = temporary(c, rdx); + + ax->accept(c, mov, register_(c, value(c))); + c->code.append(0x99); // cdq + dx->apply(c, push); + ax->apply(c, push); + + ax->release(c); + dx->release(c); + } } break; default: abort(c); @@ -1325,7 +1331,9 @@ RegisterOperand::accept(Context* c, Operation operation, break; case Select4: - c->code.append(0x89); + case Select8From4: + rex(c); + c->code.append(0x63); c->code.append(0xc0 | (operand->value(c) << 3) | value(c)); break;