Curious Kaffe vs. jdk speed test results under Linux

Godmar Back gback at cs.utah.edu
Sun Jan 3 23:14:00 PST 1999


> 
> What about this code:
> 
> class A {
>     public int i;
> }
> 
> class B {
>     int foo() {
>         if (...) {
>             A a = new A();
>             return a.i;
>         }
>         else
>             return 0;
>     }
> }
> 
> How does kaffe compiles method B.foo() when class A is not loaded?
> Until expression in the 'if' statement is true - class A is not allowed
> to be loaded ?!

The JLS explains how the loading, linking, and initialization of classes
works.  Class A can certainly be loaded when B is jit-compiled.
Therefore, its layout is known at this point in time.

However, it can not be initialized until its first active use.
The first active use is the NEW instruction (if it is executed).
This is when class A is initialized.

	- Godmar



More information about the kaffe mailing list