class initialisation
Per Bothner
bothner@cygnus.com
Wed Sep 16 14:19:00 GMT 1998
> With interpreting/dynamic compilation, this occurs naturally (assuming the
> VM is correctly implemented). With static translation to host code, how
> does this translation ensure the ordering dependencies for <clinit>'s are
> honoured?
The compiler and run-time call _Jv_InitClass in appropriate places.
Specifically, each non-private static method calls the library routine
_Jv_InitClass before it does naything else. Each "new" also
calls _Jv_InitClass. And the compiler inserts a call to _Jv_InitClass
before a reference to a static field (unless the referenced class
is the current class or one of its superclasses).
If you think about it, I believe you will agree that handles the
required semantics.
--Per Bothner
Cygnus Solutions bothner@cygnus.com http://www.cygnus.com/~bothner
More information about the Java
mailing list