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:08:17 -0700
committerKartik Agaram <vc@akkartik.com>2019-07-08 00:08:17 -0700
commit7ba3337baee629f4490a292b6f74286a52ecda4e (patch)
treed2daca8eac2cc0a9abb9a05440bc402c9daf9d9e /subx/apps
parent6a9d56ff5dbbf6f77d5056e132724968f4129b80 (diff)
downloadmu-7ba3337baee629f4490a292b6f74286a52ecda4e.tar.gz
.
move a function around
Diffstat (limited to 'subx/apps')
-rw-r--r--subx/apps/subx-common.subx120
1 files changed, 60 insertions, 60 deletions
diff --git a/subx/apps/subx-common.subx b/subx/apps/subx-common.subx
index 4fc200a8..d4b8d0d4 100644
--- a/subx/apps/subx-common.subx
+++ b/subx/apps/subx-common.subx
@@ -1207,6 +1207,66 @@ $compute-width:end:
     5d/pop-to-EBP
     c3/return
 
+compute-width-of-slice: # s : (address slice) -> EAX : int
+    # . prolog
+    55/push-EBP
+    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    # . save registers
+    51/push-ECX
+    # ECX = s
+    8b/copy                         1/mod/*+disp8   5/rm32/EBP    .           .             .           1/r32/ECX   8/disp8         .                 # copy *(EBP+8) to ECX
+    # if has-metadata?(word, "imm32") or has-metadata?(word, "disp32"): return 4
+    # . EAX = 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-of-slice: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-of-slice: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-of-slice:end/disp8
+    # . has-metadata?(word, "disp16")
+    68/push  "disp16"/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-of-slice:end/disp8
+    # else: return 1
+    b8/copy-to-EAX  1/imm32
+$compute-width-of-slice:end:
+    # . restore registers
+    59/pop-to-ECX
+    # . epilog
+    89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
+    5d/pop-to-EBP
+    c3/return
+
 test-compute-width:
     # . prolog
     55/push-EBP
@@ -1307,66 +1367,6 @@ $test-compute-width:no-metadata:
     5d/pop-to-EBP
     c3/return
 
-compute-width-of-slice: # s : (address slice) -> EAX : int
-    # . prolog
-    55/push-EBP
-    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-    # . save registers
-    51/push-ECX
-    # ECX = s
-    8b/copy                         1/mod/*+disp8   5/rm32/EBP    .           .             .           1/r32/ECX   8/disp8         .                 # copy *(EBP+8) to ECX
-    # if has-metadata?(word, "imm32") or has-metadata?(word, "disp32"): return 4
-    # . EAX = 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-of-slice: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-of-slice: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-of-slice:end/disp8
-    # . has-metadata?(word, "disp16")
-    68/push  "disp16"/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-of-slice:end/disp8
-    # else: return 1
-    b8/copy-to-EAX  1/imm32
-$compute-width-of-slice:end:
-    # . restore registers
-    59/pop-to-ECX
-    # . epilog
-    89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
-    5d/pop-to-EBP
-    c3/return
-
 is-label?: # word : (address slice) -> EAX : boolean
     # . prolog
     55/push-EBP
ame the previous revision' href='/danisanti/profani-tty/blame/Makefile.am?id=3f6b40246a243c072770700d67c9818a7d293f6c'>^
92837ec1 ^
107fdd35 ^


447d2358 ^
21ab1821 ^
107fdd35 ^

0d15c710 ^

6a9e1930 ^
9aa282f6 ^

0d15c710 ^






2451b7b1 ^




















0d15c710 ^
d782b007 ^


0fbaa6f5 ^
d782b007 ^
fa89e2aa ^
0d15c710 ^
fa89e2aa ^

0d15c710 ^
264fc55a ^
0c1092fd ^

1809064d ^

0c1092fd ^
3ceb9b0d ^
fa89e2aa ^
7e4b1b1d ^
0fbaa6f5 ^

fa89e2aa ^

0fbaa6f5 ^

fa89e2aa ^
264fc55a ^

d782b007 ^
0fbaa6f5 ^
3ceb9b0d ^



0fbaa6f5 ^


d782b007 ^


0fbaa6f5 ^
7f7973f9 ^
2655d9e8 ^
0c1092fd ^

01394d6c ^
0fbaa6f5 ^

0c1092fd ^

13ee16de ^
0fbaa6f5 ^


















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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159