summary refs log tree commit diff
path: root/transform.e
diff options
context:
space:
mode:
Diffstat (limited to 'transform.e')
-rw-r--r--transform.e52
1 files changed, 51 insertions, 1 deletions
diff --git a/transform.e b/transform.e
index 507c1f1..2d75f9f 100644
--- a/transform.e
+++ b/transform.e
@@ -673,7 +673,7 @@ allocate-transform-state s" transform-state" variable
   dup s" inc-reg64" stringcmp 0 = { drop -1 exit } if
   dup s" dec-reg64" stringcmp 0 = { drop -1 exit } if
   dup s" and-reg64-reg64" stringcmp 0 = { drop -2 exit } if
-  dup s" and-reg68-imm8" stringcmp 0 = { drop -2 exit } if
+  dup s" and-reg64-imm8" stringcmp 0 = { drop -2 exit } if
   dup s" or-reg64-reg64" stringcmp 0 = { drop -2 exit } if
   dup s" or-reg64-imm8" stringcmp 0 = { drop -2 exit } if
   dup s" xor-reg64-reg64" stringcmp 0 = { drop -2 exit } if
@@ -702,6 +702,7 @@ allocate-transform-state s" transform-state" variable
   dup s" ;asm" stringcmp 0 = { drop 0 exit } if
   dup s" L@'" stringcmp 0 = { drop 1 exit } if
   dup s" L!'" stringcmp 0 = { drop -1 exit } if
+  dup s" ," stringcmp 0 = { drop -1 exit } if
 
   ~   If we get here, that's a problem. Emit an error message to make sure
   ~ it's easy to diagnose. We also return a comically large negative value,
@@ -1677,11 +1678,57 @@ allocate-transform-state s" transform-state" variable
 ~ We need this one, too. It's not even an immediate word normally!
 : log-load-right-square-brace-alternate ] ; make-immediate
 
+
+: log-load-comma-alternate
+  log-load-roll-log-address
+
+  swap-transform-variables
+  L@' log-load-comma
+  L@' swap
+  swap-transform-variables
+
+  offset-to-target-address-space ,     ~ swap
+  offset-to-target-address-space ,     ~ log-load-comma
+
+  ~   We consumed the value, so we apply a delta.
+  -1 transform-apply-stack-delta
+
+  log-load-roll-log-address
+  ; make-immediate
+
+
+~ TODO there should really be an actual word that this alternate is replacing
+~
+~ (string pointer --)
+: log-load-keyword-alternate
+  word value@
+
+  ~   Calling log-load-create-alternate would result in some redundant rolling
+  ~ and unrolling, so we do it together like this instead.
+  log-load-roll-log-address
+
+  swap-transform-variables
+  L@' log-load-keyword
+  L@' litstring
+  swap-transform-variables
+
+  ~ The overall stack delta of this sequence is 0.
+  offset-to-target-address-space ,     ~ litstring
+  swap here @ swap packstring 8 packalign here !
+  offset-to-target-address-space ,     ~ log-load-keyword
+
+  log-load-unroll-log-address
+
+  dropstring
+  ; make-immediate
+
+
 ~ Yeah comments have to go.
 : log-load-tilde-alternate
   ' ~ entry-to-execution-token execute
   ; make-immediate
 
+
 ~ Strings are important and must happen now, now, now.
 : log-load-string-alternate
   ~   Something subtle here: s" is state-dependent. That is, it does different
@@ -1815,6 +1862,9 @@ 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-comma-alternate swap } if
+  dup s" keyword" stringcmp 0 = {
+    swap drop ' log-load-keyword-alternate swap } if
   dup s" ~" stringcmp 0 = {
     swap drop ' log-load-tilde-alternate swap } if
   ~ It is nontrivial to construct a string with a double-quote in it.