various JIT bugfixes

This commit is contained in:
Joel Dice 2007-10-09 13:30:01 -06:00
parent defa8c62ac
commit 915ade9ccc

View File

@ -339,6 +339,8 @@ void NO_RETURN
throwNew(MyThread* t, object class_) throwNew(MyThread* t, object class_)
{ {
t->exception = makeNew(t, class_); t->exception = makeNew(t, class_);
object trace = makeTrace(t);
set(t, cast<object>(t->exception, ThrowableTrace), trace);
unwind(t); unwind(t);
} }
@ -492,7 +494,7 @@ invokeNative2(MyThread* t, object method)
} }
if (LIKELY(t->exception == 0) and returnType == POINTER_TYPE) { if (LIKELY(t->exception == 0) and returnType == POINTER_TYPE) {
return *reinterpret_cast<uintptr_t*>(result); return result ? *reinterpret_cast<uintptr_t*>(result) : 0;
} else { } else {
return result; return result;
} }
@ -1002,6 +1004,7 @@ class Assembler {
void cmp(int v, Register reg) { void cmp(int v, Register reg) {
assert(code.s, isByte(v)); // todo assert(code.s, isByte(v)); // todo
rex();
code.append(0x83); code.append(0x83);
code.append(0xf8 | reg); code.append(0xf8 | reg);
code.append(v); code.append(v);
@ -1543,7 +1546,7 @@ class Compiler: public Assembler {
pop(rax); pop(rax);
cmp(0, rax); cmp(0, rax);
jle(nonnegative); jge(nonnegative);
compileCall compileCall
(reinterpret_cast<void*>(throwNew), (reinterpret_cast<void*>(throwNew),
@ -2642,7 +2645,7 @@ class Compiler: public Assembler {
if (poolRegisterClobbered) { if (poolRegisterClobbered) {
mov(rbp, FrameMethod, rdi); mov(rbp, FrameMethod, rdi);
mov(rdi, MethodCode, rdi); mov(rdi, MethodCode, rdi);
poolRegisterClobbered = false; //poolRegisterClobbered = false;
} }
pool.appendAddress(reinterpret_cast<uintptr_t>(o)); pool.appendAddress(reinterpret_cast<uintptr_t>(o));
return pool.length() + BytesPerWord; return pool.length() + BytesPerWord;