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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

first active use of a class


>>>>> "Godmar" == Godmar Back <gback@cs.utah.edu> writes:
Godmar> A couple of weeks ago, we had Guy Steele visiting the
Godmar> University of Utah. We had the chance to discuss some Java
Godmar> issues with him.

Godmar> One issue was the issue of "first active use" of a class. I
Godmar> pointed out that WAT compilers such as gcj are being penalized
Godmar> because they have to insert code that checks for each possible
Godmar> first use of a class whether its <clinit> initializer needs to
Godmar> be invoked.

Godmar> He said that his interpretation of the JLS gives such compiler
Godmar> writers the freedom to preinitialize all classes before you
Godmar> even invoke the main method; essentially saving that test.

There's a (not well publicized) clarification note from Sun that
amongst other things addresses class initialization:

  http://java.sun.com/docs/books/jls/clarify.html

The description (paraphrasing) says that a class will be initialized
"immediately before" the first occurrence of a few different types of
uses. So this comes down to your interpretation of the term
"immediately before" being used.

-jvp

------------------------------
 Jim Van_Peursem, Ph.D.
 Motorola, Inc.
 1301 E. Algonquin Rd.
 Schaumburg, IL 60196
 e-mail: jvp@ccrl.mot.com
------------------------------
 I don't speak for Motorola
 Motorola doesn't speak for me
------------------------------