This way, the order of basic blocks matches the values of .start and .end It also makes created basic blocks have empty bytecode range (start == end).
Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- jit/basic-block.c | 2 +- jit/switch-bc.c | 6 +++--- test/jit/basic-block-test.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jit/basic-block.c b/jit/basic-block.c index 401377c..d478315 100644 --- a/jit/basic-block.c +++ b/jit/basic-block.c @@ -104,7 +104,7 @@ struct basic_block *bb_split(struct basic_block *orig_bb, unsigned long offset) { struct basic_block *new_bb; - if (offset < orig_bb->start || offset >= orig_bb->end) + if (offset < orig_bb->start || offset > orig_bb->end) return NULL; new_bb = alloc_basic_block(orig_bb->b_parent, offset, orig_bb->end); diff --git a/jit/switch-bc.c b/jit/switch-bc.c index 32cb7fc..b1ece1a 100644 --- a/jit/switch-bc.c +++ b/jit/switch-bc.c @@ -93,8 +93,8 @@ int convert_tableswitch(struct parse_context *ctx) master_bb = ctx->bb; - b1 = bb_split(master_bb, ctx->offset); - b2 = bb_split(b1, ctx->offset); + b1 = bb_split(master_bb, master_bb->end); + b2 = bb_split(b1, master_bb->end); assert(b1 && b2); @@ -179,7 +179,7 @@ int convert_lookupswitch(struct parse_context *ctx) master_bb = ctx->bb; - b1 = bb_split(master_bb, ctx->offset); + b1 = bb_split(master_bb, master_bb->end); assert(b1); diff --git a/test/jit/basic-block-test.c b/test/jit/basic-block-test.c index 7195487..a22d3bf 100644 --- a/test/jit/basic-block-test.c +++ b/test/jit/basic-block-test.c @@ -24,7 +24,7 @@ void test_split_with_out_of_range_offset(void) bb = get_basic_block(cu, 1, 2); assert_ptr_equals(NULL, bb_split(bb, 0)); - assert_ptr_equals(NULL, bb_split(bb, 2)); + assert_ptr_equals(NULL, bb_split(bb, 3)); free_compilation_unit(cu); } -- 1.6.3.3 ------------------------------------------------------------------------------ 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