From 1a766dde1518cd9c208544ce0f4afd2f9ab61f0a Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Tue, 21 Apr 2026 02:33:13 -0700 Subject: re-verify that nothing on the heap depends on the text segment this was done with early_describe_all, as before. both word addresses and string addresses were checked. there were a couple fixes needed to make that run properly; they have been applied Force-Push: yes Change-Id: Idb89d04ab0deb42ef14220b2ef0e958657d75c63 --- quine.asm | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'quine.asm') diff --git a/quine.asm b/quine.asm index 70ae3fb..70f5e8a 100644 --- a/quine.asm +++ b/quine.asm @@ -5627,6 +5627,7 @@ cold_start: dq lit, 0xFFFFFFFFFFFFFF00, early_comma dq litstring, "and", early_find, entry_to_execution_token, early_comma dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "!", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma dq early_here, fetch, lit, 8, packalign, early_here_store @@ -6267,9 +6268,23 @@ cold_start: ;;; Here we have some imperative code that runs immediately, to initialize ;;; some runtime data structures. + + ; First, we insert a metadata word header to delimit the space. Otherwise + ; "describe" would crash when attempting to describe + ; "attach-string-to-input-buffer". + ; (heap pointer) + dq litstring, "main-input-buffer-metadata", early_create + dq litstring, "main-input-buffer-metadata", early_find + dq lit, 1, store_entry_flags + + ; Having done that, now we do the runtime allocation. ; (heap pointer) dq litstring, "allocate-input-buffer-metadata", early_find dq entry_to_execution_token, execute + + ; We also initialize the metadata here, pointing it to the boot source as + ; its backing store. We could do that later, but it's convenient to do it + ; here. ; (heap pointer, metadata pointer) dq swap, litstring, "attach-string-to-input-buffer", early_find ; (metadata pointer, heap pointer, entry pointer) @@ -6281,6 +6296,9 @@ cold_start: ; (heap pointer, metadata pointer, metadata pointer, string pointer, ; execution token) dq execute + + ; Finally, we define the named variable "main-input-buffer" so we can find + ; it again. ; (heap pointer, metadata pointer) dq swap, litstring, "variable", 0, early_find, entry_to_execution_token ; (metadata pointer, heap pointer, execution token) @@ -9763,7 +9781,7 @@ defword store_entry_flags, 0 ; (new flags byte, address of flags byte, old flags byte + context) dq roll3, lit, 0xFF, and dq swap, lit, 0xFFFFFFFFFFFFFF00, and, or - dq store + dq swap, store dq exit defword entry_to_name, 0 @@ -10517,9 +10535,7 @@ defword self_raw, 0 dq exit -defword foo, 0 - dq docol, litstring, "ia ia ftaghn", emitstring, exit -defword boot_source, 0 +defword boot_source, 1 dq "6 7 * ." dq 0 -- cgit 1.4.1