* src/vm/jit/trap.cpp (trap_handle) [__MIPS__]: Use executionstate for trap
[cacao.git] / src / vm / jit / mips / linux / md-os.c
index eef2a2dc6f272bacbddb5b7c08239f41d36fb8cc..e96052f300272ed85144f5b279a3b085220c1cdf 100644 (file)
@@ -101,7 +101,6 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
        intptr_t        val;
        intptr_t        addr;
        int             type;
-       void           *p;
 
        _uc    = (struct ucontext *) _p;
        _mc    = &_uc->uc_mcontext;
@@ -185,45 +184,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 
        /* Handle the trap. */
 
-       p = trap_handle(type, val, pv, sp, ra, xpc, _p);
-
-       /* Set registers. */
-
-       switch (type) {
-       case TRAP_COMPILER:
-               if (p != NULL) {
-                       _gregs[REG_PV]  = (uintptr_t) p;
-#if defined(__UCLIBC__)
-                       _gregs[CTX_EPC] = (uintptr_t) p;
-#else
-                       _mc->pc         = (uintptr_t) p;
-#endif
-                       break;
-               }
-
-               /* Get and set the PV from the parent Java method. */
-
-               pv = md_codegen_get_pv_from_pc(ra);
-
-               _gregs[REG_PV] = (uintptr_t) pv;
-
-               /* Get the exception object. */
-
-               p = builtin_retrieve_exception();
-
-               assert(p != NULL);
-
-               /* fall-through */
-
-       default:
-               _gregs[REG_ITMP1_XPTR] = (uintptr_t) p;
-               _gregs[REG_ITMP2_XPC]  = (uintptr_t) xpc;
-#if defined(__UCLIBC__)
-               _gregs[CTX_EPC]        = (uintptr_t) asm_handle_exception;
-#else
-               _mc->pc                = (uintptr_t) asm_handle_exception;
-#endif
-       }
+       trap_handle(type, val, pv, sp, ra, xpc, _p);
 }
 
 
@@ -262,18 +223,8 @@ void md_signal_handler_sigill(int sig, siginfo_t* siginfo, void* _p)
        // Handle the trap.
        void* p = trap_handle(type, val, pv, sp, ra, xpc, _p);
 
-       // Set registers if we have an exception, continue execution
-       // otherwise.
-       if (p != NULL) {
-               _gregs[REG_ITMP1_XPTR] = (uintptr_t) p;
-               _gregs[REG_ITMP2_XPC]  = (uintptr_t) xpc;
-#if defined(__UCLIBC__)
-               _gregs[CTX_EPC]        = (uintptr_t) asm_handle_exception;
-#else
-               _mc->pc                = (uintptr_t) asm_handle_exception;
-#endif
-       }
-       else {
+       // Set registers
+       if (p == NULL) {
                // We set the PC again because the cause may have changed the
                // XPC.
 #if defined(__UCLIBC__)