fix stack pointer calculation in unwind code and set rbx to thread pointer when unwinding

This commit is contained in:
Joel Dice 2007-12-15 18:00:25 -07:00
parent 796a64a426
commit 86218ebcb8
3 changed files with 9 additions and 8 deletions

View File

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

View File

@ -57,6 +57,7 @@ test:
vmJump:
movq %rsi,%rbp
movq %rdx,%rsp
movq %rcx,%rbx
jmp *%rdi
#elif defined __i386__
@ -134,6 +135,7 @@ vmJump:
movl 4(%esp),%eax
movl 8(%esp),%ebp
movl 12(%esp),%esp
movl 16(%esp),%ebx
jmp *%eax
#else

View File

@ -14,12 +14,12 @@ extern "C" void
vmCall();
extern "C" void NO_RETURN
vmJump(void* address, void* base, void* stack);
vmJump(void* address, void* base, void* stack, void* thread);
namespace {
const bool Verbose = true;
const bool DebugTraces = false;
const bool DebugTraces = true;
class MyThread: public Thread {
public:
@ -847,20 +847,19 @@ unwind(MyThread* t)
unsigned parameterFootprint = methodParameterFootprint(t, method);
unsigned localFootprint = codeMaxLocals(t, methodCode(t, method));
if (localFootprint > parameterFootprint) {
stack -= (localFootprint - parameterFootprint);
}
stack = static_cast<void**>(base)
- (localFootprint - parameterFootprint);
*(--stack) = t->exception;
t->exception = 0;
vmJump(compiled + exceptionHandlerIp(handler), base, stack);
vmJump(compiled + exceptionHandlerIp(handler), base, stack, t);
} else {
stack = static_cast<void**>(base) + 1;
base = *static_cast<void**>(base);
}
} else {
vmJump(returnAddress, base, stack + 1);
vmJump(returnAddress, base, stack + 1, 0);
}
}
}