ART - bypass DEX altogether in the future?

50 views
Skip to first unread message

Pedro Lopes

unread,
Jun 4, 2017, 2:13:23 AM6/4/17
to android-platform
Hi there,

By looking at the complete process which spans from the java source code to the ELF executable compiled by ART's dex2oat, I could not help to wonder why is the dexer still present in the chain.

The translation from java class files to dex files was done in order for the android device to use a suitable light (dalvik) VM for mobile devices. With ART, the VM is bypassed altogether, so are there still any significant gains from compiling the code to dex files in between?

Please correct me if I am wrong, but if the ELF executable would be created directly from the java .class files [1], this would translate into the definite lift of dex's 65k method limit, which would be great for developers with large applications.

Is this even feasible? Is so, what do you think are the main barriers to it? [2]

Finally, if what I presented is not a out of touch idea, is the AOT compilation from java class files on the project's roadmap?


[1] Java AOT compilation seems to be already available via jaotc in OpenJDK
[2] For example, with the lift of dex's 65k method limit, it would mean that all the previous android versions not capable of compiling directly from java .class files could not be not be able to run the app.

Colin Cross

unread,
Jun 5, 2017, 5:12:21 PM6/5/17
to android-...@googlegroups.com
The ELF files produced by dex2oat are not portable between devices,
they are tightly coupled to the architecture of the specific device
and to the code in the bootclasspath on that device. Dex files are
still the portable representation of the compiled app code.
> --
> You received this message because you are subscribed to the Google Groups
> "android-platform" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-platfo...@googlegroups.com.
> To post to this group, send email to android-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/android-platform.
> For more options, visit https://groups.google.com/d/optout.

Pedro Lopes

unread,
Jun 9, 2017, 10:42:20 PM6/9/17
to android-platform
I was suggesting shipping the APK with the java class files, which would in turn be then compiled to ELF on the device (instead of using dex, like dex2oat does today). This way, the dex files would be bypassed during that process and I believe portability would not be an issue, since the ELF files are created by the device, as they are today.

I understand that dex files are the de facto way of providing portability today and I have mentioned one of the caveats of moving to the direct java class compilation (there are certainly more), but the suggestion / question is geared towards the future. Hence my questioning if the dexing process is still relevant as the devices get more and more powerful, and if we can can/should look towards a future where it can be bypassed altogether.
Reply all
Reply to author
Forward
0 new messages