about summary refs log tree commit diff stats
path: root/subx/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-07-12 11:39:35 -0700
committerKartik Agaram <vc@akkartik.com>2019-07-12 11:39:35 -0700
commitf0eb6314286e4cf5612c49beab19b241c4bc98e4 (patch)
tree1eff0d523cdfce61f110e759d08c937b6a045438 /subx/apps
parente150e6e46e783d7c1b6e3986204980263ef62713 (diff)
downloadmu-f0eb6314286e4cf5612c49beab19b241c4bc98e4.tar.gz
compute-offsets test now passing
The final integration test-convert-computes-addresses is still failing.
Diffstat (limited to 'subx/apps')
-rwxr-xr-xsubx/apps/surveybin40103 -> 39892 bytes
-rw-r--r--subx/apps/survey.subx146
2 files changed, 97 insertions, 49 deletions
diff --git a/subx/apps/survey b/subx/apps/survey
index 28224ac6..aeb2290b 100755
--- a/subx/apps/survey
+++ b/subx/apps/survey
Binary files differdiff --git a/subx/apps/survey.subx b/subx/apps/survey.subx
index c7f7b0a9..a3e5cb5a 100644
--- a/subx/apps/survey.subx
+++ b/subx/apps/survey.subx
@@ -593,53 +593,53 @@ $compute-offsets:construct-next-segment:
     e8/call  next-word/disp32
     # . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # dump curr-segment-name if not null (clobbering EAX) {{{
-    # . if (curr-segment-name == 0) goto update-curr-segment-name
-    81          7/subop/compare     3/mod/direct    6/rm32/ESI    .           .             .           .           .               0/imm32           # compare ESI
-    74/jump-if-equal  $compute-offsets:update-curr-segment-name/disp8
-    # . write(2/stderr, "setting segment to: ")
-    # . . push args
-    68/push  "setting segment to: "/imm32
-    68/push  2/imm32/stderr
-    # . . call
-    e8/call  write/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # . clear-stream(Stderr+4)
-    # . . push args
-    b8/copy-to-EAX  Stderr/imm32
-    05/add-to-EAX  4/imm32
-    50/push-EAX
-    # . . call
-    e8/call  clear-stream/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
-    # . . restore EAX
-    58/pop-to-EAX
-    # . write-buffered(Stderr, curr-segment-name)
-    # . . push args
-    56/push-ESI
-    68/push  Stderr/imm32
-    # . . call
-    e8/call  write-buffered/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # . flush(Stderr)
-    # . . push args
-    68/push  Stderr/imm32
-    # . . call
-    e8/call  flush/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
-    # . write(2/stderr, "$\n")
-    # . . push args
-    68/push  "$\n"/imm32
-    68/push  2/imm32/stderr
-    # . . call
-    e8/call  write/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # }}}
+#?     # dump curr-segment-name if not null (clobbering EAX) {{{
+#?     # . if (curr-segment-name == 0) goto update-curr-segment-name
+#?     81          7/subop/compare     3/mod/direct    6/rm32/ESI    .           .             .           .           .               0/imm32           # compare ESI
+#?     74/jump-if-equal  $compute-offsets:update-curr-segment-name/disp8
+#?     # . write(2/stderr, "setting segment to: ")
+#?     # . . push args
+#?     68/push  "setting segment to: "/imm32
+#?     68/push  2/imm32/stderr
+#?     # . . call
+#?     e8/call  write/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # . clear-stream(Stderr+4)
+#?     # . . push args
+#?     b8/copy-to-EAX  Stderr/imm32
+#?     05/add-to-EAX  4/imm32
+#?     50/push-EAX
+#?     # . . call
+#?     e8/call  clear-stream/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+#?     # . . restore EAX
+#?     58/pop-to-EAX
+#?     # . write-buffered(Stderr, curr-segment-name)
+#?     # . . push args
+#?     56/push-ESI
+#?     68/push  Stderr/imm32
+#?     # . . call
+#?     e8/call  write-buffered/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # . flush(Stderr)
+#?     # . . push args
+#?     68/push  Stderr/imm32
+#?     # . . call
+#?     e8/call  flush/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+#?     # . write(2/stderr, "$\n")
+#?     # . . push args
+#?     68/push  "$\n"/imm32
+#?     68/push  2/imm32/stderr
+#?     # . . call
+#?     e8/call  write/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # }}}
 $compute-offsets:update-curr-segment-name:
     # curr-segment-name = slice-to-string(segment-tmp)
     # . EAX = slice-to-string(Heap, segment-tmp)
