diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-09-19 02:58:13 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-09-19 03:27:39 -0700 |
| commit | 2cc1bb8c69e642d5a49324760299997771917c04 (patch) | |
| tree | 64e8fb7b9d3433155b3a27e96883962889b3c026 | |
| parent | e627892f79a50708ac9f6d6d82f84fdbb7ca34c5 (diff) | |
magic comments for all the high-level flow control in the label transform
Change-Id: I5430e14e81c5981f358fda43c2f35ed47cafc29b Force-Push: yes
| -rw-r--r-- | transform.e | 72 |
1 files changed, 48 insertions, 24 deletions
diff --git a/transform.e b/transform.e index 12ac253..e9f3539 100644 --- a/transform.e +++ b/transform.e @@ -1166,11 +1166,16 @@ allocate-transformation-state s" transformation-state" variable L@' != L@' lit swap-transform-variables - offset-to-target-address-space , 0 , ~ lit - offset-to-target-address-space , ~ != + offset-to-target-address-space , ~ : -8 lit (codeword pointer) + 0 ~ : provide-hex + , ~ : -8 # (integer literal) + offset-to-target-address-space , ~ : -8 != (codeword pointer) ~ The branch length needs to be one word longer than the block length, ~ because the length field itself is part of the scope of the branch. - offset-to-target-address-space , dup 8 + , ~ 0branch + offset-to-target-address-space , ~ : -8 0branch (codeword pointer) + dup 8 + ~ : provide-hex + ~ : 8 # (branch offset) + , ~ (old here, length) drop 5 8 * + here ! ; make-immediate @@ -1188,11 +1193,16 @@ allocate-transformation-state s" transformation-state" variable L@' = L@' lit swap-transform-variables - offset-to-target-address-space , 0 , ~ lit - offset-to-target-address-space , ~ = + offset-to-target-address-space , ~ : -8 lit (codeword pointer) + 0 ~ : provide-hex + , ~ : -8 # (integer literal) + offset-to-target-address-space , ~ : -8 = (codeword pointer) ~ The branch length needs to be one word longer than the block length, ~ because the length field itself is part of the scope of the branch. - offset-to-target-address-space , dup 8 + , ~ 0branch + offset-to-target-address-space , ~ : -8 0branch (codeword pointer) + dup 8 + ~ : provide-hex + ~ : 8 # (branch offset) + , ~ (old here, length) drop 5 8 * + here ! ; make-immediate @@ -1209,7 +1219,7 @@ allocate-transformation-state s" transformation-state" variable 3 pick dup 5 8 * + 4 pick memmove ~ (true start, true length, false start, false length) - ~ Now we write out the initial test-and-branch. + ~ Now we write out the initial test-and-branch. 4 roll dup 5 unroll here @ 6 unroll here ! ~ (old here, true start, true length, false start, false length) swap-transform-variables @@ -1217,23 +1227,29 @@ allocate-transformation-state s" transformation-state" variable L@' != L@' lit swap-transform-variables - offset-to-target-address-space , 0 , ~ lit - offset-to-target-address-space , ~ != + offset-to-target-address-space , ~ : -8 lit (codeword pointer) + 0 ~ : provide-hex + , ~ : -8 # (integer literal) + offset-to-target-address-space , ~ : -8 != (codeword pointer) ~ Branch past the length field, the true-block, and the unconditional ~ branch in the middle. - offset-to-target-address-space , ~ 0branch - 3roll dup 4 unroll 3 8 * + , + offset-to-target-address-space , ~ : -8 0branch (codeword pointer) + 3roll dup 4 unroll 3 8 * + ~ : provide-hex + ~ : 8 # (branch offset) + , - ~ Next, write out the unconditional branch in the middle. + ~ Next, write out the unconditional branch in the middle. swap dup 3unroll 5 8 * + here ! swap-transform-variables L@' branch swap-transform-variables - offset-to-target-address-space , ~ branch - ~ Branch past the length field and the false-block. - dup 8 + , + offset-to-target-address-space , ~ : -8 branch (codeword pointer) + ~ Branch past the length field and the false-block. + dup 8 + ~ : provide-hex + ~ : 8 # (branch offset) + , - ~ Set "here" to point to the true end. + ~ Set "here" to point to the true end. drop drop drop drop 7 8 * + here ! ; make-immediate @@ -1242,8 +1258,10 @@ allocate-transformation-state s" transformation-state" variable swap-transform-variables L@' branch swap-transform-variables - offset-to-target-address-space , ~ branch - 8 + -1 * , drop + offset-to-target-address-space , ~ : -8 branch (codeword pointer) + 8 + -1 * ~ : provide-hex + ~ : 8 # (branch offset) + , drop ; make-immediate ~ (test start, test length, body start, body length --) @@ -1257,11 +1275,15 @@ allocate-transformation-state s" transformation-state" variable L@' != L@' lit swap-transform-variables - offset-to-target-address-space , 0 , ~ lit - offset-to-target-address-space , ~ != + offset-to-target-address-space , ~ : -8 lit (codeword pointer) + 0 ~ : provide-hex + , ~ : -8 # (integer literal) + offset-to-target-address-space , ~ : -8 != (codeword pointer) ~ Branch past the length field, the body, and the unconditional branch. - offset-to-target-address-space , ~ 0branch - dup 3 8 * + , + offset-to-target-address-space , ~ : -8 0branch (codeword pointer) + dup 3 8 * + ~ : provide-hex + ~ : 8 # (branch offset) + , ~ Set "here" to the new end. 5 8 * 6 roll + here ! ~ (test start, test length, body start, body length) @@ -1270,8 +1292,10 @@ allocate-transformation-state s" transformation-state" variable swap-transform-variables L@' branch swap-transform-variables - offset-to-target-address-space , - 6 8 * + swap drop + swap drop -1 * , + offset-to-target-address-space , ~ : -8 branch (codeword pointer) + 6 8 * + swap drop + swap drop -1 * ~ : provide-hex + ~ : 8 # (branch offset) + , ; make-immediate |