From e5cffe30ed38fbbdc74c63d0a94ab2a93713e43d Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 8 Jul 2019 00:42:50 -0700 Subject: . Move test slice variables out of the data segment and close to their usages. Makes tests a little easier to read even if we spend a few more instructions each time. --- subx/apps/assort | Bin 28723 -> 29165 bytes subx/apps/crenshaw2-1 | Bin 23337 -> 23725 bytes subx/apps/crenshaw2-1b | Bin 23896 -> 24284 bytes subx/apps/dquotes | Bin 35032 -> 35518 bytes subx/apps/dquotes.subx | 60 ++++++++--------- subx/apps/factorial | Bin 22253 -> 22641 bytes subx/apps/handle | Bin 23112 -> 23500 bytes subx/apps/hex | Bin 26346 -> 26734 bytes subx/apps/pack | Bin 43637 -> 44246 bytes subx/apps/pack.subx | 161 +++++++++++++++++++++++++++------------------ subx/apps/subx-common.subx | 57 +++++++++------- subx/apps/survey | Bin 34274 -> 34716 bytes 12 files changed, 159 insertions(+), 119 deletions(-) (limited to 'subx/apps') diff --git a/subx/apps/assort b/subx/apps/assort index 10573301..7407a4f0 100755 Binary files a/subx/apps/assort and b/subx/apps/assort differ diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index f25d054c..2dc6e6d4 100755 Binary files a/subx/apps/crenshaw2-1 and b/subx/apps/crenshaw2-1 differ diff --git a/subx/apps/crenshaw2-1b b/subx/apps/crenshaw2-1b index 720eef0d..efa0ece7 100755 Binary files a/subx/apps/crenshaw2-1b and b/subx/apps/crenshaw2-1b differ diff --git a/subx/apps/dquotes b/subx/apps/dquotes index 6015a4c6..30751dd4 100755 Binary files a/subx/apps/dquotes and b/subx/apps/dquotes differ diff --git a/subx/apps/dquotes.subx b/subx/apps/dquotes.subx index 64742599..d4a1ae86 100644 --- a/subx/apps/dquotes.subx +++ b/subx/apps/dquotes.subx @@ -1032,7 +1032,7 @@ test-emit-string-literal-data: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # var slice/ECX = '"abc"/d' - 68/push _test-slice-abc-metadata-end/imm32 + 68/push _test-slice-abc-end/imm32 68/push _test-slice-abc/imm32 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit-string-literal-data(_test-output-stream, slice) @@ -1096,8 +1096,8 @@ test-emit-string-literal-data-empty: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # var slice/ECX = '""' - 68/push _test-slice-empty-string-literal-end/imm32 - 68/push _test-slice-empty-string-literal/imm32 + 68/push 0/imm32/end + 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit-string-literal-data(_test-output-stream, slice) # . . push args @@ -1389,9 +1389,14 @@ test-emit-metadata: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # var slice/ECX = "abc/def" - 68/push _test-slice-word-end/imm32 - 68/push _test-slice-word/imm32/start + # (EAX..ECX) = "abc/def" + b8/copy-to-EAX "abc/def"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit-metadata(_test-output-buffered-file, slice) # . . push args @@ -1443,9 +1448,14 @@ test-emit-metadata-none: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # var slice/ECX = "abc" - 68/push _test-slice-word-datum-end/imm32 - 68/push _test-slice-word/imm32/start + # (EAX..ECX) = "abc" + b8/copy-to-EAX "abc"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit-metadata(_test-output-buffered-file, slice) # . . push args @@ -1497,9 +1507,14 @@ test-emit-metadata-multiple: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # var slice/ECX = "abc/def/ghi" - 68/push _test-slice-word-end2/imm32 - 68/push _test-slice-word/imm32/start + # (EAX..ECX) = "abc/def/ghi" + b8/copy-to-EAX "abc/def/ghi"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit-metadata(_test-output-buffered-file, slice) # . . push args @@ -1613,7 +1628,7 @@ test-emit-metadata-in-string-literal: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # var slice/ECX = "\"abc/def\"/ghi" - 68/push _test-slice-literal-string-with-metadata-end/imm32 + 68/push _test-slice-literal-string-with-end/imm32 68/push _test-slice-literal-string/imm32/start 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit-metadata(_test-output-buffered-file, slice) @@ -2645,13 +2660,8 @@ Slash: _test-slice-abc: 22/dquote 61/a 62/b 63/c 22/dquote # "abc" -_test-slice-abc-end: 2f/slash 64/d -_test-slice-abc-metadata-end: - -_test-slice-empty-string-literal: - 22/dquote 22/dquote # "" -_test-slice-empty-string-literal-end: +_test-slice-abc-end: _test-slice-a-space-b: 22/dquote 61/a 20/space 62/b 22/dquote # "a b" @@ -2661,23 +2671,13 @@ _test-slice-a-dquote-b: 22/dquote 61/a 5c/backslash 22/dquote 62/b 22/dquote # "a\"b" _test-slice-a-dquote-b-end: -# abc/def/ghi -_test-slice-word: - 61/a 62/b 63/c # abc -_test-slice-word-datum-end: - 2f/slash 64/d 65/e 66/f # /def -_test-slice-word-end: - 2f/slash 67/g 68/h 69/i # /ghi -_test-slice-word-end2: - # "abc/def"/ghi _test-slice-literal-string: 22/dquote 61/a 62/b 63/c # abc 2f/slash 64/d 65/e 66/f # /def 22/dquote -_test-slice-literal-string-end: 2f/slash 67/g 68/h 69/i # /ghi -_test-slice-literal-string-with-metadata-end: +_test-slice-literal-string-with-end: # . . vim:nowrap:textwidth=0 diff --git a/subx/apps/factorial b/subx/apps/factorial index dc637731..2433b2a6 100755 Binary files a/subx/apps/factorial and b/subx/apps/factorial differ diff --git a/subx/apps/handle b/subx/apps/handle index 16041394..d1cbb74b 100755 Binary files a/subx/apps/handle and b/subx/apps/handle differ diff --git a/subx/apps/hex b/subx/apps/hex index db95f583..5bfa5863 100755 Binary files a/subx/apps/hex and b/subx/apps/hex differ diff --git a/subx/apps/pack b/subx/apps/pack index 73e680b7..78018753 100755 Binary files a/subx/apps/pack and b/subx/apps/pack differ diff --git a/subx/apps/pack.subx b/subx/apps/pack.subx index 1e6c1fbc..7c12115a 100644 --- a/subx/apps/pack.subx +++ b/subx/apps/pack.subx @@ -5948,9 +5948,14 @@ test-emit-number: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # var slice/ECX = "30" - 68/push _test-slice-three-zero-end/imm32/end - 68/push _test-slice-three-zero/imm32/start + # (EAX..ECX) = "30" + b8/copy-to-EAX "30"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit(_test-output-buffered-file, slice, 1) # . . push args @@ -6004,9 +6009,14 @@ test-emit-negative-number: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # var slice/ECX = "-2" - 68/push _test-slice-negative-two-end/imm32/end - 68/push _test-slice-negative-two/imm32/start + # (EAX..ECX) = "-2" + b8/copy-to-EAX "-2"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit(_test-output-buffered-file, slice, 2) # . . push args @@ -6059,9 +6069,14 @@ test-emit-number-with-metadata: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # var slice/ECX = "-2/foo" - 68/push _test-slice-negative-two-metadata-end/imm32/end - 68/push _test-slice-negative-two/imm32/start + # (EAX..ECX) = "-2/foo" + b8/copy-to-EAX "-2/foo"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit(_test-output-buffered-file, slice, 2) # . . push args @@ -6115,9 +6130,14 @@ test-emit-non-number: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # var slice/ECX = "xyz" - 68/push _test-slice-non-number-word-end/imm32/end - 68/push _test-slice-non-number-word/imm32/start + # (EAX..ECX) = "xyz" + b8/copy-to-EAX "xyz"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit(_test-output-buffered-file, slice, 2) # . . push args @@ -6170,9 +6190,14 @@ test-emit-non-number-with-metadata: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # var slice/ECX = "xyz/" - 68/push _test-slice-non-number-word-metadata-end/imm32/end - 68/push _test-slice-non-number-word/imm32/start + # (EAX..ECX) = "xyz/" + b8/copy-to-EAX "xyz/"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit(_test-output-buffered-file, slice, 2) # . . push args @@ -6225,9 +6250,14 @@ test-emit-non-number-with-all-hex-digits-and-metadata: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # var slice/ECX = "abcd/xyz" - 68/push _test-slice-hexlike-non-number-word-metadata-end/imm32/end - 68/push _test-slice-hexlike-non-number-word/imm32/start + # (EAX..ECX) = "abcd/xyz" + b8/copy-to-EAX "abcd/xyz"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # emit(_test-output-buffered-file, slice, 2) # . . push args @@ -6351,9 +6381,14 @@ test-is-valid-name-digit-prefix: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # var slice/ECX = "34" - 68/push _test-slice-hex-int-end/imm32 - 68/push _test-slice-hex-int/imm32 + # (EAX..ECX) = "34" + b8/copy-to-EAX "34"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # EAX = is-valid-name?(slice) # . . push args @@ -6380,9 +6415,14 @@ test-is-valid-name-negative-prefix: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # var slice/ECX = "-0x34" - 68/push _test-slice-hex-int-with-0x-prefix-end/imm32 - 68/push _test-slice-hex-int-with-0x-prefix-negative/imm32 + # (EAX..ECX) = "-0x34" + b8/copy-to-EAX "-0x34"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # EAX = is-valid-name?(slice) # . . push args @@ -6409,9 +6449,14 @@ test-is-valid-name-0x-prefix: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # var slice/ECX = "0x34" - 68/push _test-slice-hex-int-with-0x-prefix-end/imm32 - 68/push _test-slice-hex-int-with-0x-prefix/imm32 + # (EAX..ECX) = "0x34" + b8/copy-to-EAX "0x34"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # EAX = is-valid-name?(slice) # . . push args @@ -6438,9 +6483,14 @@ test-is-valid-name-starts-with-pre-digit: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # var slice/ECX = "/03" - 68/push _test-slice-with-slash-prefix-end/imm32 - 68/push _test-slice-with-slash-prefix/imm32 + # (EAX..ECX) = "/03" + b8/copy-to-EAX "/03"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # EAX = is-valid-name?(slice) # . . push args @@ -6467,9 +6517,14 @@ test-is-valid-name-starts-with-post-digit: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # var slice/ECX = "q34" - 68/push _test-slice-char-and-digits-end/imm32 - 68/push _test-slice-char-and-digits/imm32 + # (EAX..ECX) = "q34" + b8/copy-to-EAX "q34"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # EAX = is-valid-name?(slice) # . . push args @@ -6496,9 +6551,14 @@ test-is-valid-name-starts-with-digit: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # var slice/ECX = "0x34" - 68/push _test-slice-hex-int-with-0x-prefix-end/imm32 - 68/push _test-slice-hex-int-with-0x-prefix/imm32 + # (EAX..ECX) = "0x34" + b8/copy-to-EAX "0x34"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # EAX = is-valid-name?(slice) # . . push args @@ -6806,33 +6866,4 @@ $parse-datum-of-word:end: 5d/pop-to-EBP c3/return -== data - -_test-slice-negative-two: - 2d/- 32/2 -_test-slice-negative-two-end: - 2f/slash 66/f 6f/o 6f/o -_test-slice-negative-two-metadata-end: - -_test-slice-three-zero: - 33/3 30/0 -_test-slice-three-zero-end: - -_test-slice-non-number-word: - 78/x 79/y 7a/z -_test-slice-non-number-word-end: - 2f/slash -_test-slice-non-number-word-metadata-end: - -_test-slice-hexlike-non-number-word: - 61/a 62/b 63/c 64/d -_test-slice-hexlike-non-number-word-end: - 2f/slash - 78/x 79/y 7a/z -_test-slice-hexlike-non-number-word-metadata-end: - -_test-slice-with-slash-prefix: - 2f/slash 30/0 33/3 -_test-slice-with-slash-prefix-end: - # . . vim:nowrap:textwidth=0 diff --git a/subx/apps/subx-common.subx b/subx/apps/subx-common.subx index d71cd373..d2eba587 100644 --- a/subx/apps/subx-common.subx +++ b/subx/apps/subx-common.subx @@ -373,9 +373,14 @@ test-get-or-insert-slice: 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX - # EDX : (address slice) = "code" - 68/push _test-code-segment-end/imm32/end - 68/push _test-code-segment/imm32/start + # (EAX..EDX) = "code" + b8/copy-to-EAX "code"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 2/r32/EDX . . # copy *EAX to EDX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 2/index/EDX . 2/r32/EDX 4/disp8 . # copy EAX+EDX+4 to EDX + 05/add-to-EAX 4/imm32 + # var slice/EDX = {EAX, EDX} + 52/push-EDX + 50/push-EAX 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . . # copy ESP to EDX $test-get-or-insert-slice:first-call: # - start with an empty table, insert one key, verify that it was inserted @@ -461,9 +466,15 @@ $test-get-or-insert-slice:second-call: 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP $test-get-or-insert-slice:third-call: # - insert a new key, verify that it was inserted - # EDX : (address slice) = "data" - c7 0/subop/copy 0/mod/indirect 2/rm32/EDX . . . . . _test-data-segment/imm32 # copy to *EDX - c7 0/subop/copy 1/mod/*+disp8 2/rm32/EDX . . . . 4/disp8 _test-data-segment-end/imm32 # copy to *(EDX+4) + # (EAX..EDX) = "data" + b8/copy-to-EAX "data"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 2/r32/EDX . . # copy *EAX to EDX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 2/index/EDX . 2/r32/EDX 4/disp8 . # copy EAX+EDX+4 to EDX + 05/add-to-EAX 4/imm32 + # var slice/EDX = {EAX, EDX} + 52/push-EDX + 50/push-EAX + 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . . # copy ESP to EDX # EAX = get-or-insert-slice(table, "data" slice, 8 bytes per row) # . . push args 68/push 8/imm32/row-size @@ -1373,9 +1384,14 @@ test-is-label?: 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP $test-is-label?:true: - # var slice/ECX = slice("AAA:") - 68/push _test-label-slice-end1/imm32 - 68/push _test-label-slice-start/imm32 + # (EAX..ECX) = "AAA:" + b8/copy-to-EAX "AAA:"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # is-label?(slice/ECX) 51/push-ECX @@ -1392,9 +1408,14 @@ $test-is-label?:true: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP $test-is-label?:false: - # var slice/ECX = slice("AAA") - 68/push _test-label-slice-end2/imm32 - 68/push _test-label-slice-start/imm32 + # (EAX..ECX) = "AAA" + b8/copy-to-EAX "AAA"/imm32 + 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX + 05/add-to-EAX 4/imm32 + # var slice/ECX = {EAX, ECX} + 51/push-ECX + 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # is-label?(slice/ECX) 51/push-ECX @@ -1493,20 +1514,8 @@ _test-output-buffered-file: # data 00 00 00 00 00 00 # 6 bytes -_test-code-segment: - 63/c 6f/o 64/d 65/e -_test-code-segment-end: - _test-data-segment: 64/d 61/a 74/t 61/a _test-data-segment-end: -_test-label-slice-start: - 41/A - 41/A - 41/A -_test-label-slice-end2: - 3A/: -_test-label-slice-end1: - # . . vim:nowrap:textwidth=0 diff --git a/subx/apps/survey b/subx/apps/survey index 9979e237..00124c44 100755 Binary files a/subx/apps/survey and b/subx/apps/survey differ -- cgit 1.4.1-2-gfad0