summary refs log tree commit diff
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-04-26 16:12:38 -0700
committerIrene Knapp <ireneista@irenes.space>2026-04-26 16:12:38 -0700
commit5008f5f5eb871ba537af689f1993b4bc8da9acad (patch)
treeea33b0732118494c996ab2687f52ba1caeb6da26
parentf97c0dfd006515fe2fd41d35100c3de60c82125b (diff)
unlink all the static stuff from the ELF from the dictionary
this ensures we don't accidentally use it going forward

Force-Push: yes
Change-Id: Id2ae7248d25f4090540a7ca795f13e0523f24c74
-rw-r--r--quine.asm20
1 files changed, 17 insertions, 3 deletions
diff --git a/quine.asm b/quine.asm
index 41d2ea6..d11ba48 100644
--- a/quine.asm
+++ b/quine.asm
@@ -11190,6 +11190,20 @@ defword boot_source, 0x40
   dq "  6 8 * + swap drop + swap drop -1 * ,                          "
   dq "  ; make-immediate                                              "
 
+  ; This use of bitwise and is valid because the inputs are 0 or 1.
+  dq ": is-in-heap dup heap @ <= swap here @ > and ;                  "
+
+  dq ": unlink-pre-heap-words                                         "
+  dq "  latest @                                                      "
+  dq "  dup { dup is-in-heap 0 = { drop exit } if }                   "
+  dq "      { drop exit } if-else                                     "
+  dq "  { dup @ is-in-heap } { @ } while                              "
+  dq "  0 swap ! ;                                                    "
+  ; Do it immediately, so that we don't accidentally rely on any of that.
+  dq "unlink-pre-heap-words                                           "
+
+  ; Now some fancier stack combinators.
+  ;
   ;   While it might be nice, for performance reasons, to do these in
   ; assembler, for now it's more important to have them at all.
   dq ": over swap dup 3unroll ;                                       "
@@ -11201,13 +11215,12 @@ defword boot_source, 0x40
   dq ": not 0 = ;                                                     "
   dq ": negate -1 * ;                                                 "
 
-  ; This use of bitwise and is valid because the inputs are 0 or 1.
-  dq ": is-in-heap dup heap @ <= swap here @ > and ;                  "
-
+  ; Some output formatting tools.
   dq ": space 32 value@ emitstring drop ;                             "
   dq ": newline 10 value@ emitstring drop ;                           "
   dq ": indent { dup } { space 1 - } while drop ;                     "
 
+  ; Some debugging tools.
   dq ": stack                                                         "
   dq "  s0 @ 8 - { dup value@ 8 + != }                                "
   dq "  { dup s0 @ 8 - != { space } if dup @ . 8 - }                  "
@@ -11240,6 +11253,7 @@ defword boot_source, 0x40
   ;dq ": foo { 5 . } forever ; foo ' foo forget                        "
   ;dq ": foo 0 { dup 5 > } { dup . 1 + } while drop ; foo ' foo forget "
 
+  dq "unlink-pre-heap-words list-dictionary                           "
   dq "                                                                "
 
   ; TODO define ( ... ) comments