This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: URLClassloader and native objects
Sal writes:
> Andrew Haley wrote:
> > Before you go any further: have you read our paper about the new ABI?
> > See http://people.redhat.com/lockhart/.gcc04/MasterGCC-2side.pdf.
> > It's the last paper.
> >
> > It seems that what you're trying to do overlaps with this work to a
> > large extent.
>
> This looks good! I guess that the problem was identified and has been
> worked on for years already.
>
> Andrew, if you don't mind a few questions:
>
> - I read that a lot of ABI work has been done already. In the case
> of custom classloaders... is the current codebase able to load
> 'already natively compiled' classes, or will it load VM bytecode,
> then compile it?
The idea is to allow both. We'd like to set things up so that a
jarfile can be linked in some way to a corresponding shared object:
you'd look at the jar file and "look aside" to see if it already had
been compiled.
> I'm thinking in terms of the 'defineClass' method of
> java.lang.ClassLoader, which seems to be the central point for
> loading class data. Will you be able to load native code via this
> method, under the new ABI?
Yes. I have some code to do it, but it's kinda rough. It's not
checked in anywhere.
All it does at the moment is call gcj when asked to 'defineClass'. If
the compile completes succesfully, the compiled obejct is stashed in
the /tmp directory and the class is loaded. If the class is already
there in the /tmp directory, it's loaded directly. There are some
issues with class registration that I haven't got right, but it sort
of works.
There's no code to allow a jarfile to be separately compiled to a .so
and loaded automagically, though. It's quite tricky to figure out how
to do it.
> I know there isn't much of a difference but I'm particularly
> interested in finding a way to have GCJ load already compiled
> classes from .java source, as well as from .class files (JIT
> style), so that I could take advantage of the better compiler
> optimizations gained from .java compilation.
>
> - Do you have any roadmap / documentation on development plans for the
> new ABI? I am wondering what needs to be done yet, and curious as to
> what has already been completed. I'm interested in helping out some...
> if its possible.
Great. Well, there's a branch called gcj-abi-2-dev-branch, which you
should be able to build. -findirect-dispatch enables the new ABI.
Andrew.