Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com>
---
 arch/x86/insn-selector.brg |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 01b57d7..a8a418e 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -31,6 +31,7 @@
 
 #include <vm/class.h>
 #include <vm/field.h>
+#include <vm/gc.h>
 #include <vm/method.h>
 #include <vm/object.h>
 #include <vm/stack-trace.h>
@@ -2862,6 +2863,17 @@ static void select_vm_native_call(struct basic_block *s, 
struct tree_node *tree,
                                     offset_reg, offset_tls));
 }
 
+static void select_safepoint(struct basic_block *s, struct tree_node *tree)
+{
+       struct insn *gc_safepoint_insn;
+
+       assert(gc_safepoint_page);
+       gc_safepoint_insn = imm_memdisp_insn(INSN_TEST_IMM_MEMDISP,
+               0, (unsigned long) gc_safepoint_page);
+       gc_safepoint_insn->safepoint = true;
+       select_insn(s, tree, gc_safepoint_insn);
+}
+
 static void invoke(struct basic_block *s, struct tree_node *tree, struct 
compilation_unit *cu, struct vm_method *method)
 {
        bool is_compiled;
@@ -2887,6 +2899,8 @@ static void invoke(struct basic_block *s, struct 
tree_node *tree, struct compila
                pthread_mutex_unlock(&cu->mutex);
        }
 
+       select_safepoint(s, tree);
+
        call_insn = rel_insn(INSN_CALL_REL, (unsigned long) target);
 
        if (vm_method_is_vm_native(method))
@@ -2943,6 +2957,8 @@ static void invokevirtual(struct _MBState *state, struct 
basic_block *s, struct
        /* native ptr */
        select_insn(s, tree, imm_reg_insn(INSN_ADD_IMM_REG, method_offset, 
call_target));
 
+       select_safepoint(s, tree);
+
        /* invoke method */
        call_insn = reg_insn(INSN_CALL_REG, call_target);
 
-- 
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