[cp-patches] Classpath 0.91 startup exception

Archie Cobbs archie at dellroad.org
Tue May 30 01:40:43 UTC 2006

Mark Wielaard wrote:
> Hi Archie,
> On Tue, 2006-05-23 at 04:57 -0500, Archie Cobbs wrote:
>> After upgradeing JCVM to 0.91, I'm seeing an exception due to broken
>> static initializer ordering in java.lang.VMClassLoader. The "bootjars"
>> static field is initialized on line 173, but this is after its use
>> (indirectly) in the static initializer that starts on line 83.
>> [...]
>> I'm very curious though.. why is nobody else seeing these problems??
>> It doesn't seem VM-specific but maybe I'm missing something.
> Kaffe was seeing the same as you in VMClassLoader. And they fixed it in
> the same way you did. Sorry for not catching that earlier.
> JamVM and Cacao use a completely different VMClassLoader implementation.
> It seems all other runtimes have their own VMString.intern()
> implementation (since they keep a class string constants pool already)
> so they aren't hit by the second issue you are seeing.
> The problem comes from the following "workaround" for another bootstrap
> issue in Math:
>   // FIXME - This is here because we need to load the "javalang" system
>   // library somewhere late in the bootstrap cycle. We cannot do this
>   // from VMSystem or VMRuntime since those are used to actually load
>   // the library. This is mainly here because historically Math was
>   // late enough in the bootstrap cycle to start using System after it
>   // was initialized (called from the java.util classes).
>   static
>   {
>     if (Configuration.INIT_LOAD_LIBRARY)
>       {
>         System.loadLibrary("javalang");
>       }
>   }
> I don't know yet what a clean solution is here.

Thanks.. I already checked in a fix for the 'bootjars' problem, which
was easy (a simple reordering of static initializers in the source code).

I haven't looked at the Math.java problem quoted above. However, it
seems like you could do the initialization in VMSystem or VMRuntime
instead if you were careful to ensure it happened as the last step.

By the way, the second exception I posted (I got after fixing the
'bootjars' problem) was JC-specific, i.e. not a Classpath issue.


Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

More information about the Classpath-patches mailing list