about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-05-16 00:34:17 -0700
committerKartik Agaram <vc@akkartik.com>2019-05-16 00:34:17 -0700
commit209ffb7fdbf7cc5e9739561a2e8ef1ffecf73966 (patch)
tree8d39ef602c545ce0b1507fa68eea280a6e422ea1 /subx
parent47fba77662ef5539181aed8fba1862398ea94956 (diff)
downloadmu-209ffb7fdbf7cc5e9739561a2e8ef1ffecf73966.tar.gz
5180
Clean up some old TODOs related to our pre-mmap limitations.

Also caught another case of using the wrong comparison. When comparing
addresses, one must always use unsigned rather than signed jump instructions.
Diffstat (limited to 'subx')
-rw-r--r--subx/069allocate.subx2
-rwxr-xr-xsubx/apps/assortbin22516 -> 22516 bytes
-rw-r--r--subx/apps/assort.subx33
-rwxr-xr-xsubx/apps/crenshaw2-1bin19675 -> 19675 bytes
-rwxr-xr-xsubx/apps/crenshaw2-1bbin20234 -> 20234 bytes
-rwxr-xr-xsubx/apps/dquotesbin25014 -> 25014 bytes
-rw-r--r--subx/apps/dquotes.subx34
-rwxr-xr-xsubx/apps/factorialbin18591 -> 18591 bytes
-rwxr-xr-xsubx/apps/handlebin19418 -> 19418 bytes
-rwxr-xr-xsubx/apps/hexbin22684 -> 22684 bytes
-rwxr-xr-xsubx/apps/packbin37276 -> 37276 bytes
11 files changed, 25 insertions, 44 deletions
diff --git a/subx/069allocate.subx b/subx/069allocate.subx
index 14e9fd50..ac491ac3 100644
--- a/subx/069allocate.subx
+++ b/subx/069allocate.subx
@@ -39,7 +39,7 @@ allocate:  # ad : (address allocation-descriptor), n : int -> address-or-null/EA
     89/copy                         3/mod/direct    2/rm32/EDX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EDX
     03/add                          1/mod/*+disp8   5/rm32/EBP    .           .             .           2/r32/EDX   0xc/disp8       .                 # add *(EBP+12) to EDX
     3b/compare                      1/mod/*+disp8   1/rm32/ECX    .           .             .           2/r32/EDX   4/disp8         .                 # compare EDX with *(ECX+4)
-    7c/jump-if-lesser  $allocate:commit/disp8
+    72/jump-if-lesser-signed  $allocate:commit/disp8
     # return null if not
     b8/copy-to-EAX  0/imm32
     eb/jump  $allocate:end/disp8
diff --git a/subx/apps/assort b/subx/apps/assort
index 227bf4e7..3f05c232 100755
--- a/subx/apps/assort
+++ b/subx/apps/assort
Binary files differdiff --git a/subx/apps/assort.subx b/subx/apps/assort.subx
index 7498cc3a..49772b72 100644
--- a/subx/apps/assort.subx
+++ b/subx/apps/assort.subx
@@ -23,33 +23,26 @@
 # . op          subop               mod             rm32          base        index         scale       r32
 # . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
-Entry:  # run tests if necessary, convert stdin if not
+Entry:
+    # initialize heap
+    # . Heap = new-segment(64KB)
+    # . . push args
+    68/push  Heap/imm32
+    68/push  0x10000/imm32/64KB
+    # . . call
+    e8/call  new-segment/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
 
     # for debugging: run a single test
-#?     # . Heap = new-segment(4096)
-#?     # . . push args
-#?     68/push  Heap/imm32
-#?     68/push  0x1000/imm32
-#?     # . . call
-#?     e8/call  new-segment/disp32
-#?     # . . discard args
-#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-#?     # . test()
 #?     e8/call test-convert/disp32
 #?     8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           3/r32/EBX   Num-test-failures/disp32          # copy *Num-test-failures to EBX
 #?     eb/jump  $main:end/disp8
 
+    # run tests if necessary, convert stdin if not
     # . prolog
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
     # initialize heap
-    # . Heap = new-segment(4096)
-    # . . push args
-    68/push  Heap/imm32
-    68/push  0x1000/imm32
-    # . . call
-    e8/call  new-segment/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
     # - if argc > 1 and argv[1] == "test", then return run_tests()
     # . argc > 1
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0/disp8         1/imm32           # compare *EBP
@@ -1330,9 +1323,7 @@ _test-data-segment:
 _test-data-segment-end:
 
 Segment-size:
-  # TODO: there's currently a tight size limit on segments because we aren't growing the heap
-  0x100/imm32
-#?   0x1000/imm32/4KB
+  0x1000/imm32/4KB
 
 Heap:
   # curr
diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1
index 8414e3ce..1616c9dc 100755
--- a/subx/apps/crenshaw2-1
+++ b/subx/apps/crenshaw2-1
Binary files differdiff --git a/subx/apps/crenshaw2-1b b/subx/apps/crenshaw2-1b
index 5dddec43..8580d169 100755
--- a/subx/apps/crenshaw2-1b
+++ b/subx/apps/crenshaw2-1b
Binary files differdiff --git a/subx/apps/dquotes b/subx/apps/dquotes
index 02102f04..d9970727 100755
--- a/subx/apps/dquotes
+++ b/subx/apps/dquotes
Binary files differdiff --git a/subx/apps/dquotes.subx b/subx/apps/dquotes.subx
index 4810bcad..db1073cf 100644
--- a/subx/apps/dquotes.subx
+++ b/subx/apps/dquotes.subx
@@ -19,33 +19,25 @@
 # . op          subop               mod             rm32          base        index         scale       r32
 # . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
-Entry:  # run tests if necessary, convert stdin if not
+Entry:
+    # initialize heap
+    # . Heap = new-segment(64KB)
+    # . . push args
+    68/push  Heap/imm32
+    68/push  0x10000/imm32/64KB
+    # . . call
+    e8/call  new-segment/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
 
     # for debugging: run a single test
-#?     # . Heap = new-segment(4096)
-#?     # . . push args
-#?     68/push  Heap/imm32
-#?     68/push  0x1000/imm32
-#?     # . . call
-#?     e8/call  new-segment/disp32
-#?     # . . discard args
-#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-#?     # . test()
 #?     e8/call  test-convert-processes-string-literals/disp32
 #?     8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           3/r32/EBX   Num-test-failures/disp32          # copy *Num-test-failures to EBX
 #?     eb/jump  $main:end/disp8
 
+    # run tests if necessary, convert stdin if not
     # . prolog
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-    # initialize heap
-    # . Heap = new-segment(4096)
-    # . . push args
-    68/push  Heap/imm32
-    68/push  0x1000/imm32
-    # . . call
-    e8/call  new-segment/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
     # - if argc > 1 and argv[1] == "test", then return run_tests()
     # . argc > 1
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0/disp8         1/imm32           # compare *EBP
@@ -1980,9 +1972,7 @@ test-next-word-returns-string-with-escapes:
 == data
 
 Segment-size:
-  # TODO: there's currently a tight size limit on segments because we aren't growing the heap
-  0x100/imm32
-#?   0x1000/imm32/4KB
+  0x1000/imm32/4KB
 
 Next-string-literal:  # tracks the next auto-generated variable name
   1/imm32
diff --git a/subx/apps/factorial b/subx/apps/factorial
index ab71d3b2..38264cfd 100755
--- a/subx/apps/factorial
+++ b/subx/apps/factorial
Binary files differdiff --git a/subx/apps/handle b/subx/apps/handle
index 4d4bea1f..70bdf521 100755
--- a/subx/apps/handle
+++ b/subx/apps/handle
Binary files differdiff --git a/subx/apps/hex b/subx/apps/hex
index f69e7bb3..faec8493 100755
--- a/subx/apps/hex
+++ b/subx/apps/hex
Binary files differdiff --git a/subx/apps/pack b/subx/apps/pack
index 1c76d927..1f530400 100755
--- a/subx/apps/pack
+++ b/subx/apps/pack
Binary files differ