From 3350c34a74844e21ea69077e01efff3bae64bdcd Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 23 Mar 2021 17:31:08 -0700 Subject: . --- html/105string-equal.subx.html | 515 ++++++++++++++++++++--------------------- 1 file changed, 253 insertions(+), 262 deletions(-) (limited to 'html/105string-equal.subx.html') diff --git a/html/105string-equal.subx.html b/html/105string-equal.subx.html index a9152b9c..a6c5402d 100644 --- a/html/105string-equal.subx.html +++ b/html/105string-equal.subx.html @@ -14,17 +14,15 @@ pre { font-family: monospace; color: #000000; background-color: #c6c6c6; } body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; } a { color:inherit; } * { font-size:12pt; font-size: 1em; } +.subxH1Comment { color: #005faf; text-decoration: underline; } .subxComment { color: #005faf; } -.subxFunction { color: #af5f00; text-decoration: underline; } +.subxS1Comment { color: #0000af; } +.subxS2Comment { color: #8a8a8a; } .LineNr { } +.Constant { color: #008787; } .subxTest { color: #5f8700; } -.subxS1Comment { color: #0000af; } -.CommentedCode { color: #8a8a8a; } -.SpecialChar { color: #d70000; } +.subxFunction { color: #af5f00; text-decoration: underline; } .Normal { color: #000000; background-color: #c6c6c6; padding-bottom: 1px; } -.Constant { color: #008787; } -.subxS2Comment { color: #8a8a8a; } -.subxH1Comment { color: #005faf; text-decoration: underline; } --> @@ -67,262 +65,255 @@ if ('onhashchange' in window) { 5 # . op subop mod rm32 base index scale r32 6 # . 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 7 - 8 Entry: # run all tests - 9 #? e8/call test-compare-equal-strings/disp32 - 10 e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'. - 11 # syscall(exit, Num-test-failures) - 12 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx - 13 e8/call syscall_exit/disp32 - 14 - 15 string-equal?: # s: (addr array byte), benchmark: (addr array byte) -> result/eax: boolean - 16 # pseudocode: - 17 # if (s->size != benchmark->size) return false - 18 # return string-starts-with?(s, benchmark) - 19 # - 20 # . prologue - 21 55/push-ebp - 22 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - 23 # . save registers - 24 51/push-ecx - 25 56/push-esi - 26 57/push-edi - 27 # esi = s - 28 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi - 29 # edi = benchmark - 30 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 0xc/disp8 . # copy *(ebp+12) to edi - 31 # ecx = s->size - 32 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . . # copy *esi to ecx - 33 $string-equal?:sizes: - 34 # if (ecx != benchmark->size) return false - 35 39/compare 0/mod/indirect 7/rm32/edi . . . 1/r32/ecx . . # compare *edi and ecx - 36 b8/copy-to-eax 0/imm32/false - 37 75/jump-if-!= $string-equal?:end/disp8 - 38 $string-equal?:contents: - 39 # string-starts-with?(s, benchmark) - 40 # . . push args - 41 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) - 42 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 . # push *(ebp+8) - 43 # . . call - 44 e8/call string-starts-with?/disp32 - 45 # . . discard args - 46 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - 47 $string-equal?:end: - 48 # . restore registers - 49 5f/pop-to-edi - 50 5e/pop-to-esi - 51 59/pop-to-ecx - 52 # . epilogue - 53 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp - 54 5d/pop-to-ebp - 55 c3/return - 56 - 57 string-starts-with?: # s: (addr array byte), benchmark: (addr array byte) -> result/eax: boolean - 58 # pseudocode: - 59 # if (s->size < benchmark->size) return false - 60 # currs = s->data - 61 # currb = benchmark->data - 62 # maxb = &benchmark->data[benchmark->size] - 63 # while currb < maxb - 64 # c1 = *currs - 65 # c2 = *currb - 66 # if (c1 != c2) return false - 67 # ++currs, ++currb - 68 # return true + 8 string-equal?: # s: (addr array byte), benchmark: (addr array byte) -> result/eax: boolean + 9 # pseudocode: + 10 # if (s->size != benchmark->size) return false + 11 # return string-starts-with?(s, benchmark) + 12 # + 13 # . prologue + 14 55/push-ebp + 15 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + 16 # . save registers + 17 51/push-ecx + 18 56/push-esi + 19 57/push-edi + 20 # esi = s + 21 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi + 22 # edi = benchmark + 23 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 0xc/disp8 . # copy *(ebp+12) to edi + 24 # ecx = s->size + 25 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . . # copy *esi to ecx + 26 $string-equal?:sizes: + 27 # if (ecx != benchmark->size) return false + 28 39/compare 0/mod/indirect 7/rm32/edi . . . 1/r32/ecx . . # compare *edi and ecx + 29 b8/copy-to-eax 0/imm32/false + 30 75/jump-if-!= $string-equal?:end/disp8 + 31 $string-equal?:contents: + 32 # string-starts-with?(s, benchmark) + 33 # . . push args + 34 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) + 35 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 . # push *(ebp+8) + 36 # . . call + 37 e8/call string-starts-with?/disp32 + 38 # . . discard args + 39 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp + 40 $string-equal?:end: + 41 # . restore registers + 42 5f/pop-to-edi + 43 5e/pop-to-esi + 44 59/pop-to-ecx + 45 # . epilogue + 46 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp + 47 5d/pop-to-ebp + 48 c3/return + 49 + 50 string-starts-with?: # s: (addr array byte), benchmark: (addr array byte) -> result/eax: boolean + 51 # pseudocode: + 52 # if (s->size < benchmark->size) return false + 53 # currs = s->data + 54 # currb = benchmark->data + 55 # maxb = &benchmark->data[benchmark->size] + 56 # while currb < maxb + 57 # c1 = *currs + 58 # c2 = *currb + 59 # if (c1 != c2) return false + 60 # ++currs, ++currb + 61 # return true + 62 # + 63 # registers: + 64 # currs: esi + 65 # maxs: ecx + 66 # currb: edi + 67 # c1: eax + 68 # c2: ebx 69 # - 70 # registers: - 71 # currs: esi - 72 # maxs: ecx - 73 # currb: edi - 74 # c1: eax - 75 # c2: ebx - 76 # - 77 # . prologue - 78 55/push-ebp - 79 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - 80 # . save registers - 81 51/push-ecx - 82 52/push-edx - 83 56/push-esi - 84 57/push-edi - 85 # esi = s - 86 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi - 87 # edi = benchmark - 88 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 0xc/disp8 . # copy *(ebp+12) to edi - 89 # var bsize/ecx: int = benchmark->size - 90 8b/copy 0/mod/indirect 7/rm32/edi . . . 1/r32/ecx . . # copy *edi to ecx - 91 $string-starts-with?:sizes: - 92 # if (s->size < bsize) return false - 93 39/compare 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . . # compare *esi with ecx - 94 7c/jump-if-< $string-starts-with?:false/disp8 - 95 # var currs/esi: (addr byte) = s->data - 96 81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 4/imm32 # add to esi - 97 # var currb/edi: (addr byte) = benchmark->data - 98 81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 4/imm32 # add to edi - 99 # var maxb/ecx: (addr byte) = &benchmark->data[benchmark->size] -100 01/add 3/mod/direct 1/rm32/ecx . . . 7/r32/edi . . # add edi to ecx -101 # var c1/eax: byte = 0 -102 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax -103 # var c2/edx: byte = 0 -104 31/xor 3/mod/direct 2/rm32/edx . . . 2/r32/edx . . # clear edx -105 $string-starts-with?:loop: -106 # if (currs >= maxs) return true -107 39/compare 3/mod/direct 7/rm32/edi . . . 1/r32/ecx . . # compare edi with ecx -108 73/jump-if-addr>= $string-starts-with?:true/disp8 -109 # c1 = *currs -110 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . . # copy byte at *esi to AL -111 # c2 = *currb -112 8a/copy-byte 0/mod/indirect 7/rm32/edi . . . 2/r32/DL . . # copy byte at *edi to DL -113 # if (c1 != c2) return false -114 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . . # compare eax and edx -115 75/jump-if-!= $string-starts-with?:false/disp8 -116 # ++currs -117 46/increment-esi -118 # ++currb -119 47/increment-edi -120 eb/jump $string-starts-with?:loop/disp8 -121 $string-starts-with?:true: -122 b8/copy-to-eax 1/imm32 -123 eb/jump $string-starts-with?:end/disp8 -124 $string-starts-with?:false: -125 b8/copy-to-eax 0/imm32 -126 $string-starts-with?:end: -127 # . restore registers -128 5f/pop-to-edi -129 5e/pop-to-esi -130 5a/pop-to-edx -131 59/pop-to-ecx -132 # . epilogue -133 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp -134 5d/pop-to-ebp -135 c3/return -136 -137 # - tests -138 -139 test-compare-empty-with-empty-string: -140 # eax = string-equal?("", "") -141 # . . push args -142 68/push ""/imm32 -143 68/push ""/imm32 -144 # . . call -145 e8/call string-equal?/disp32 -146 # . . discard args -147 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -148 # check-ints-equal(eax, 1, msg) -149 # . . push args -150 68/push "F - test-compare-empty-with-empty-string"/imm32 -151 68/push 1/imm32/true -152 50/push-eax -153 # . . call -154 e8/call check-ints-equal/disp32 -155 # . . discard args -156 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp -157 c3/return -158 -159 test-compare-empty-with-non-empty-string: # also checks size-mismatch code path -160 # eax = string-equal?("", "Abc") -161 # . . push args -162 68/push "Abc"/imm32 -163 68/push ""/imm32 -164 # . . call -165 e8/call string-equal?/disp32 -166 # . . discard args -167 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -168 # check-ints-equal(eax, 0, msg) -169 # . . push args -170 68/push "F - test-compare-empty-with-non-empty-string"/imm32 -171 68/push 0/imm32/false -172 50/push-eax -173 # . . call -174 e8/call check-ints-equal/disp32 -175 # . . discard args -176 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp -177 c3/return -178 -179 test-compare-equal-strings: -180 # eax = string-equal?("Abc", "Abc") -181 # . . push args -182 68/push "Abc"/imm32 -183 68/push "Abc"/imm32 -184 # . . call -185 e8/call string-equal?/disp32 -186 # . . discard args -187 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -188 # check-ints-equal(eax, 1, msg) -189 # . . push args -190 68/push "F - test-compare-equal-strings"/imm32 -191 68/push 1/imm32/true -192 50/push-eax -193 # . . call -194 e8/call check-ints-equal/disp32 -195 # . . discard args -196 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp -197 c3/return -198 -199 test-compare-inequal-strings-equal-sizes: -200 # eax = string-equal?("Abc", "Adc") -201 # . . push args -202 68/push "Adc"/imm32 -203 68/push "Abc"/imm32 -204 # . . call -205 e8/call string-equal?/disp32 -206 # . . discard args -207 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -208 # check-ints-equal(eax, 0, msg) -209 # . . push args -210 68/push "F - test-compare-inequal-strings-equal-sizes"/imm32 -211 68/push 0/imm32/false -212 50/push-eax -213 # . . call -214 e8/call check-ints-equal/disp32 -215 # . . discard args -216 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp -217 c3/return -218 -219 # helper for later tests -220 check-strings-equal: # s: (addr array byte), expected: (addr array byte), msg: (addr array byte) -221 # . prologue -222 55/push-ebp -223 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp -224 # . save registers -225 50/push-eax -226 # var eax: boolean = string-equal?(s, expected) -227 # . . push args -228 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) -229 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 . # push *(ebp+8) -230 # . . call -231 e8/call string-equal?/disp32 -232 # . . discard args -233 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -234 # check-ints-equal(eax, 1, msg) -235 # . . push args -236 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 . # push *(ebp+16) -237 68/push 1/imm32 -238 50/push-eax -239 # . . call -240 e8/call check-ints-equal/disp32 -241 # . . discard args -242 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp -243 $check-strings-equal:end: -244 # . restore registers -245 58/pop-to-eax -246 # . epilogue -247 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp -248 5d/pop-to-ebp -249 c3/return -250 -251 # test the helper -252 test-check-strings-equal: -253 # check-strings-equal?("Abc", "Abc") -254 # . . push args -255 68/push "Abc"/imm32 -256 68/push "Abc"/imm32 -257 # . . call -258 e8/call check-strings-equal/disp32 -259 # . . discard args -260 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -261 c3/return -262 -263 # . . vim:nowrap:textwidth=0 + 70 # . prologue + 71 55/push-ebp + 72 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + 73 # . save registers + 74 51/push-ecx + 75 52/push-edx + 76 56/push-esi + 77 57/push-edi + 78 # esi = s + 79 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi + 80 # edi = benchmark + 81 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 0xc/disp8 . # copy *(ebp+12) to edi + 82 # var bsize/ecx: int = benchmark->size + 83 8b/copy 0/mod/indirect 7/rm32/edi . . . 1/r32/ecx . . # copy *edi to ecx + 84 $string-starts-with?:sizes: + 85 # if (s->size < bsize) return false + 86 39/compare 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . . # compare *esi with ecx + 87 7c/jump-if-< $string-starts-with?:false/disp8 + 88 # var currs/esi: (addr byte) = s->data + 89 81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 4/imm32 # add to esi + 90 # var currb/edi: (addr byte) = benchmark->data + 91 81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 4/imm32 # add to edi + 92 # var maxb/ecx: (addr byte) = &benchmark->data[benchmark->size] + 93 01/add 3/mod/direct 1/rm32/ecx . . . 7/r32/edi . . # add edi to ecx + 94 # var c1/eax: byte = 0 + 95 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax + 96 # var c2/edx: byte = 0 + 97 31/xor 3/mod/direct 2/rm32/edx . . . 2/r32/edx . . # clear edx + 98 $string-starts-with?:loop: + 99 # if (currs >= maxs) return true +100 39/compare 3/mod/direct 7/rm32/edi . . . 1/r32/ecx . . # compare edi with ecx +101 73/jump-if-addr>= $string-starts-with?:true/disp8 +102 # c1 = *currs +103 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . . # copy byte at *esi to AL +104 # c2 = *currb +105 8a/copy-byte 0/mod/indirect 7/rm32/edi . . . 2/r32/DL . . # copy byte at *edi to DL +106 # if (c1 != c2) return false +107 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . . # compare eax and edx +108 75/jump-if-!= $string-starts-with?:false/disp8 +109 # ++currs +110 46/increment-esi +111 # ++currb +112 47/increment-edi +113 eb/jump $string-starts-with?:loop/disp8 +114 $string-starts-with?:true: +115 b8/copy-to-eax 1/imm32 +116 eb/jump $string-starts-with?:end/disp8 +117 $string-starts-with?:false: +118 b8/copy-to-eax 0/imm32 +119 $string-starts-with?:end: +120 # . restore registers +121 5f/pop-to-edi +122 5e/pop-to-esi +123 5a/pop-to-edx +124 59/pop-to-ecx +125 # . epilogue +126 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp +127 5d/pop-to-ebp +128 c3/return +129 +130 # - tests +131 +132 test-compare-empty-with-empty-string: +133 # eax = string-equal?("", "") +134 # . . push args +135 68/push ""/imm32 +136 68/push ""/imm32 +137 # . . call +138 e8/call string-equal?/disp32 +139 # . . discard args +140 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +141 # check-ints-equal(eax, 1, msg) +142 # . . push args +143 68/push "F - test-compare-empty-with-empty-string"/imm32 +144 68/push 1/imm32/true +145 50/push-eax +146 # . . call +147 e8/call check-ints-equal/disp32 +148 # . . discard args +149 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp +150 c3/return +151 +152 test-compare-empty-with-non-empty-string: # also checks size-mismatch code path +153 # eax = string-equal?("", "Abc") +154 # . . push args +155 68/push "Abc"/imm32 +156 68/push ""/imm32 +157 # . . call +158 e8/call string-equal?/disp32 +159 # . . discard args +160 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +161 # check-ints-equal(eax, 0, msg) +162 # . . push args +163 68/push "F - test-compare-empty-with-non-empty-string"/imm32 +164 68/push 0/imm32/false +165 50/push-eax +166 # . . call +167 e8/call check-ints-equal/disp32 +168 # . . discard args +169 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp +170 c3/return +171 +172 test-compare-equal-strings: +173 # eax = string-equal?("Abc", "Abc") +174 # . . push args +175 68/push "Abc"/imm32 +176 68/push "Abc"/imm32 +177 # . . call +178 e8/call string-equal?/disp32 +179 # . . discard args +180 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +181 # check-ints-equal(eax, 1, msg) +182 # . . push args +183 68/push "F - test-compare-equal-strings"/imm32 +184 68/push 1/imm32/true +185 50/push-eax +186 # . . call +187 e8/call check-ints-equal/disp32 +188 # . . discard args +189 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp +190 c3/return +191 +192 test-compare-inequal-strings-equal-sizes: +193 # eax = string-equal?("Abc", "Adc") +194 # . . push args +195 68/push "Adc"/imm32 +196 68/push "Abc"/imm32 +197 # . . call +198 e8/call string-equal?/disp32 +199 # . . discard args +200 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +201 # check-ints-equal(eax, 0, msg) +202 # . . push args +203 68/push "F - test-compare-inequal-strings-equal-sizes"/imm32 +204 68/push 0/imm32/false +205 50/push-eax +206 # . . call +207 e8/call check-ints-equal/disp32 +208 # . . discard args +209 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp +210 c3/return +211 +212 # helper for later tests +213 check-strings-equal: # s: (addr array byte), expected: (addr array byte), msg: (addr array byte) +214 # . prologue +215 55/push-ebp +216 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp +217 # . save registers +218 50/push-eax +219 # var eax: boolean = string-equal?(s, expected) +220 # . . push args +221 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) +222 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 . # push *(ebp+8) +223 # . . call +224 e8/call string-equal?/disp32 +225 # . . discard args +226 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +227 # check-ints-equal(eax, 1, msg) +228 # . . push args +229 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 . # push *(ebp+16) +230 68/push 1/imm32 +231 50/push-eax +232 # . . call +233 e8/call check-ints-equal/disp32 +234 # . . discard args +235 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp +236 $check-strings-equal:end: +237 # . restore registers +238 58/pop-to-eax +239 # . epilogue +240 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp +241 5d/pop-to-ebp +242 c3/return +243 +244 # test the helper +245 test-check-strings-equal: +246 # check-strings-equal("Abc", "Abc") +247 # . . push args +248 68/push "Abc"/imm32 +249 68/push "Abc"/imm32 +250 # . . call +251 e8/call check-strings-equal/disp32 +252 # . . discard args +253 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +254 c3/return +255 +256 # . . vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0