2009/7/6 Tomek Grabiec <tgrab...@gmail.com>: > When branch target points to the same basic block that contains that > branch then branch insn will be added to the backpatch list because > target_bb->is_emitted field is false yet. The backpatch list for basic block > is browsed before its instructions are emitted. Therefore the branch > whose target points to the containing basic block will never be > patched. > > Solution to this problem is to set ->is_emitted to true as soon > as ->mach_offset is set (before basic block's instructions are emitted). > This will cause that branches pointing to the containing basic block > will be resolved immediately. > > Affected code: > > public class Test2 { > static public void c() { > } > > public static void main(String[] args) { > > while (true) c(); > } > } > > Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> > --- > jit/emit.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/jit/emit.c b/jit/emit.c > index ac31b8b..ec79c3e 100644 > --- a/jit/emit.c > +++ b/jit/emit.c > @@ -121,12 +121,13 @@ void emit_body(struct basic_block *bb, struct buffer > *buf) > struct insn *insn; > > bb->mach_offset = buffer_offset(buf); > + bb->is_emitted = true; > + > backpatch_branches(buf, &bb->backpatch_insns, bb->mach_offset); > > for_each_insn(insn, &bb->insn_list) { > emit_insn(buf, insn); > } > - bb->is_emitted = true; > } > > static struct buffer_operations exec_buf_ops = { > -- > 1.6.0.6 > >
This patch has been already sent and applied, sorry for this mistake. -- Tomek Grabiec ------------------------------------------------------------------------------ _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel