summaryrefslogtreecommitdiff
path: root/notes
diff options
context:
space:
mode:
Diffstat (limited to 'notes')
-rw-r--r--notes/260825-code-gc.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/notes/260825-code-gc.md b/notes/260825-code-gc.md
index 9593d15..b2736af 100644
--- a/notes/260825-code-gc.md
+++ b/notes/260825-code-gc.md
@@ -309,3 +309,33 @@ I'll call it quits here. I think a simple little mark & sweep of a
global modules list would be quite fine though. To be clear I don't
mean going into the modules; just the modules themselves. So this
would be a very quick and easy operation.
+
+
+## Wait...
+
+I've made a crucial mistake: If statically linking a module means
+having direct pointers to its data, and the linking module is frozen,
+that would mean the recursive free goes into the other module. Ugh!
+
+We really need a better way to detect boundaries between modules.
+
+OK, here's an idea: Given that we have a bunch of as of yet barely
+defined bits in our heap pointer NaN types, we could have one bit
+meaning "pointer to another module's data" or more generally some
+"foreign" data indicator.
+
+For example, heap NaN pointers all have 8 bits currently reserved for
+indeterminate purposes. (Probably tri-color marking & generations.)
+One of these could be sacrificed for this purpose.
+
+Would be used in two ways:
+
+1. Intra-module references to private bindings: Copy the value into
+ the code, set the foreign bit if it's a pointer; recursive free
+ won't touch it.
+
+2. References to statically linked modules: Copy the value of the
+ binding into the code of this module, set foreign bit if pointer;
+ recursive free won't touch it.
+
+Something like that would work, I think.