1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Add ASCII art representing the basic struct layout.

* libguile/struct.h: Add ASCII art version of the basic struct layout as
  shown in Andy's diagrams.
This commit is contained in:
Ludovic Courtès 2010-01-25 23:43:41 +01:00
parent 227eff6a77
commit bb190ddbba

View file

@ -33,9 +33,37 @@
in turn means we need support for changing the "class" (vtable) of an in turn means we need support for changing the "class" (vtable) of an
"instance" (struct). This necessitates some indirection and trickery. "instance" (struct). This necessitates some indirection and trickery.
I would like to write this all up here, but for now: To summarize, structs are laid out this way:
.-------.
| |
.----------------+---v------------- -
| vtable | data | slot0 | slot1 |
`----------------+----------------- -
| .-------.
| | |
.---v------------+---v------------- -
| vtable | data | slot0 | slot1 |
`----------------+----------------- -
|
v
...
.-------.
| | |
.---v------------+---v------------- -
.-| vtable | data | slot0 | slot1 |
| `----------------+----------------- -
| ^
`-----'
The DATA indirection (which corresponds to `SCM_STRUCT_DATA ()') is necessary
to implement class redefinition.
For more details, see:
http://wingolog.org/archives/2009/11/09/class-redefinition-in-guile http://wingolog.org/archives/2009/11/09/class-redefinition-in-guile
*/ */
/* All vtables have the following fields. */ /* All vtables have the following fields. */