[kaffe] Adding an extra field to the struct Hjava_lang_Object

Dalibor Topic robilad at kaffe.org
Wed Apr 19 16:01:22 PDT 2006


On Thu, 2006-04-20 at 00:26 +0200, Dalibor Topic wrote:
> On Wed, 2006-04-19 at 21:33 +0300, Tayfun Elmas wrote:

Hi Tayfun,

> > However, in the filr Hjava_lang_Object.h, 
> > there is only the template of the struct type and it says the real 
> > version is created by Kaffeh. 
> 
> Yes. The real version of the file is created in the
> $builddir/include/java_lang_Object.h file when you build Kaffe using the
> make command.

Argh. I spoke without actually checking and it turned out that my memory
was wrong.

The actual struct for Hjava_lang_Object is *not* created by kaffeh.
Kaffeh has specific bits of code to avoid emitting any field information
for java.lang.Object and java.lang.Class, since those classes are
somewhat special.

Instead, the actual definition of Hjava_lang_Object can be found in the
file include/native.h.

> > Is there any way to insert the field into 
> > the structure by modifying some file?
> 
> You could modify the java file
> libraries/javalib/external/classpath/java/lang/Object.java , and add a
> field there. Such a field should then show up in the generated headers
> as well.

That's wrong advice, sorry for that. Actually, the right way to insert a
field into Object is to add it to the definition in include/native.h.

I've attached a patch, which adds a void * data, and passes the
regression tests (make check). I have not tested it further, but I am
sure you'll have some fun with that. ;)

cheers,
dalibor topic
-------------- next part --------------
A non-text attachment was scrubbed...
Name: object-data-field.diff
Type: text/x-patch
Size: 523 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20060420/330625a4/attachment-0002.bin 


More information about the kaffe mailing list