LWN.net Logo

Non-JVM VM

Non-JVM VM

Posted Nov 13, 2007 20:50 UTC (Tue) by ncm (subscriber, #165)
Parent article: Dalvik: how Google routed around Sun's IP-based licensing restrictions on Java ME (Betaversion)

The Java VM is renowned for its designers having chosen, in seemingly every case, the
alternative more resistant to optimization.  One not bound by those choices could produce a VM
designed specifically to feed an optimizing code generator.  (Indeed, MS's CLR is said to be
implementable only that way, but  otherwise annoyingly similar to JVM.)  It would be most
unfortunate if the VM were useful only for executing code compiled from Java.  There are much
more powerful languages.


(Log in to post comments)

Non-JVM VM

Posted Nov 14, 2007 1:12 UTC (Wed) by captrb (subscriber, #2291) [Link]


It sounds like the Dalvik compiler operates on Java bytecode, not the Java language, so I
would assume that any language that can use Android's class library and can be compiled into
JVM bytecode will be supported on this platform.


Non-JVM VM

Posted Nov 14, 2007 2:36 UTC (Wed) by ncm (subscriber, #165) [Link]

Java source gets compiled to ".dex" files by a program called "dx".  The Davlik interpreter is
"register-based", unlike JVM, which is stack-based, thus fundamentally incompatible.
Therefore, it's possible, although far from certain, that it can execute programs that would be
inexpressible in JVM bytecodes.  All interesting languages are inexpressible in JVM bytecodes
(except in the trivial sense that one could write an interpreter in Java).

A Java bytecode -> .dex compiler might be possible, but that is also far from certain,
depending on details of library dependencies.

Non-JVM VM

Posted Nov 14, 2007 3:13 UTC (Wed) by ajross (subscriber, #4563) [Link]

Register machines and stack machines are equivalent and turing-complete.  There is no
difference in expressiveness between the architectures.  Register designs are more popular
because they're more amenable to optimization.  It's easier to generate code to store a
temporary that needs to be used more than once in a register than it is to arrange the stack
so it's at the top at the right time.

Non-JVM VM

Posted Nov 14, 2007 4:22 UTC (Wed) by ncm (subscriber, #165) [Link]

Obviously.  But a design incompatible with JVM may also implement instructions that JVM
doesn't.  As an example, CLR implements the tail-call optimization.  Turing-completeness is
meaningless at this level.  (If you insist on nitpicking, I will point out that nobody has
ever implemented a Turing-complete execution environment, and nobody ever will.)

Non-JVM VM

Posted Nov 14, 2007 2:42 UTC (Wed) by ncm (subscriber, #165) [Link]

Oops, the "update" says that in fact "dx" does translate JVM bytecode files to ".dex" files.
The rest of my comment stands.  Apparently details of the Davlik VM remain secret.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds