Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 include/jit/compilation-unit.h |    6 ++++++
 jit/emit.c                     |    3 +++
 jit/exception.c                |    8 ++++----
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/jit/compilation-unit.h b/include/jit/compilation-unit.h
index 66fcb7c..d3366f7 100644
--- a/include/jit/compilation-unit.h
+++ b/include/jit/compilation-unit.h
@@ -55,6 +55,12 @@ struct compilation_unit {
        unsigned char *exit_past_unlock_ptr;
        unsigned char *unwind_past_unlock_ptr;
 
+       /*
+        * These are native pointers to basic blocks.
+        */
+       unsigned char *exit_bb_ptr;
+       unsigned char *unwind_bb_ptr;
+
        struct list_head static_fixup_site_list;
        struct list_head tableswitch_list;
        struct list_head lookupswitch_list;
diff --git a/jit/emit.c b/jit/emit.c
index 0966923..a65f35f 100644
--- a/jit/emit.c
+++ b/jit/emit.c
@@ -201,6 +201,9 @@ int emit_machine_code(struct compilation_unit *cu)
        backpatch_lookupswitch_targets(cu);
        build_exception_handlers_table(cu);
 
+       cu->exit_bb_ptr = bb_native_ptr(cu->exit_bb);
+       cu->unwind_bb_ptr = bb_native_ptr(cu->unwind_bb);
+
        jit_text_reserve(buffer_offset(cu->objcode));
        jit_text_unlock();
 
diff --git a/jit/exception.c b/jit/exception.c
index de71618..0171ca8 100644
--- a/jit/exception.c
+++ b/jit/exception.c
@@ -250,14 +250,14 @@ static unsigned char *find_handler(struct 
compilation_unit *cu,
 static bool
 is_inside_exit_unlock(struct compilation_unit *cu, unsigned char *ptr)
 {
-       return ptr >= bb_native_ptr(cu->exit_bb) &&
+       return ptr >= cu->exit_bb_ptr &&
                ptr < cu->exit_past_unlock_ptr;
 }
 
 static bool
 is_inside_unwind_unlock(struct compilation_unit *cu, unsigned char *ptr)
 {
-       return ptr >= bb_native_ptr(cu->unwind_bb) &&
+       return ptr >= cu->unwind_bb_ptr &&
                ptr < cu->unwind_past_unlock_ptr;
 }
 
@@ -319,7 +319,7 @@ throw_from_jit(struct compilation_unit *cu, struct 
jit_stack_frame *frame,
                if (is_inside_exit_unlock(cu, native_ptr))
                        return cu->exit_past_unlock_ptr;
 
-               return bb_native_ptr(cu->exit_bb);
+               return cu->exit_bb_ptr;
        }
 
        if (opt_trace_exceptions)
@@ -328,7 +328,7 @@ throw_from_jit(struct compilation_unit *cu, struct 
jit_stack_frame *frame,
        if (is_inside_unwind_unlock(cu, native_ptr))
                return cu->unwind_past_unlock_ptr;
 
-       return bb_native_ptr(cu->unwind_bb);
+       return cu->unwind_bb_ptr;
 }
 
 void
-- 
1.6.0.6


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to