Curious Kaffe vs. jdk speed test results under Linux
Maxim Kizub
max at immsp.kiev.ua
Sat Jan 3 19:20:53 PST 1998
>Maxim Kizub wrote:
>| BTW, can someone explaine me how kaffe produces code for
>| fields access and method calls for not loaded classes? Trying to
>| do this by looking at kaffe's code is as easy as for egcs code ;-)
>
>The only entity that can access a field is a method in the class or a
subclass.
>That requires that the class be loaded. No problem there.
I'm down. Killed in one shot... (how to translate to english this russian
expression ? ;-)).
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 ?!
>As for calling methods in unloaded classes (presumably constructors or
>static methods), kaffe uses "trampolines":
>
>- A class must be loaded before any of its constructors or methods can be
> called, since Java must perform a type check.
>- However, the JIT need not be run right away. Instead, in the method
dispatch
> table for the class, all of the method pointers are initialized to point
> to a default routine.
>- When a program calls a method that hasn't been JITted yet, the default
> routine is invoked. It figures out what method was requested, JITs it,
> and replaces the entry in the method table with a pointer to the new
code.
> It then jumps to the new code.
>- The next time the method is called, its code is executed directly.
Ok, I see how it works for methods. What about fields?
>| >> I'd rather not delve into the bowels of ecgs - trying to figure out
>| something
>| >> by looking at that code is not easy.
>
>Well, kaffevm is only 33384 lines of code and gcc is only 305068, so kaffe
>is a little easier to understand. ;-)
I mean - the code of java frontend is not the whole gcc ;-)
Regards
Maxim Kizub
More information about the kaffe
mailing list