From: Arno P. <ar...@pu...> - 2009-11-20 09:23:32
|
Remember that we use JVM instructions as a canonical representation within XMLVM. We can convert CLR and YARV (Ruby byte code) to JVM instructions. It would be nice if we could transform this canonical representation of JVM instructions to something like DEX instructions. The result would be an XML document representing a register-based version of the stack-based program. Remember that XMLVM has various backends and we already have a prototype that emits JavaScript for the Palm Pre. We would need this XML representation of register-machine instructions for all the code generating backends of XMLVM. I don't know if DEX offers any libraries with which we can do this. Another byte code optimization framework that might be suitable for such a task is Soot: http://www.sable.mcgill.ca/soot/ Either way, no small feat... Arno Gergely Kis wrote: > Hi, > > Would it makes sense to add DEX, the Android bytecode format as a new > "source language" to xmlvm? > Since it is already designed to execute on a register machine, it might > be easier to implement. > > Best Regards, > Gergely > > 2009/11/19 Arno Puder <ar...@pu... <mailto:ar...@pu...>> > > > 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... > <mailto:xml...@li...> > > https://lists.sourceforge.net/lists/listinfo/xmlvm-users > > ------------------------------------------------------------------------------ > 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... > <mailto:xml...@li...> > https://lists.sourceforge.net/lists/listinfo/xmlvm-users > > > > > -- > Kis Gergely > MattaKis Consulting > Email: ger...@ma... <mailto:ger...@ma...> > Web: http://www.mattakis.com > Phone: +36 70 408 1723 > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > 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 |