Class initialization, take two

Jeff Sturm jsturm@one-point.com
Wed Jan 29 18:42:00 GMT 2003


On 23 Jan 2003, Tom Tromey wrote:
> This patch looks weird, since it moves things around in a way I wasn't
> expecting.  However, I also ran into some new class init bugs, and
> this patch definitely fixes them.

It handles an unusual case, that of mutually-dependent class initializers.
After thinking it through, I don't know any other circumstance requiring
initializeClass to be reentrant from within a single thread.

> Jeff> This patch is one way to handle it.  An alternative is to add an
> Jeff> explicit link step to class initialization, as the bytecode
> Jeff> interpreter does.
>
> Do you think this would yield a cleaner result?

Maybe.  It should probably use resolveClass so it wouldn't have to have
the "if (_Jv_IsInterpretedClass (this))" check anymore.  But I'm pretty
sure resolveClass has bugs.  This should be reexamined when/if the code is
merged with resolve.cc.

If you don't mind I'll commit the patch as-is.

> It would be nice to clean it all up.  I'll submit a PR to that effect.

Sounds good.

Jeff



More information about the Java-patches mailing list