about summary refs log tree commit diff
path: root/execution.e
diff options
context:
space:
mode:
Diffstat (limited to 'execution.e')
-rw-r--r--execution.e53
1 files changed, 52 insertions, 1 deletions
diff --git a/execution.e b/execution.e
index 20064af..66f04d1 100644
--- a/execution.e
+++ b/execution.e
@@ -236,6 +236,21 @@
 ~ (output memory start, current output point
 ~  -- output memory start, current output point)
 : output-cold-start
+  ~ : blank-line
+  ~ : blank-line
+  ~ : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ : blank-line
+  ~ :   This is the start of the cold-start routine, which is the first code
+  ~ : of any kind the executable runs. It has the responsibility of creating
+  ~ : the Forth execution environment, then invoking the warm-start routine,
+  ~ : which is defined below.
+  ~ : blank-line
+  ~ : blank-line
+  ~ : indent
+
   current-offset L' cold-start set-label
   cld                                      ~ clear the DF flag
 
@@ -389,7 +404,9 @@
   ~   We are about to set up rsi, we did rbp already, and rsp came to us
   ~ already set up. That's all that "next" needs, so take it away!
   L@' warm-start L@' origin + :rsi mov-reg64-imm64
-  pack-next ;
+  pack-next
+  ~ : deindent
+  ;
 
 
 ~ Routine warm-start
@@ -403,6 +420,35 @@
 ~ (output buffer start, output point, input string pointer, delimiter pointer
 ~  -- output buffer start, output point)
 : output-warm-start
+  ~ : blank-line
+  ~ : blank-line
+  ~ : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ : blank-line
+  ~ :   This is the start of the warm-start routine, which is the first Forth
+  ~ : code the executable runs, after the cold-start routine has created the
+  ~ : Forth execution environment.
+  ~ :
+  ~ :   It does some initial setup here at the top; then the vast bulk of it
+  ~ : is actually the log-load routine, directly included; then finally there
+  ~ : is a small amount of finishing work done at the tail end of the
+  ~ : warm-start routine.
+  ~ :
+  ~ :   The routine's body is interpreted Forth code, meaning that it is an
+  ~ : an array of pointers to the codewords of Forth words, occasionally
+  ~ : interspersed with literal values.
+  ~ :
+  ~ :   The codeword pointers were located by using the label system, which
+  ~ : means the labels they reference must have been defined somewhere else,
+  ~ : normally by the label transform. The label-transformed code normally
+  ~ : occurs after the warm-start routine in the executable, which means these
+  ~ : are forward references to words defined far below.
+  ~ : blank-line
+  ~ : blank-line
+  ~ : indent
+
   ~   While it's not actually a requirement that codeword pointers be
   ~ word-aligned, it's highly likely that it helps performance. (Whether it
   ~ does is up to Intel's microcode.)
@@ -498,6 +544,10 @@
   log-load-transform
   ~ (output buffer start, output point)
 
+  ~ : blank-line
+  ~ :   We're now done with the log-load routine; the next little bit of code
+  ~ : here is the final bit of the warm-start routine.
+
   ~   Now everything we need has been added to the log and we're almost ready
   ~ to jump into it. It's inconvenient for code under the log-load transform
   ~ to interact with the label system, so if we want to point
@@ -511,6 +561,7 @@
   ~ Get rid of that heap pointer on the stack, we're finally done with it!
   L@' drop offset-to-target-address-space pack64
   L@' execute offset-to-target-address-space pack64
+  ~ : deindent
   ;