about summary refs log tree commit diff
path: root/transform.e
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-09-07 23:04:15 -0700
committerIrene Knapp <ireneista@irenes.space>2026-09-07 23:04:15 -0700
commit06ce6d8b66db0a274e36d05f8a9b470455b84728 (patch)
tree5bc85c89c0e27621f268622dd6026a62219b7ac8 /transform.e
parent92b8da05981328c2d4b106d9de008625b6895620 (diff)
add tracing of the latest output point in packstring
this is necessary because packstring isn't implemented in terms of pack8, unlike packalign

also add a bunch more magic comments to hex.e, which would be in the wrong place without the semantic change

Force-Push: yes
Change-Id: I422b8d00a07568be5113e005fddaeab82f5ca731
Diffstat (limited to 'transform.e')
-rw-r--r--transform.e25
1 files changed, 23 insertions, 2 deletions
diff --git a/transform.e b/transform.e
index 3086968..ce51255 100644
--- a/transform.e
+++ b/transform.e
@@ -2988,7 +2988,7 @@ allocate-transformation-state s" transformation-state" variable
 
         dup hex-output-metadata-entry-type @
         hex-output-metadata-entry-type-string-literal = {
-          newline
+          fresh-line
           ." ~ Null-terminated string literal: "
           0x22 value@ emitstring drop
           dup hex-output-metadata-entry-string @ emitstring
@@ -2999,7 +2999,7 @@ allocate-transformation-state s" transformation-state" variable
 
         dup hex-output-metadata-entry-type @
         hex-output-metadata-entry-type-alignment = {
-          newline
+          fresh-line
           ." ~ Alignment padding to width "
           dup hex-output-metadata-entry-string @ .
           newline
@@ -3215,6 +3215,24 @@ allocate-transformation-state s" transformation-state" variable
     s" dup" find entry-to-execution-token ,
     s" stringlen" find entry-to-execution-token ,
     s" 1+" find entry-to-execution-token ,
+    ~ (output point, string pointer, string length including terminator)
+
+    ~   Before we add the metadata entry, we also want to call hex-pack-trace
+    ~ to make sure latest-output-point gets adjusted for the string.
+    ~ Otherwise, we'd see magic comments in the wrong place.
+    s" 3roll" find entry-to-execution-token ,
+    s" dup" find entry-to-execution-token ,
+    s" lit" find entry-to-execution-token ,
+    4 ,
+    s" unroll" find entry-to-execution-token ,
+    s" swap" find entry-to-execution-token ,
+    s" dup" find entry-to-execution-token ,
+    s" 3unroll" find entry-to-execution-token ,
+    ~ (output point, string pointer, string length including terminator,
+    ~  output point, string length including terminator)
+    ' hex-pack-trace entry-to-execution-token ,
+
+    ~ (output point, string pointer, string length including terminator)
     s" swap" find entry-to-execution-token ,
     ' hex-output-metadata-entry-type-string-literal entry-to-execution-token ,
     s" swap" find entry-to-execution-token ,
@@ -3355,6 +3373,9 @@ allocate-transformation-state s" transformation-state" variable
     s" -" find entry-to-execution-token ,
     ~ (output point, alignment byte width, padding start, padding length)
 
+    ~   This would be the place to put a call to hex-pack-trace, but packalign
+    ~ is implemented using pack8, so it's not necessary.
+
     ' hex-output-metadata-entry-type-alignment entry-to-execution-token ,
     ~ (output point, alignment byte width, padding start, padding length,,
     ~  entry type)