compile or not compile
Bryce McKinlay
bryce@albatross.co.nz
Sat Apr 1 00:00:00 GMT 2000
Damien Morel wrote:
> i would like to know if it is possible to have a part of my java
> application compiled in byte code and an other part in native code.
>> (i'm sorry to question about something that has been discussed in the subject :
> "Dynamic class loading", but it doesn't answers exactly my question, i think)
>> The problem is that i must optimize a program i didn't make, this is
> a program that uses AWT and makes heavy sound processing (entirely written
> in java).
>> Can i interface byte-compiled and native java code ?
> How?
libgcj has a bytecode interpreter that allows you to mix .class files with
compiled code. It works pretty transparently: if a compiled version of a class is
not found in the application binary or linked shared libraries, the class loader
will search for a bytecode version in your classpath, much like a VM would. Be
sure to build libgcj with the --enable-interpreter option to enable this
functionality. Currently it only works on x86 linux AFAIK. The downside is that
the interpreter is unfortunately rather slow, so I doubt it will be useful in your
situation.
Recent snapshots of kaffe include some support for loading gcj compiled classes
into the VM environment. This might allow you to mix optimized native java/CNI
processing code with UI code running on kaffe's AWT. I havn't tried it but I
believe it mostly works apart from an issue with monitor locking. You might want
to contact Godmar Back if you are working with this.
regards
[ bryce ]
More information about the Java
mailing list