summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-01-25 23:43:41 +0100
committerLudovic Courtès <ludo@gnu.org>2010-01-25 23:43:41 +0100
commitbb190ddbba216251f2a8490adf9feadf0dbb7104 (patch)
treed08e7d6849fc0a7c29c032ab03bb6723f5f1e719
parent227eff6a77dd58d64775fe91ae0f1596bfe3371b (diff)
downloadguile-bb190ddbba216251f2a8490adf9feadf0dbb7104.tar.gz
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.
-rw-r--r--libguile/struct.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/libguile/struct.h b/libguile/struct.h
index 012d9b6e7..374a5ce74 100644
--- a/libguile/struct.h
+++ b/libguile/struct.h
@@ -33,9 +33,37 @@
in turn means we need support for changing the "class" (vtable) of an
"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
+
*/
/* All vtables have the following fields. */