* src/vm/jit/trap.c (trap_handle): Update executionstates PC register in case
authorMichael Starzinger <michi@complang.tuwien.ac.at>
Tue, 16 Sep 2008 14:33:51 +0000 (16:33 +0200)
committerMichael Starzinger <michi@complang.tuwien.ac.at>
Tue, 16 Sep 2008 14:33:51 +0000 (16:33 +0200)
of successful patcher trap.
* src/vm/jit/alpha/linux/md-os.c: Further simplified signal handler.

src/vm/jit/alpha/linux/md-os.c
src/vm/jit/trap.c

index 8f9c58746d651c6d69bb675bd95a79615fc9e58d..8e127a9fab4e3bae10487216f640ecdda617c28a 100644 (file)
@@ -156,13 +156,7 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p)
        intptr_t val  = 0;
 
        // Handle the trap.
-       void* p = trap_handle(type, val, pv, sp, ra, xpc, _p);
-
-       // Set registers
-       if (p == NULL) {
-               // We need to set the PC because we adjusted it above.
-               _mc->sc_pc                   = (uintptr_t) xpc;
-       }
+       trap_handle(type, val, pv, sp, ra, xpc, _p);
 }
 
 
index 0f9152b4f281809413eda7af9238f0e7abb9c553..1ac7ffe7e71e6d016b8d3a8594b75da78803f214 100644 (file)
@@ -246,7 +246,7 @@ void* trap_handle(int type, intptr_t val, void *pv, void *sp, void *ra, void *xp
 
        switch (type) {
        case TRAP_COMPILER:
-               // The default case for a compiler trap is to jump directly to
+               // The normal case for a compiler trap is to jump directly to
                // the newly compiled method.
 
                if (p != NULL) {
@@ -270,9 +270,20 @@ void* trap_handle(int type, intptr_t val, void *pv, void *sp, void *ra, void *xp
                es.intregs[REG_ITMP1_XPTR] = (uintptr_t) LLNI_DIRECT(e);
                es.intregs[REG_ITMP2_XPC]  = (uintptr_t) xpc;
                es.pc                      = (uint8_t *) (uintptr_t) asm_handle_exception;
-
                break;
 
+       case TRAP_PATCHER:
+               // The normal case for a patcher trap is to continue execution at
+               // the trap instruction. On some archs the PC may point after the
+               // trap instruction, so we reset it here.
+
+               if (p == NULL) {
+                       es.pc = (uint8_t *) (uintptr_t) xpc;
+                       break;
+               }
+
+               /* fall-through */
+
        default:
                if (p != NULL) {
                        es.intregs[REG_ITMP1_XPTR] = (uintptr_t) LLNI_DIRECT(p);