about summary refs log tree commit diff stats
path: root/subx/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-07-08 00:09:28 -0700
committerKartik Agaram <vc@akkartik.com>2019-07-08 00:09:28 -0700
commit761833aa9285edf5f919f4da3a94afbd4a7f657c (patch)
tree011929b107ed408c285d812e81b31f595c4d2374 /subx/apps
parent7ba3337baee629f4490a292b6f74286a52ecda4e (diff)
downloadmu-761833aa9285edf5f919f4da3a94afbd4a7f657c.tar.gz
.
DRY out compute-width and compute-width-from-slice.
Diffstat (limited to 'subx/apps')
-rw-r--r--subx/apps/subx-common.subx47
-rwxr-xr-xsubx/apps/surveybin34421 -> 34274 bytes
2 files changed, 5 insertions, 42 deletions
diff --git a/subx/apps/subx-common.subx b/subx/apps/subx-common.subx
index d4b8d0d4..0e155515 100644
--- a/subx/apps/subx-common.subx
+++ b/subx/apps/subx-common.subx
@@ -1153,50 +1153,13 @@ compute-width: # word : (address array byte) -> EAX : int
     51/push-ECX
     50/push-EAX
     89/copy                         3/mod/direct    1/rm32/ECX    .           .             .           4/r32/ESP   .               .                 # copy ESP to ECX
-    # if has-metadata?(word, "imm32") or has-metadata?(word, "disp32"): return 4
-    # . has-metadata?(word, "imm32")
-    68/push  "imm32"/imm32
-    51/push-ECX
-    e8/call  has-metadata?/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # . if EAX: return 4
-    3d/compare-EAX-and  1/imm32
-    b8/copy-to-EAX  4/imm32         # ZF is set, so we can overwrite EAX now
-    74/jump-if-equal  $compute-width:end/disp8
-    # . has-metadata?(word, "disp32")
-    68/push  "disp32"/imm32
-    51/push-ECX
-    e8/call  has-metadata?/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # . if EAX: return 4
-    3d/compare-EAX-and  1/imm32
-    b8/copy-to-EAX  4/imm32         # ZF is set, so we can overwrite EAX now
-    74/jump-if-equal  $compute-width:end/disp8
-    # if has-metadata?(word, "imm16") or has-metadata?(word, "disp16"): return 2
-    # . has-metadata?(word, "imm16")
-    68/push  "imm16"/imm32
-    51/push-ECX
-    e8/call  has-metadata?/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # . if EAX: return 2
-    3d/compare-EAX-and  1/imm32
-    b8/copy-to-EAX  2/imm32         # ZF is set, so we can overwrite EAX now
-    74/jump-if-equal  $compute-width:end/disp8
-    # . has-metadata?(word, "disp16")
-    68/push  "disp16"/imm32
+    # return compute-width-of-slice(ECX)
+    # . . push args
     51/push-ECX
-    e8/call  has-metadata?/disp32
+    # . . call
+    e8/call  compute-width-of-slice/disp32
     # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # . if EAX: return 2
-    3d/compare-EAX-and  1/imm32
-    b8/copy-to-EAX  2/imm32         # ZF is set, so we can overwrite EAX now
-    74/jump-if-equal  $compute-width:end/disp8
-    # else: return 1
-    b8/copy-to-EAX  1/imm32
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
 $compute-width:end:
     # . reclaim locals
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
diff --git a/subx/apps/survey b/subx/apps/survey
index 1794174b..1963710f 100755
--- a/subx/apps/survey
+++ b/subx/apps/survey
Binary files differ
ss='alt'>
5f3b3e7a ^





5f3b3e7a ^

































ddd2e989 ^
5f3b3e7a ^

ddd2e989 ^

5f3b3e7a ^
ddd2e989 ^
5f3b3e7a ^



7cb326df ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95