]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Use a common helper function for performing debug hook tests on
authorRhys Weatherley <rweather@southern-storm.com.au>
Mon, 4 Oct 2004 04:22:23 +0000 (04:22 +0000)
committerRhys Weatherley <rweather@southern-storm.com.au>
Mon, 4 Oct 2004 04:22:23 +0000 (04:22 +0000)
native platforms, to avoid the need to implement breakpoint testing
individually in every native back end.

ChangeLog
jit/jit-insn.c
jit/jit-rules-arm.sel
jit/jit-rules-x86.sel

index 81ab682046f81b18d5448ea1eff14b8d43ee6d21..463fe60f467acba695bc5ff71e174b24f253e67a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        jitplus/jit-plus-function.cpp: clean up the breakpoint API and
        implement debug hooks for the interpreter.
 
+       * jit/jit-insn.c, jit/jit-rules-arm.sel, jit/jit-rules-x86.sel:
+       use a common helper function for performing debug hook tests on
+       native platforms, to avoid the need to implement breakpoint testing
+       individually in every native back end.
+
 2004-09-10  Rhys Weatherley  <rweather@southern-storm.com.au>
 
        * jit/jit-rules-x86.sel: pointer-relative loads and stores
index 75924b365e3fa55682c8158315b28c9a64b284aa..b0b7a9c8942ac650e1146f5eeceaea688ae79ddd 100644 (file)
@@ -7694,10 +7694,33 @@ int jit_insn_mark_offset(jit_function_t func, jit_int offset)
                                                                (func, jit_type_int, offset));
 }
 
+#if !defined(JIT_BACKEND_INTERP)
+
+/*
+ * Perform first-level debug hook testing.
+ */
+void _jit_hook_test(jit_function_t func, jit_nint data1, jit_nint data2)
+{
+       if(func->breakpoints_enabled || func->context->breakpoints_enabled)
+       {
+               jit_debug_hook_func hook;
+               hook = (jit_debug_hook_func)
+                       jit_context_get_meta(func->context, JIT_OPTION_DEBUG_HOOK);
+               if(hook)
+               {
+                       (*hook)(func, data1, data2);
+               }
+       }
+}
+
+#endif /* !JIT_BACKEND_INTERP */
+
 /* Documentation is in jit-debug.c */
 int jit_insn_mark_breakpoint
        (jit_function_t func, jit_nint data1, jit_nint data2)
 {
+#if defined(JIT_BACKEND_INTERP)
+       /* Use the "mark_breakpoint" instruction for the interpreter */
        if(!jit_insn_new_block(func))
        {
                return 0;
@@ -7707,6 +7730,43 @@ int jit_insn_mark_breakpoint
                                                        (func, jit_type_nint, data1),
                                       jit_value_create_nint_constant
                                                        (func, jit_type_nint, data2));
+#else
+       /* Insert a call to "_jit_hook_test" on native platforms */
+       jit_type_t params[3];
+       jit_type_t signature;
+       jit_value_t values[3];
+       params[0] = jit_type_void_ptr;
+       params[1] = jit_type_nint;
+       params[2] = jit_type_nint;
+       signature = jit_type_create_signature
+               (jit_abi_cdecl, jit_type_void, params, 3, 0);
+       if(!signature)
+       {
+               return 0;
+       }
+       if((values[0] = jit_value_create_nint_constant
+                       (func, jit_type_void_ptr, (jit_nint)func)) == 0)
+       {
+               jit_type_free(signature);
+               return 0;
+       }
+       if((values[1] = jit_value_create_nint_constant
+                       (func, jit_type_nint, data1)) == 0)
+       {
+               jit_type_free(signature);
+               return 0;
+       }
+       if((values[2] = jit_value_create_nint_constant
+                       (func, jit_type_nint, data2)) == 0)
+       {
+               jit_type_free(signature);
+               return 0;
+       }
+       jit_insn_call_native(func, "_jit_hook_test", (void *)_jit_hook_test,
+                                                signature, values, 3, JIT_CALL_NOTHROW);
+       jit_type_free(signature);
+       return 1;
+#endif
 }
 
 /*@
index e27304e26d24773a312ccfa96fb7904f2d7f5273..173033f8993136a49bb6089f70f287bd9b0c0c92 100644 (file)
@@ -1399,13 +1399,3 @@ JIT_OP_ADD_RELATIVE: unary
                        arm_alu_reg_imm(inst, ARM_ADD, $1, $1, insn->value2->address);
                }
        }
-
-/*
- * Debugging support.
- */
-
-JIT_OP_MARK_BREAKPOINT: manual
-       [] -> {
-               /* TODO */
-               TODO();
-       }
index c29d739cd9ce077f1412e75f9a133d788fc876b1..30aa4ccf75d5c4bff0118071c3eb73edc468ee0a 100644 (file)
@@ -2800,13 +2800,3 @@ JIT_OP_ALLOCA: unary
                x86_mov_reg_reg(inst, $1, X86_ESP, 4);
                gen->stack_changed = 1;
        }
-
-/*
- * Debugging support.
- */
-
-JIT_OP_MARK_BREAKPOINT: manual
-       [] -> {
-               /* TODO */
-               TODO();
-       }