From: Arno P. <ar...@pu...> - 2009-11-19 13:02:47
|
that is a known bug. Flow control in the JVM is represented by absolute jumps which we simply map to gotos in Objective-C. Exceptions sometimes cause the problems you are experiencing. We have discussed for a long time to convert the stack machine to register machine that would also reverse engineer flow control by removing the gotos. This is no easy matter and is further down on our to-do list. In the meantime you can probably get around the problem by inserting a dummy statement just before the try. Something like: } else { int x = 42; try { Arno Markus Heberling wrote: > Hi, > > I have the following java code: > > if(args==null){ > System.out.println(1); > }else{ > try{ > System.out.println(2); > > } catch(Exception e){ > System.out.println(3); > > } > } > > It gets converted to the following ObjectiveC code (only relevant part here) > > if (_op1.o != [NSNull null]) goto label0; > _op1.o = [java_lang_System _GET_out]; > _stack[_sp++].o = _op1.o; > _stack[_sp++].i = 1; > _sp -= 2; > [((java_io_PrintStream*) _stack[_sp].o) println___int:_stack[_sp + 1].i]; > goto label1; > @try { > label0:; > _op1.o = [java_lang_System _GET_out]; > _stack[_sp++].o = _op1.o; > _stack[_sp++].i = 2; > _sp -= 2; > [((java_io_PrintStream*) _stack[_sp].o) println___int:_stack[_sp + 1].i]; > } @catch (java_lang_Exception* _ex) { > _stack[_sp++].o = _ex; > goto label7; > } > > This code crashes. The label0 is inside the try and the code jumps into it from the outside. This seems not to be allowed in ObjectiveC. if I move the label0:; before the try manually, it works. The xsl would need to be changed, so that if there is a jvm:label directly after a jvm:catch, they have to be swapped. I tried but wasn't able to do this myself. Don't know if it has any side effects, too :/ > > Markus > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > 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 > > > ------------------------------------------------------------------------ > > _______________________________________________ > xmlvm-users mailing list > xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlvm-users |