This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Fully dynamically compiling/dexing/loading Kawa on Android
- From: Per Bothner <per at bothner dot com>
- To: "F. Rafael Leon" <teflon at ucdavis dot edu>, kawa at sourceware dot org
- Date: Sat, 06 Dec 2014 23:25:55 -0800
- Subject: Re: Fully dynamically compiling/dexing/loading Kawa on Android
- Authentication-results: sourceware.org; auth=none
- References: <CALPCXwhPgWQnF=Lv6u2Aw-QHhHRdMg3mHF-0Zxfn2mYfsBJaog at mail dot gmail dot com>
On 12/06/2014 12:40 AM, F. Rafael Leon wrote:
I think I may have discovered something rather significant ...
But then I was browsing the android build scripts and tools and found
this jewel:
....
$ANDROID_HOME/build-tools/21.1.1/lib/dx.jar
That does sound very promising! Cool.
The next step would be modify ArrayClassLoader so it automatically
does the .class to .dex translation. Or whatever is the cleanest
way to tie a DexClassLoader to uses the classes of the ArrayClassLoader.
Could you find in the sources a way to convert .class to .dex
*without* actually writing a file in the file-system? I.e. take a byte
array representing a kawa-generated-class, convert it to another byte
array representing the converted dex class, and then pass that
to ClassLoader.defineClass?
If there is a simple call to do that, then it seems like it's a matter
of adding a few lines in ArrayClassLoader.loadClass, to do the
conversion before calling defineClass.
OTOH if the conversion needs to work on a *set* of classes (like in a
jar file), then the changes are a little more difficult. Could we convert
all the byte arrays in an ArrayClassLoader in a single operation?
Preferably if we didn't have to actually read and write files, but if
we have to do that, that's ok.
--
--Per Bothner
per@bothner.com http://per.bothner.com/