This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fully dynamically compiling/dexing/loading Kawa on Android




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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]