Merged branch subtype-trunk into default.
[cacao.git] / src / vm / jit / i386 / darwin / md-os.c
index 344c582052b0be3a0ab01598c742328453285632..b9f3afd9de575a9b1697f2dc96553ee273ff33eb 100644 (file)
 #include "vm/jit/i386/codegen.h"
 #include "vm/jit/i386/md.h"
 
-#include "threads/thread.h"
+#include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/global.h"
-#include "vm/signallocal.h"
-#include "vm/stringlocal.h"
+#include "vm/signallocal.hpp"
 
 #include "vm/jit/asmpart.h"
 #include "vm/jit/executionstate.h"
-#include "vm/jit/stacktrace.h"
+#include "vm/jit/stacktrace.hpp"
 #include "vm/jit/trap.h"
 
 #include "vm/jit/i386/codegen.h"
@@ -73,7 +72,6 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
        intptr_t             val;
        int                  type;
        void                *p;
-       java_object_t       *o;
 
        _uc = (ucontext_t *) _p;
        _mc = _uc->uc_mcontext;
@@ -143,24 +141,10 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
        /* Set registers. */
 
        if (type == TRAP_COMPILER) {
-               if (p == NULL) { 
-                       o = builtin_retrieve_exception();
-
+               if (p == NULL) {
                        _ss->__esp = (uintptr_t) sp;  /* Remove RA from stack. */
-
-                       _ss->__eax = (uintptr_t) o;
-                       _ss->__ecx = (uintptr_t) xpc;           /* REG_ITMP2_XPC */
-                       _ss->__eip = (uintptr_t) asm_handle_exception;
-               }
-               else {
-                       _ss->__eip = (uintptr_t) p;
                }
        }
-       else {
-               _ss->__eax = (uintptr_t) p;
-               _ss->__ecx = (uintptr_t) xpc;            /* REG_ITMP2_XPC */
-               _ss->__eip = (uintptr_t) asm_handle_exception;
-       }
 }
 
 
@@ -182,7 +166,6 @@ void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
        u1                  *xpc;
        int                  type;
        intptr_t             val;
-       void                *p;
 
 
        _uc = (ucontext_t *) _p;
@@ -201,13 +184,7 @@ void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
 
        /* Handle the trap. */
 
-       p = trap_handle(type, val, pv, sp, ra, xpc, _p);
-
-       /* Set registers. */
-
-       _ss->__eax = (uintptr_t) p;
-       _ss->__ecx = (uintptr_t) xpc;            /* REG_ITMP2_XPC */
-       _ss->__eip = (uintptr_t) asm_handle_exception;
+       trap_handle(type, val, pv, sp, ra, xpc, _p);
 }
 
 
@@ -254,7 +231,6 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p)
        u1                  *xpc;
        int                  type;
        intptr_t             val;
-       void                *p;
 
 
        _uc = (ucontext_t *) _p;
@@ -271,15 +247,7 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p)
 
        /* Handle the trap. */
 
-       p = trap_handle(type, val, pv, sp, ra, xpc, _p);
-
-       /* Set registers. */
-
-       if (p != NULL) {
-               _ss->__eax = (uintptr_t) p;
-               _ss->__ecx = (uintptr_t) xpc;            /* REG_ITMP2_XPC */
-               _ss->__eip = (uintptr_t) asm_handle_exception;
-       }
+       trap_handle(type, val, pv, sp, ra, xpc, _p);
 }
 
 /* md_executionstate_read ******************************************************
@@ -353,34 +321,6 @@ void md_executionstate_write(executionstate_t *es, void *context)
 }
 
 
-/* md_critical_section_restart *************************************************
-
-   Search the critical sections tree for a matching section and set
-   the PC to the restart point, if necessary.
-
-*******************************************************************************/
-
-#if defined(ENABLE_THREADS)
-void thread_restartcriticalsection(ucontext_t *_uc)
-{
-       mcontext_t           _mc;
-       i386_thread_state_t *_ss;
-       u1                  *pc;
-       void                *rpc;
-
-       _mc = _uc->uc_mcontext;
-       _ss = &_mc->__ss;
-
-       pc = (u1 *) _ss->__eip;
-
-       rpc = critical_find_restart_point(pc);
-
-       if (rpc != NULL)
-               _ss->__eip = (ptrint) rpc;
-}
-#endif
-
-
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where