memory defragmentation

Godmar Back gback at
Tue Feb 16 08:56:18 PST 1999

> >Furthermore, take a look at kaffevm/gcFuncs.c kaffevm/gc.h.  You will need
> >to extend the gc interface to communicate information about the locations
> >in which pointers to gcable objects are stored between the VM and gc
> subsystem.
> To be honest, I still have not figure out how memory referencing works in
> kaffe. That is, when an object, say A, is accessing the object B's data,
> where the object A can retrieve the address of obejct B in terms of kaffe's
> data structure? 

Just like in C.  Object A stores a pointer to object B, and accesses the
data of object B directly using an offset.

The computation of the offset is a bit complicated, as it depends on how
a C compiler on that platform lays out structs.
See classMethod.c:resolveObjectsFields.  Kaffe must lay out the memory
corresponding to a Java object in the same way as a C compiler would lay
out a corresponding C struct, because native methods written to the old
native interface rely on the "struct" definition created by kaffeh.
Check out the include/*.h files created during a build in your build tree.

	- Godmar

More information about the kaffe mailing list