2009/6/30 Vegard Nossum <vegard.nos...@gmail.com>: > This patch adds a new command-line flag, -Xtrace:invoke, which will > output a line whenever a method is called, saying which method of > which class that was invoked. Note that the print-out happens from > inside the JIT-compiled code itself, so we are certain to get the > message every time the function is called (as opposed to e.g. > -Xtrace:jit, which will only output a message when a method is > compiled). > > It looks like this: > > Running test jvm/PrintTest > trace invoke: jvm/PrintTest.main([Ljava/lang/String;)V > trace invoke: java/lang/System.<clinit>()V > trace invoke: > java/lang/VMSystem.makeStandardInputStream()Ljava/io/InputStream; > trace invoke: java/io/FileDescriptor.<clinit>()V > ... > > This patch has the potential to help debugging, but please review > it so we're sure it can't mess up the generated code. I'm not so > steady with the jit/emit stuff yet :-) > > x86_64 part is untested. > > Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com> > --- > arch/x86/emit-code.c | 22 ++++++++++++++++++++++ > include/jit/compiler.h | 1 + > include/jit/emit-code.h | 2 ++ > jit/emit.c | 5 +++++ > jit/trace-jit.c | 1 + > vm/jato.c | 2 ++ > 6 files changed, 33 insertions(+), 0 deletions(-) > > diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c > index 2c55535..b39f91a 100644 > --- a/arch/x86/emit-code.c > +++ b/arch/x86/emit-code.c > @@ -706,6 +706,17 @@ void emit_prolog(struct buffer *buf, unsigned long > nr_locals) > __emit_sub_imm_reg(buf, nr_locals * sizeof(unsigned long), > REG_ESP); > } > > +void emit_trace_invoke(struct buffer *buf, > + const char *class, const char *method, const char *type) > +{ > + __emit_push_imm(buf, (unsigned long) type); > + __emit_push_imm(buf, (unsigned long) method); > + __emit_push_imm(buf, (unsigned long) class); > + __emit_push_imm(buf, (unsigned long) "trace invoke: %s.%s%s\n"); > + __emit_call(buf, &printf); > + __emit_add_imm_reg(buf, 16, REG_ESP); > +} > + > static void emit_pop_memlocal(struct buffer *buf, struct operand *operand) > { > unsigned long disp = slot_offset(operand->slot); > @@ -1649,6 +1660,17 @@ void emit_prolog(struct buffer *buf, unsigned long > nr_locals) > REG_RSP); > } > > +void emit_trace_invoke(struct buffer *buf, > + const char *class, const char *method, const char *type) > +{ > + __emit_push_imm(buf, (unsigned long) type); > + __emit_push_imm(buf, (unsigned long) method); > + __emit_push_imm(buf, (unsigned long) class); > + __emit_push_imm(buf, (unsigned long) "trace invoke: %s.%s%s\n"); > + __emit_call(buf, &printf); > + __emit_add_imm_reg(buf, 32, REG_RSP); > +} > + > void emit_epilog(struct buffer *buf) > { > emit_leave(buf); > diff --git a/include/jit/compiler.h b/include/jit/compiler.h > index a42b503..1f991db 100644 > --- a/include/jit/compiler.h > +++ b/include/jit/compiler.h > @@ -94,6 +94,7 @@ extern bool opt_trace_regalloc; > extern bool opt_trace_machine_code; > extern bool opt_trace_magic_trampoline; > extern bool opt_trace_bytecode_offset; > +extern bool opt_trace_invoke; > > void trace_magic_trampoline(struct compilation_unit *); > void trace_method(struct compilation_unit *); > diff --git a/include/jit/emit-code.h b/include/jit/emit-code.h > index bfa89c7..9ed1982 100644 > --- a/include/jit/emit-code.h > +++ b/include/jit/emit-code.h > @@ -26,6 +26,8 @@ extern struct emitter emitters[]; > [_insn_type] = { .emit_fn = _fn, .type = _emitter_type } > > extern void emit_prolog(struct buffer *, unsigned long); > +extern void emit_trace_invoke(struct buffer *, > + const char *class, const char *method, const char *type)
I forgot to amend this hunk. There should be a semicolon at the end of that line. Can you fix or should I resubmit? Vegard ------------------------------------------------------------------------------ _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel