diff --git a/makefile b/makefile index 8c300ac823..241f607fd5 100644 --- a/makefile +++ b/makefile @@ -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 diff --git a/src/compile.S b/src/compile.S index 754d394d75..89bf8467da 100644 --- a/src/compile.S +++ b/src/compile.S @@ -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 diff --git a/src/compile.cpp b/src/compile.cpp index c4bf495068..bd8264f1f4 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -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(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(base) + 1; base = *static_cast(base); } } else { - vmJump(returnAddress, base, stack + 1); + vmJump(returnAddress, base, stack + 1, 0); } } }