@@ -731,9 +731,10 @@ $compute-offsets:case-label:
     e8/call  get-or-insert-slice/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+$compute-offsets:save-label-offset:
     # x->segment-offset = segment-offset
     # . EBX = segment-offset
-    8f          0/subop/pop         0/mod/indirect  5/rm32/.disp32            .             .           .           compute-offsets:segment-offset/disp32
+    8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           3/r32/EBX   compute-offsets:segment-offset/disp32  # copy *segment-offset to EBX
     # . x->segment-offset = EBX
     89/copy                         1/mod/*+disp8   0/rm32/EAX    .           .             .           3/r32/EBX   4/disp8         .                 # copy EBX to *(EAX+4)
     # trace-slsss("label '" word-slice/EDX "' is in segment '" current-segment-name "'.")
@@ -776,6 +777,53 @@ $compute-offsets:case-default:
     01/add                          0/mod/indirect  5/rm32/.disp32            .             .           0/r32/EAX   compute-offsets:segment-offset/disp32 # add EAX to *segment-offset
     # file-offset += width
     01/add                          0/mod/indirect  5/rm32/.disp32            .             .           0/r32/EAX   compute-offsets:file-offset/disp32 # add EAX to *file-offset
+#?     # dump segment-offset {{{
+#?     # . write(2/stderr, "segment-offset: ")
+#?     # . . push args
+#?     68/push  "segment-offset: "/imm32
+#?     68/push  2/imm32/stderr
+#?     # . . call
+#?     e8/call  write/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # . clear-stream(Stderr+4)
+#?     # . . save EAX
+#?     50/push-EAX
+#?     # . . push args
+#?     b8/copy-to-EAX  Stderr/imm32
+#?     05/add-to-EAX  4/imm32
+#?     50/push-EAX
+#?     # . . call
+#?     e8/call  clear-stream/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+#?     # . . restore EAX
+#?     58/pop-to-EAX
+#?     # . print-int32-buffered(Stderr, segment-offset)
+#?     # . . push args
+#?     52/push-EDX
+#?     ff          6/subop/push        0/mod/indirect  5/rm32/.disp32            .             .           .           compute-offsets:segment-offset/disp32  # push *segment-offset
+#?     68/push  Stderr/imm32
+#?     # . . call
+#?     e8/call  print-int32-buffered/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # . flush(Stderr)
+#?     # . . push args
+#?     68/push  Stderr/imm32
+#?     # . . call
+#?     e8/call  flush/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+#?     # . write(2/stderr, "\n")
+#?     # . . push args
+#?     68/push  "\n"/imm32
+#?     68/push  2/imm32/stderr
+#?     # . . call
+#?     e8/call  write/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # }}}
     e9/jump $compute-offsets:word-loop/disp32
 $compute-offsets:break-line-loop:
     # seg/EAX = get-or-insert(segments, curr-segment-name, row-size=16)
@@ -801,7 +849,7 @@ $compute-offsets:break-line-loop:
     # . restore ECX
     59/pop-to-ECX
     # trace-sssns("segment '", curr-segment-name, "' has size ", seg->size, ".")
-    # . trace-sssns("segment '", curr-segment-name, "' has size ", EAX, ".")
+    # . trace-sssns("segment '", curr-segment-name, "' has size ", EBX, ".")
     # . . push args
     68/push  "."/imm32
     53/push-EBX