In theory there is nothing to stop you doing bytecode manipulation on Dalvik. It just uses a different bytecode to the JVM (Dalvik is register-based whereas JVM is stack-based). Of course it's a little harder in practice, as there are tools like ASM that build JVM bytecodes on-the-fly but nothing equivalent for Dalvik bytecodes. One possible route is to generate JVM bytecodes using ASM and then use the converter that is shipped with Android to get Dalvik bytecodes at runtime. The converter is implemented in Java, but unfortunately it is designed to be used as a build-time tool rather than a runtime tool. As a result it is rather too heavy in terms of memory and CPU usage: I was unable to get it to run in the Dalvik emulator at all due to memory limitations, so it's very unlikely it would run on a phone.
On the other hand I think Dalvik could be a very interesting VM for use on the desktop, not just on devices. Register-based stack machines can be faster than stack-based ones. As Carl points out, Scala compiles to bytecode and does not use runtime code generation, so it has none of the above issues, indeed I believe that Roman Roelofson has successfully run Scala code on Dalvik. Regards Neil On Oct 8, 12:39 pm, "Dirk Jäckel" <[EMAIL PROTECTED]> wrote: > Hi! > > There is a really big difference between the Dalvik VM and the JVM > for at least some of the dynamic languages. As I understand it they > are using byte code manipulation to do their dynamic thingies which at > this point is impossible with the Dalvik byte code. So it seems Groovy > will not be an option soon if ever. I don't know about Scala, Jython > and JRuby. Are they available for Android development? > > I think this is a huge problem. > > What do you think? > > Regards, > Dirk --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
