[boehm-gc] Import 6.3 alpha 1
Bryce McKinlay
bryce@mckinlay.net.nz
Thu Jul 31 00:18:00 GMT 2003
On Thursday, Jul 31, 2003, at 01:53 Pacific/Auckland, Jeff Sturm wrote:
>> The
>> construction of the binary compatibility/link tables would be
>> completed
>> before any code from a given class is run, so there arn't any issues
>> with having to synchronize & check link tables at runtime. (the
>> statement in my post above should actually read "java.lang.Class
>> objects would be created at runtime as classes are _linked_ ")
>> Creating class instances on the heap could go a long way towards
> solving
> the large root set problem.
>> Drifting off topic slightly, I think it does matter when exactly
> classes
> are linked. If I have a class A:
>> class A {
> B b() {
> return new B();
> }
> }
>> should "new A()" cause B to be loaded? (With the JRE it does not.)
Yes, B would have to be loaded/linked before or during initialization
of A. However, based on my understanding of the JLS, applications that
rely on B not being loaded until b() is called are relying on
unspecified behaviour. From JLS S12.3:
"This specification allows an implementation flexibility as to when
linking activities (and, because of recursion, loading) take place,
provided that the semantics of the language are respected, that a class
or interface is completely verified and prepared before it is
initialized, and that errors detected during linkage are thrown at a
point in the program where some action is taken by the program that
might require linkage to the class or interface involved in the error.
For example, an implementation may choose to resolve each symbolic
reference in a class or interface individually, only when it is used
(lazy or late resolution), or to resolve them all at once while the
class is being verified (static resolution). This means that the
resolution process may continue, in some implementations, after a class
or interface has been initialized."
> This is an example of what blocks us from using gcj from "real world"
> applications.
Got any examples? Not that I don't believe you, but I'd like to
understand the problem better.
Regards,
Bryce.
More information about the Java
mailing list