From d0a978cb663677bf574ae3af27a2f2805ca30f8a Mon Sep 17 00:00:00 2001 From: Aleksey Demakov Date: Fri, 15 Sep 2006 16:17:20 +0000 Subject: [PATCH] add jit_insn_mark_breakpoint_variable() function. --- ChangeLog | 5 +++++ include/jit/jit-insn.h | 2 ++ jit/jit-debugger.c | 6 ++++++ jit/jit-insn.c | 46 ++++++++++++++++++++++++------------------ 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2abc9c2..c670ed3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-09-15 Radek Polak + + * include/jit/jit-insn.h, jit/jit-insn.c, jit/jit-debugger.c: new + instruction jit_insn_mark_breakpoint_variable. + 2006-09-14 Aleksey Demakov * jit/jit-reg-alloc.h, jit/jit-reg-alloc.c: remove "old" register diff --git a/include/jit/jit-insn.h b/include/jit/jit-insn.h index 7b1933c..9a3ace3 100644 --- a/include/jit/jit-insn.h +++ b/include/jit/jit-insn.h @@ -317,6 +317,8 @@ int jit_insn_mark_offset (jit_function_t func, jit_int offset) JIT_NOTHROW; int jit_insn_mark_breakpoint (jit_function_t func, jit_nint data1, jit_nint data2) JIT_NOTHROW; +int jit_insn_mark_breakpoint_variable + (jit_function_t func, jit_value_t data1, jit_value_t data2) JIT_NOTHROW; void jit_insn_iter_init(jit_insn_iter_t *iter, jit_block_t block) JIT_NOTHROW; void jit_insn_iter_init_last diff --git a/jit/jit-debugger.c b/jit/jit-debugger.c index 45d71c5..03e79ea 100644 --- a/jit/jit-debugger.c +++ b/jit/jit-debugger.c @@ -125,6 +125,12 @@ of the event is set to the value of @code{stop_immediately} for the call. A thread called @code{jit_debugger_detach_self}. @end table +@deftypefun int jit_insn_mark_breakpoint_variable (jit_function_t func, jit_value_t data1, jit_value_t data2) +This function is similar to @code{jit_insn_mark_breakpoint} except that values +in @code{data1} and @code{data2} can be computed at runtime. You can use this +function for example to get address of local variable. +@end deftypefun + @*/ /* diff --git a/jit/jit-insn.c b/jit/jit-insn.c index 1f031d2..9dfd78b 100644 --- a/jit/jit-insn.c +++ b/jit/jit-insn.c @@ -8024,9 +8024,9 @@ int jit_insn_mark_offset(jit_function_t func, jit_int offset) (func, jit_type_int, offset)); } -/* Documentation is in jit-debug.c */ -int jit_insn_mark_breakpoint - (jit_function_t func, jit_nint data1, jit_nint data2) +/* Documentation is in jit-debugger.c */ +int jit_insn_mark_breakpoint_variable + (jit_function_t func, jit_value_t data1, jit_value_t data2) { #if defined(JIT_BACKEND_INTERP) /* Use the "mark_breakpoint" instruction for the interpreter */ @@ -8034,11 +8034,7 @@ int jit_insn_mark_breakpoint { return 0; } - return create_note(func, JIT_OP_MARK_BREAKPOINT, - jit_value_create_nint_constant - (func, jit_type_nint, data1), - jit_value_create_nint_constant - (func, jit_type_nint, data2)); + return create_note(func, JIT_OP_MARK_BREAKPOINT, data1, data2); #else /* Insert a call to "_jit_debugger_hook" on native platforms */ jit_type_t params[3]; @@ -8059,18 +8055,8 @@ int jit_insn_mark_breakpoint 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; - } + values[1] = data1; + values[2] = data2; jit_insn_call_native(func, "_jit_debugger_hook", (void *)_jit_debugger_hook, signature, values, 3, JIT_CALL_NOTHROW); jit_type_free(signature); @@ -8078,6 +8064,26 @@ int jit_insn_mark_breakpoint #endif } +/* Documentation is in jit-debugger.c */ +int jit_insn_mark_breakpoint + (jit_function_t func, jit_nint data1, jit_nint data2) +{ + jit_value_t value1; + jit_value_t value2; + + value1 = jit_value_create_nint_constant(func, jit_type_nint, data1); + value2 = jit_value_create_nint_constant(func, jit_type_nint, data2); + + if(value1 && value2) + { + return jit_insn_mark_breakpoint_variable(func, value1, value2); + } + else + { + return 0; + } +} + /*@ * @deftypefun void jit_insn_iter_init ({jit_insn_iter_t *} iter, jit_block_t block) * Initialize an iterator to point to the first instruction in @code{block}. -- 2.47.3