Problems with class init
Godmar Back
gback at cs.utah.edu
Sat Feb 27 23:56:04 PST 1999
>
> I am trying to get the m68k port working. I'm almost there, but Runtime
> has a problem. If I use -vmdebug RESERROR, I get (tail end):
>
> 0x11a048 entering process class java/lang/Runtime 1->5
> 0x11a048 leaving process class java/lang/Runtime -> success
> 0x11a048 entering process class java/lang/Runtime 5->11
> 0x11a048 entering process class kaffe/lang/MemoryAdvice 1->5
> 0x11a048 leaving process class kaffe/lang/MemoryAdvice -> success
> 0x11a048 entering process class java/lang/Runtime 9->11
> 0x11a048 leaving process class java/lang/Runtime -> success
> 0x11a048 entering process class java/util/StringTokenizer 1->5
> 0x11a048 leaving process class java/util/StringTokenizer -> success
> 0x11a048 entering process class java/util/StringTokenizer 5->11
> 0x11a048 leaving process class java/util/StringTokenizer -> success
> 0x11a048 entering process class java/lang/System 9->11
> 0x11a048 leaving process class java/lang/System -> success
> 0x11a048 entering process class java/lang/System 9->11
> 0x11a048 leaving process class java/lang/System -> success
> 0x11a048 entering process class java/lang/System 9->11
> 0x11a048 leaving process class java/lang/System -> success
> 0x11a048 entering process class java/lang/Runtime 9->11
> 0x11a048 leaving process class java/lang/Runtime -> success
> 0x11a048 entering process class kaffe/lang/MemoryAdvice 5->11
> 0x11a048 entering process class kaffe/lang/MemoryAdvice 9->11
> 0x11a048 leaving process class kaffe/lang/MemoryAdvice -> success
> 0x11a048 entering process class kaffe/lang/MemoryAdvice 9->11
> 0x11a048 leaving process class kaffe/lang/MemoryAdvice -> success
> 0x11a048 leaving process class kaffe/lang/MemoryAdvice -> success
> 0x11a048 entering process class java/lang/Runtime 9->11
> 0x11a048 leaving process class java/lang/Runtime -> success
> 0x11a048 leaving process class java/lang/Runtime -> failure
>
> So, Runtime gets moved all the way to state 11 successfully, then fails.
> Afterwards, soft_fixup_trampoline throws a SIGSEGV.
>
> Under what circumstances can a class that makes it to state 11 successfully
> fail?
>
If a class references itself from within its static initializer, then
we must be able to construct objects of that class even before it's clear
whether the class was successfully initialized.
This is what happens here: a new Runtime() object is constructed during
the static initializer of class Runtime:
private static Runtime currentRuntime = new Runtime();
Later on, the static initializer fails for some reason.
- Godmar
More information about the kaffe
mailing list