diff options
Diffstat (limited to 'transform.e')
| -rw-r--r-- | transform.e | 71 |
1 files changed, 51 insertions, 20 deletions
diff --git a/transform.e b/transform.e index d917601..61ef373 100644 --- a/transform.e +++ b/transform.e @@ -712,11 +712,33 @@ allocate-transform-state s" transform-state" variable dup s" describe-docol" stringcmp 0 = { drop -1 exit } if dup s" describe" stringcmp 0 = { drop -1 exit } if dup s" describe-all" stringcmp 0 = { drop 0 exit } if + dup s" describe-compilation" stringcmp 0 = { drop 0 exit } if dup s" forget" stringcmp 0 = { drop -1 exit } if dup s" ," stringcmp 0 = { drop -1 exit } if dup s" make-immediate" stringcmp 0 = { drop 0 exit } if dup s" make-hidden" stringcmp 0 = { drop 0 exit } if dup s" make-visible" stringcmp 0 = { drop 0 exit } if + dup s" recurse" stringcmp 0 = { drop 0 exit } if + dup s" recurse" stringcmp 0 = { drop 0 exit } if + dup s" find" stringcmp 0 = { drop 0 exit } if + dup s" allocate" stringcmp 0 = { drop 0 exit } if + dup s" create" stringcmp 0 = { drop -1 exit } if + dup s" self-codeword" stringcmp 0 = { drop 0 exit } if + dup s" variable" stringcmp 0 = { drop -2 exit } if + dup s" keyword" stringcmp 0 = { drop -1 exit } if + + ~ From input.e. + dup s" buffer-physical-start" stringcmp 0 = { drop 0 exit } if + dup s" buffer-physical-length" stringcmp 0 = { drop 0 exit } if + dup s" buffer-logical-start" stringcmp 0 = { drop 0 exit } if + dup s" buffer-logical-length" stringcmp 0 = { drop 0 exit } if + dup s" input-buffer-refill" stringcmp 0 = { drop 0 exit } if + dup s" input-buffer-next-source" stringcmp 0 = { drop 0 exit } if + dup s" clear-buffer" stringcmp 0 = { drop -1 exit } if + dup s" zero-input-buffer-metadata" stringcmp 0 = { drop -1 exit } if + dup s" allocate-input-buffer-metadata" stringcmp 0 = { drop 1 exit } if + dup s" allocate-input-buffer" stringcmp 0 = { drop 0 exit } if + dup s" attach-string-to-input-buffer" stringcmp 0 = { drop -2 exit } if ~ Created by warm-start in execution.e. dup s" log" stringcmp 0 = { drop 1 exit } if @@ -758,7 +780,7 @@ allocate-transform-state s" transform-state" variable ~ This is the alternate version of "create" for use with the label ~ transform. Its code is the same as the regular "create" except as noted ~ below. It is likely to be extremely useful to read and understand "create" -~ in interpret.e before attempting to understand label-create-alternate. +~ in dynamic.e before attempting to understand label-create-alternate. : label-create-alternate dup stringlen 1 + dup 3unroll here @ 10 + 3unroll memmove @@ -788,7 +810,7 @@ allocate-transform-state s" transform-state" variable ~ This is the alternate version of ":" for use with the label transform. Its ~ code is the same as the regular "create" except as noted below. It is likely -~ to be extremely useful to read and understand ":" in interpret.e before +~ to be extremely useful to read and understand ":" in dynamic.e before ~ attempting to understand label-colon-alternate. : label-colon-alternate ~ This calls label-create-alternate instead of "create". @@ -806,7 +828,7 @@ allocate-transform-state s" transform-state" variable ~ This is the alternate version of ";" for use with the label transform. Its ~ code is the same as the regular "create" except as noted below. It is likely -~ to be extremely useful to read and understand ";" in interpret.e before +~ to be extremely useful to read and understand ";" in dynamic.e before ~ attempting to understand label-semicolon-alternate. : label-semicolon-alternate ~ This looks up "exit" by label. @@ -825,7 +847,7 @@ allocate-transform-state s" transform-state" variable ~ This is the alternate version of ";asm" for use with the label transform. ~ Its code is the same as the regular "create" except as noted below. It is -~ likely to be extremely useful to read and understand ";asm" in interpret.e +~ likely to be extremely useful to read and understand ";asm" in dynamic.e ~ before attempting to understand label-semicolon-assembly-alternate. : label-semicolon-assembly-alternate here @ pack-next 8 packalign here ! @@ -1092,7 +1114,7 @@ allocate-transform-state s" transform-state" variable ~ This implements the label transform for a single word. It is directly -~ analogous to "interpret", and reading interpret.e may help in understanding +~ analogous to "interpret", and reading dynamic.e may help in understanding ~ it, though it's meant to still make sense on its own. ~ ~ It expects to be called from "label-transform", below, which loops. @@ -1292,7 +1314,7 @@ allocate-transform-state s" transform-state" variable ~ This implements the label transform for all words in a region given as an -~ input string. It is directly analogous to "quit", in interpret.e, but is far +~ input string. It is directly analogous to "quit", in interpet.e, but is far ~ more complex. ~ ~ (output buffer start, output point, input string pointer @@ -1594,26 +1616,34 @@ allocate-transform-state s" transform-state" variable ~ It's worth keeping in mind that this alternate only gets called for ~ manual invocations of "create". It isn't called from the colon alternate. : log-load-create-alternate - log-load-roll-log-address + ~ In immediate mode, we have special behavior because this is fundamental + ~ to bootstrapping the log. In compile mode, we compile a dynamic call, + ~ which is the same thing that would happen if we didn't have an alternate + ~ at all. + interpreter-flags @ 0x01 & { + s" ," log-load-compile-dynamic-word + } { + log-load-roll-log-address - swap-transform-variables - L@' log-load-create - L@' swap - swap-transform-variables + swap-transform-variables + L@' log-load-create + L@' swap + swap-transform-variables - ~ The overall stack delta of this sequence is 0. - offset-to-target-address-space , ~ swap - offset-to-target-address-space , ~ log-load-create + ~ The overall stack delta of this sequence is 0. + offset-to-target-address-space , ~ swap + offset-to-target-address-space , ~ log-load-create - ~ We've consumed a string pointer from the stack, so that's a delta of -1. - -1 transform-apply-stack-delta + ~ We've consumed a string pointer from the stack, so that's a delta of -1. + -1 transform-apply-stack-delta - log-load-unroll-log-address ; + log-load-unroll-log-address + } if-else ; ~ This is the alternate version of ":" for use with the log-load transform. ~ Its code is the same as the regular ":" except as noted below. It is likely -~ to be extremely useful to read and understand ":" in interpret.e before +~ to be extremely useful to read and understand ":" in dynamic.e before ~ attempting to understand "log-load-colon-alternate". : log-load-colon-alternate word value@ @@ -1652,7 +1682,7 @@ allocate-transform-state s" transform-state" variable ~ This is the alternate version of ";" for use with the log-load transform. ~ Its code is the same as the regular ";" except as noted below. It is -~ likely to be extremely useful to read and understand ";" in interpret.e +~ likely to be extremely useful to read and understand ";" in dynamic.e ~ before attempting to understand "log-load-semicolon-alternate". : log-load-semicolon-alternate ~ We generate code that looks up "exit" by name and appends it to the @@ -1685,7 +1715,7 @@ allocate-transform-state s" transform-state" variable ~ This is the alternate version of ";asm" for use with the log-load ~ transform. Its code is the same as the regular "create" except as noted ~ below. It is likely to be extremely useful to read and understand ";asm" in -~ interpret.e before attempting to understand "log-load;asm". +~ dynamic.e before attempting to understand "log-load;asm". : log-load-semicolon-assembly-alternate ~ We generate code that statically invokes log-load-semicolon-assembly, ~ which does all the actual work. There's quite a few steps, so it makes @@ -2098,6 +2128,7 @@ allocate-transform-state s" transform-state" variable swap drop ' log-load-left-square-brace-alternate swap } if dup s" ]" stringcmp 0 = { swap drop ' log-load-right-square-brace-alternate swap } if + dup s" '" stringcmp 0 = { swap drop ' log-load-tick-alternate swap } if dup s" ," stringcmp 0 = { swap drop ' log-load-comma-alternate swap } if dup s" keyword" stringcmp 0 = { swap drop ' log-load-keyword-alternate swap } if |