_Jv_InitPrimClass?

Bryce McKinlay bryce@waitaki.otago.ac.nz
Sun Mar 3 19:26:00 GMT 2002


Adam Megacz wrote:

>Why is this in _Jv_InitPrimClass?
>
>  // We must set the vtable for the class; the Java constructor
>  // doesn't do this.
>  (*(_Jv_VTable **) cl) = java::lang::Class::class$.vtable;
>
>It appeared sometime in late December... why do we use it now, and why
>didn't we need it before?
>

As for why it is needed, this is a special case where we are 
constructing a Java object in static .bss data, because gcj-compiled 
code wants to refer to it directly via its symbol name, eg for static 
primitive arrays. The GC (not the constructor!) normally sets the vtable 
pointer for a Java object when "new" is called, but in this case we are 
not GC allocating it so that does not happen.

regards

Bryce.




More information about the Java mailing list