about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--059stop.subx19
-rwxr-xr-xapps/assortbin44225 -> 44233 bytes
-rwxr-xr-xapps/bracesbin46088 -> 46096 bytes
-rwxr-xr-xapps/callsbin50735 -> 50743 bytes
-rwxr-xr-xapps/crenshaw2-1bin43576 -> 43574 bytes
-rw-r--r--apps/crenshaw2-1.subx10
-rwxr-xr-xapps/crenshaw2-1bbin44123 -> 44121 bytes
-rw-r--r--apps/crenshaw2-1b.subx10
-rwxr-xr-xapps/dquotesbin47847 -> 47855 bytes
-rwxr-xr-xapps/factorialbin42669 -> 42677 bytes
-rwxr-xr-xapps/hexbin46415 -> 46413 bytes
-rw-r--r--apps/hex.subx10
-rwxr-xr-xapps/mubin270430 -> 270438 bytes
-rwxr-xr-xapps/packbin56540 -> 56548 bytes
-rwxr-xr-xapps/sigilsbin58457 -> 58465 bytes
-rwxr-xr-xapps/surveybin54157 -> 54165 bytes
-rwxr-xr-xapps/testsbin42997 -> 43005 bytes
17 files changed, 19 insertions, 30 deletions
diff --git a/059stop.subx b/059stop.subx
index 85b6ad36..f6cb6fae 100644
--- a/059stop.subx
+++ b/059stop.subx
@@ -93,21 +93,28 @@ stop:  # ed: (addr exit-descriptor), value: int
     # no prologue; one way or another, we're going to clobber registers
     # eax = ed
     8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/esp  4/index/none  .           0/r32/eax   4/disp8         .                 # copy *(esp+4) to eax
+    # if (ed == 0) really exit
+    3d/compare-eax-and 0/imm32
+    74/jump-if-=  $stop:real/disp8
     # if (ed->target == 0) really exit
     81          7/subop/compare     0/mod/indirect  0/rm32/eax    .           .             .           .           .               0/imm32           # compare *eax
-    75/jump-if-!=  $stop:fake/disp8
-    # . syscall(exit, value)
-    8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/esp  4/index/none  .           3/r32/ebx   8/disp8         .                 # copy *(esp+8) to ebx
-    e8/call  syscall_exit/disp32
+    74/jump-if-=  $stop:real/disp8
 $stop:fake:
