idea for student project: emitting Android .dex classfiles directly

370 views
Skip to first unread message

Miguel Garcia

unread,
Apr 3, 2012, 3:26:08 PM4/3/12
to scala-i...@googlegroups.com

Scala developers targeting Android must bear with an extra build step (jar to dex conversion), given that there's no dedicated backend to replace GenJVM (to directly translate ICode [1] into dex files).

Two recent developments can simplify the construction of an Android-backend:

  (a) ASMDEX [2] an ASM-based bytecode manipulation framework for DEX bytecode.

  (b) an ASM-based version of GenJVM [3], in connection with the extensive ASM documentation (user guide [4] and developer docs [5]).

That's the idea. Disclaimer: I'm in no way an expert in Android development. I just got this idea after contributing to both the GenJVM and GenMSIL Scala backends :)


Miguel
http://lampwww.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/


[1] http://www.sts.tu-harburg.de/people/mi.garcia/ScalaCompilerCorner/GenICode01.pdf

[2] http://mail.ow2.org/wws/arc/asm/2012-04/msg00000.html
    http://asm.ow2.org/asmdex-index.html

[3] https://github.com/magarciaEPFL/scala/tree/GenASM2
    https://groups.google.com/d/topic/scala-internals/l35CbKnRaXU/discussion

[4] http://download.forge.objectweb.org/asm/asm4-guide.pdf

[5] http://asm.ow2.org/doc/developer-guide.html


Miguel Garcia

unread,
Apr 3, 2012, 3:33:47 PM4/3/12
to scala-i...@googlegroups.com

And, in case it helps, there's already a compiler plugin to convert Scala AST into three-address code, documentation at:
  http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/2011Q2/Moving3A.pdf


Miguel
http://lampwww.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/l

Simon Ochsenreither

unread,
Apr 8, 2012, 8:09:22 PM4/8/12
to scala-i...@googlegroups.com
Hi,

There is also http://code.google.com/p/dexmaker/.

Bye, Simon

Miguel Garcia

unread,
Apr 19, 2012, 10:42:21 AM4/19/12
to scala-i...@googlegroups.com

Another reference for those interested in Dalvik bytecode (this time with a program verification focus)

Title: Study, Formalization, and Analysis of Dalvik Bytecode
Authors: Erik Ramsgaard Wognsen, Henrik Sø ndberg Karlsen
http://students.cs.aau.dk/erikrw/report_sw9.pdf

Quoting from the Abstract:
"We generalize the Dalvik instruction set and formalize it using operational semantics based on the Dalvik documentation, inspection of the Dalvik VM source code, and manual testing."

Part of that work was presented at BYTECODE 2012, http://wwwhome.ewi.utwente.nl/~marieke/Bytecode2012/abstracts.html


Miguel
http://lampwww.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/


On Tuesday, April 3, 2012 9:26:08 PM UTC+2, Miguel Garcia wrote:

Simon Ochsenreither

unread,
Apr 19, 2012, 11:28:32 AM4/19/12
to scala-i...@googlegroups.com
Interesting, thanks!
Reply all
Reply to author
Forward
0 new messages