This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
thoughts: boot classloader/classpath
- From: Jakob Praher <jpraher at yahoo dot de>
- To: "java at gcc dot gnu dot org" <java at gcc dot gnu dot org>
- Date: Thu, 30 Dec 2004 18:07:54 +0100
- Subject: thoughts: boot classloader/classpath
hi,
* I hope to get some answers from you on this. *
* Caution: I have spend quite some time on this and find/grep helped me
considerable, but some of this might be wrong. please feel free to
correct me - I enjoy learning something new ... - so these is just my
personal view on the matter *
in the current libjava implementation, if a ClassLoader bypasses its
parent ClassLoader, by setting it to null, the only universally
accessible classes are those that are already in the Cache.
Since the java::lang::VMClassLoader::loadClass static native method
calls the _Jv_FindClassInCache method which in turn looks only at the
global hash table for classes which are loaded or who have already
initialized the loading phase.
also it is currently not possible to add classes to the a kind of
endorsed path (allthough I saw that rhug had support for a
$PREFIX/share/java/ext stuff).
My proposal:
* Add bootclasspath options to the gij file
* Add support for endorsed shared-objects / jar files
* Add support for Precompiled boot classes.
Some tails from the java executable:
* It has -Xbootclasspath* arguments
* From an outsiders view the bootclasspath behaves like a normal
systemclasspath, ie if you do a strace -e open on and execute java you
see that jars from the bootclasspath are lazy fetched, that means doing
a Class.forName( "someClass" ) opens the jar just in time.
* I suppose this is also true for endorsed libs
This all leads to my conclusion:
Add an additional ClassLoader instance to the system, that is much like
the gnu.gcj.runtime.VMClassLoader, except that it is used even when the
parent of a ClassLoader is set to nil. This sould also work by using the
procompiled flags etc, and be as lazy as the normal VMClassloader.
Perhaps some more optimizations can be done on the bootclasspath, since
people should know what they are doing when using the bootclasspath ....
I could write a reference implementation for it, if you want.
I wish you a happy new year.
--
Jakob Praher <jpraher@yahoo.de>