This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the GCJ project. See the GCJ home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

class initialisation



I have a question for Cygnus ...

Java VM semantics are very explicit about **when** a class initialiser
(<clinit>) gets executed.
[See section 2.16.4 of the book "The Java Virtual Machine Specification" by
Lindholm and Yellin]

A <clinit> for class X can only be run at the **first active use** of a
bytecode requiring that class X, such as an invoke or a field access
involving X or a subclass of X.

Therefore, there are ordering dependencies between <clinit>'s  based on the
execution path taken through the Java program.

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?

Jerry Kramskoy, Senior Consultant, Embedded VM Group
Insignia Solutions.