This function can be replaced by signal bottom half with throw_from_signal_bh()
call. Less code increases maintainability.

Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 arch/x86/exception.c    |   21 ---------------------
 include/jit/exception.h |    1 -
 vm/signal.c             |    7 ++++++-
 3 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/arch/x86/exception.c b/arch/x86/exception.c
index 97729c1..01e7bc0 100644
--- a/arch/x86/exception.c
+++ b/arch/x86/exception.c
@@ -50,27 +50,6 @@ throw_exception(struct compilation_unit *cu, struct 
vm_object *exception)
        return throw_from_jit(cu, frame, native_ptr);
 }
 
-void throw_from_signal(void *ctx, struct vm_object *exception)
-{
-       struct jit_stack_frame *frame;
-       struct compilation_unit *cu;
-       unsigned long source_addr;
-       ucontext_t *uc;
-       void *eh;
-
-       signal_exception(exception);
-
-       uc = ctx;
-
-       source_addr = uc->uc_mcontext.gregs[REG_IP];
-       cu = jit_lookup_cu(source_addr);
-       frame = (struct jit_stack_frame*)uc->uc_mcontext.gregs[REG_BP];
-
-       eh = throw_from_jit(cu, frame, (unsigned char*)source_addr);
-
-       uc->uc_mcontext.gregs[REG_IP] = (unsigned long)eh;
-}
-
 void throw_from_trampoline(void *ctx, struct vm_object *exception)
 {
        unsigned long return_address;
diff --git a/include/jit/exception.h b/include/jit/exception.h
index 8d423e1..ae4d05c 100644
--- a/include/jit/exception.h
+++ b/include/jit/exception.h
@@ -54,7 +54,6 @@ unsigned char *throw_from_jit(struct compilation_unit *cu,
 int insert_exception_spill_insns(struct compilation_unit *cu);
 unsigned char *throw_exception(struct compilation_unit *cu,
                               struct vm_object *exception);
-void throw_from_signal(void *ctx, struct vm_object *exception);
 void throw_from_trampoline(void *ctx, struct vm_object *exception);
 void unwind(void);
 void signal_exception(struct vm_object *obj);
diff --git a/vm/signal.c b/vm/signal.c
index d7c9196..0d0da24 100644
--- a/vm/signal.c
+++ b/vm/signal.c
@@ -90,6 +90,11 @@ static unsigned long throw_stack_overflow_error(unsigned 
long src_addr)
        return throw_from_signal_bh(src_addr);
 }
 
+static unsigned long rethrow_bh(unsigned long src_addr)
+{
+       return throw_from_signal_bh(src_addr);
+}
+
 static void sigfpe_handler(int sig, siginfo_t *si, void *ctx)
 {
        if (signal_from_native(ctx))
@@ -141,7 +146,7 @@ static void sigsegv_handler(int sig, siginfo_t *si, void 
*ctx)
                if (si->si_addr == trampoline_exceptions_guard_page)
                        throw_from_trampoline(ctx, exception);
                else
-                       throw_from_signal(ctx, exception);
+                       install_signal_bh(ctx, &rethrow_bh);
 
                return;
        }
-- 
1.6.0.6


------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to