Basic blocks which are unreachable in CFG and are not
exception handlers will not be converted.

This is a workaround for a problem encountered in bytecode generated
by clojure. Clojure generates unreachable basic blocks which leave
empty mimic stack and jump to a basic block which expects a value on
mimic stack. This breaks mimic stack resolution because we have
different stack depths on different paths (bb1->bb3 and bb2->bb3):

...

--- bb1 (unreachable)
[main]    [ 354 ]  0xa7  goto           359

--- bb2
[main]    [ 357 ]  0x57  pop
[main]    [ 358 ]  0x01  aconst_null

--- bb3
[main]    [ 359 ]  0xb0  areturn

Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 jit/bytecode-to-ir.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/jit/bytecode-to-ir.c b/jit/bytecode-to-ir.c
index a93a2ca..5f66587 100644
--- a/jit/bytecode-to-ir.c
+++ b/jit/bytecode-to-ir.c
@@ -434,6 +434,9 @@ int convert_to_ir(struct compilation_unit *cu)
         * really converted all basic blocks.
         */
        for_each_basic_block(bb, &cu->bb_list) {
+               if (!bb->is_eh)
+                       continue;
+
                err = convert_bb_to_ir(bb);
                if (err)
                        break;
-- 
1.6.0.4


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to