-    # otherwise:
     # ed->value = value+1
     8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/esp  4/index/none  .           1/r32/ecx   8/disp8         .                 # copy *(esp+8) to ecx
     41/increment-ecx
     89/copy                         1/mod/*+disp8   0/rm32/eax    .           .             .           1/r32/ecx   4/disp8         .                 # copy ecx to *(eax+4)
     # perform a non-local jump to ed->target
     8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           4/r32/esp   .               .                 # copy *eax to esp
-$stop:end:
+$stop:end1:
+    # never gets here
+    c3/return  # doesn't return to caller
+$stop:real:
+    # . syscall(exit, value)
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/esp  4/index/none  .           3/r32/ebx   8/disp8         .                 # copy *(esp+8) to ebx
+    e8/call  syscall_exit/disp32
+$stop:end2:
+    # never gets here
     c3/return  # doesn't return to caller
 
 test-stop-skips-returns-on-exit:
diff --git a/apps/assort b/apps/assort
index 4531e654..37b188ee 100755
--- a/apps/assort
+++ b/apps/assort
Binary files differdiff --git a/apps/braces b/apps/braces
index 6fc70561..d3111278 100755
--- a/apps/braces
+++ b/apps/braces
Binary files differdiff --git a/apps/calls b/apps/calls
index a4f41796..500c9009 100755
--- a/apps/calls
+++ b/apps/calls
Binary files differdiff --git a/apps/crenshaw2-1 b/apps/crenshaw2-1
index 842de58d..41429db7 100755
--- a/apps/crenshaw2-1
+++ b/apps/crenshaw2-1
Binary files differdiff --git a/apps/crenshaw2-1.subx b/apps/crenshaw2-1.subx
index 60c1ed5b..9b1747cb 100644
--- a/apps/crenshaw2-1.subx
+++ b/apps/crenshaw2-1.subx
@@ -67,15 +67,9 @@ Entry:  # run tests if necessary, call 'compile' if not
     eb/jump  $main:end/disp8
 $run-main:
     # - otherwise read a program from stdin and emit its translation to stdout
-    # var ed/eax: exit-descriptor
-    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # subtract from esp
-    89/copy                         3/mod/direct    0/rm32/eax    .           .             .           4/r32/esp   .               .                 # copy esp to eax
-    # configure ed to really exit()
-    # . ed->target = 0
-    c7          0/subop/copy        0/mod/direct    0/rm32/eax    .           .             .           .           .               0/imm32           # copy to *eax
-    # compile(Stdin, 1/stdout, 2/stderr, ed)
+    # . compile(Stdin, 1/stdout, 2/stderr, ed)
     # . . push args
-    50/push-eax/ed
+    68/push  0/imm32/exit-descriptor
     68/push  2/imm32/stderr
     68/push  1/imm32/stdout
     68/push  Stdin/imm32
diff --git a/apps/crenshaw2-1b b/apps/crenshaw2-1b
index 545911df..81bbd4f7 100755
--- a/apps/crenshaw2-1b
+++ b/apps/crenshaw2-1b
Binary files differdiff --git a/apps/crenshaw2-1b.subx b/apps/crenshaw2-1b.subx
index 289f91e2..0d17a320 100644
--- a/apps/crenshaw2-1b.subx
+++ b/apps/crenshaw2-1b.subx
@@ -67,15 +67,9 @@ Entry:  # run tests if necessary, call 'compile' if not
     eb/jump  $main:end/disp8
 $run-main:
     # - otherwise read a program from stdin and emit its translation to stdout
-    # var ed/eax: exit-descriptor
-    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # subtract from esp
-    89/copy                         3/mod/direct    0/rm32/eax    .           .             .           4/r32/esp   .               .                 # copy esp to eax
-    # configure ed to really exit()
-    # . ed->target = 0
-    c7          0/subop/copy        0/mod/direct    0/rm32/eax    .           .             .           .           .               0/imm32           # copy to *eax
-    # compile(Stdin, 1/stdout, 2/stderr, ed)
+    # . compile(Stdin, 1/stdout, 2/stderr, 0)
     # . . push args
-    50/push-eax/ed
+    68/push  0/imm32/exit-descriptor
     68/push  2/imm32/stderr
     68/push  1/imm32/stdout
     68/push  Stdin/imm32
diff --git a/apps/dquotes b/apps/dquotes
index 5ae175b8..90bcf0b3 100755
--- a/apps/dquotes
+++ b/apps/dquotes
Binary files differdiff --git a/apps/factorial b/apps/factorial
index df1bb158..79c0e8da 100755
--- a/apps/factorial
+++ b/apps/factorial
Binary files differdiff --git a/apps/hex b/apps/hex
index fd3ae016..794ce191 100755
--- a/apps/hex
+++ b/apps/hex
Binary files differdiff --git a/apps/hex.subx b/apps/hex.subx
index 5dc8c023..4c95fdc5 100644
--- a/apps/hex.subx
+++ b/apps/hex.subx
@@ -54,15 +54,9 @@ Entry:  # run tests if necessary, convert stdin if not
     eb/jump  $subx-hex-main:end/disp8
 $subx-hex-main:interactive:
     # - otherwise convert stdin
-    # var ed/eax: exit-descriptor
-    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # subtract from esp
-    89/copy                         3/mod/direct    0/rm32/eax    .           .             .           4/r32/esp   .               .                 # copy esp to eax
-    # configure ed to really exit()
-    # . ed->target = 0
-    c7          0/subop/copy        0/mod/direct    0/rm32/eax    .           .             .           .           .               0/imm32           # copy to *eax
-    # subx-hex(Stdin, Stdout, Stderr, ed)
+    # . subx-hex(Stdin, Stdout, Stderr, 0)
     # . . push args
-    50/push-eax/ed
+    68/push  0/imm32/exit-descriptor
     68/push  Stderr/imm32
     68/push  Stdout/imm32
     68/push  Stdin/imm32
diff --git a/apps/mu b/apps/mu
index dd1e624a..65375c3c 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/pack b/apps/pack
index ad0f2173..ad15dd42 100755
--- a/apps/pack
+++ b/apps/pack
Binary files differdiff --git a/apps/sigils b/apps/sigils
index 201c69fe..b2ab77cf 100755
--- a/apps/sigils
+++ b/apps/sigils
Binary files differdiff --git a/apps/survey b/apps/survey
index 91a05441..0d94f444 100755
--- a/apps/survey
+++ b/apps/survey
Binary files differdiff --git a/apps/tests b/apps/tests
index aa317d7c..5f431146 100755
--- a/apps/tests
+++ b/apps/tests
Binary files differ