views:

151

answers:

1

Is there anything the Dalvik VM supports (in terms of bytecode) which is not used currently because the .class files don't have it?

As an example, if people would write their own Source-to-DX converter for their functional language XYZ, would they be able to implement e. g. full tail calls although the .class file does support tail calls only under certain circumstances?

+2  A: 

I'm no expert, but from what I can see, the answer would be no.

The following two sites lists the Dalvik and JVM opcodes, and put aside the fact that Dalvik is a register based VM and the JVM is stack based, the opcodes are fairly similar.

http://pallergabor.uw.hu/androidblog/dalvik_opcodes.html

http://en.wikipedia.org/wiki/Java_bytecode

Both of them are tailored specifically to handle the Java-language, (even though there are suggestions to lift this constraint, in future versions of the JVM).

One of the problems with tail call optimization on Java, is that the call stack is actually available for the program (through for instance new Throwable().getStackTrace(), which is also present on the Android). If the VM did tail call optimizations, it would need to have some bookkeeping for what it just "optimized away" in order to be able to properly implement the getStackTrace method.

aioobe
Thanks, aioobe!
soc