diff options
Diffstat (limited to 'html/054string-equal.subx.html')
-rw-r--r-- | html/054string-equal.subx.html | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/html/054string-equal.subx.html b/html/054string-equal.subx.html index 87480b2a..4fe3c4cc 100644 --- a/html/054string-equal.subx.html +++ b/html/054string-equal.subx.html @@ -15,15 +15,15 @@ body { font-size:12pt; font-family: monospace; color: #000000; background-color: a { color:inherit; } * { font-size:12pt; font-size: 1em; } .subxComment { color: #005faf; } -.subxFunction { color: #af5f00; text-decoration: underline; } +.subxS2Comment { color: #8a8a8a; } .subxTest { color: #5f8700; } +.subxFunction { color: #af5f00; text-decoration: underline; } .LineNr { } .subxS1Comment { color: #0000af; } .CommentedCode { color: #8a8a8a; } .SpecialChar { color: #d70000; } .Normal { color: #000000; background-color: #c6c6c6; padding-bottom: 1px; } .Constant { color: #008787; } -.subxS2Comment { color: #8a8a8a; } .subxH1Comment { color: #005faf; text-decoration: underline; } --> </style> @@ -60,7 +60,7 @@ if ('onhashchange' in window) { <body onload='JumpToLine();'> <a href='https://github.com/akkartik/mu/blob/master/054string-equal.subx'>https://github.com/akkartik/mu/blob/master/054string-equal.subx</a> <pre id='vimCodeElement'> -<span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Comparing 'regular' length-prefixed strings.</span> +<span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Comparing 'regular' size-prefixed strings.</span> <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span>== code <span id="L4" class="LineNr"> 4 </span><span class="subxComment"># instruction effective address register displacement immediate</span> @@ -77,7 +77,7 @@ if ('onhashchange' in window) { <span id="L15" class="LineNr"> 15 </span> <span id="L16" class="LineNr"> 16 </span><span class="subxFunction">string-equal?</span>: <span class="subxComment"># s: (addr array byte), benchmark: (addr array byte) -> eax: boolean</span> <span id="L17" class="LineNr"> 17 </span> <span class="subxComment"># pseudocode:</span> -<span id="L18" class="LineNr"> 18 </span> <span class="subxComment"># if (s->length != benchmark->length) return false</span> +<span id="L18" class="LineNr"> 18 </span> <span class="subxComment"># if (s->size != benchmark->size) return false</span> <span id="L19" class="LineNr"> 19 </span> <span class="subxComment"># return string-starts-with?(s, benchmark)</span> <span id="L20" class="LineNr"> 20 </span> <span class="subxComment">#</span> <span id="L21" class="LineNr"> 21 </span> <span class="subxS1Comment"># . prologue</span> @@ -91,10 +91,10 @@ if ('onhashchange' in window) { <span id="L29" class="LineNr"> 29 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span> <span id="L30" class="LineNr"> 30 </span> <span class="subxComment"># edi = benchmark</span> <span id="L31" class="LineNr"> 31 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to edi</span> -<span id="L32" class="LineNr"> 32 </span> <span class="subxComment"># ecx = s->length</span> +<span id="L32" class="LineNr"> 32 </span> <span class="subxComment"># ecx = s->size</span> <span id="L33" class="LineNr"> 33 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to ecx</span> -<span id="L34" class="LineNr"> 34 </span><span class="Constant">$string-equal?:lengths</span>: -<span id="L35" class="LineNr"> 35 </span> <span class="subxComment"># if (ecx != benchmark->length) return false</span> +<span id="L34" class="LineNr"> 34 </span><span class="Constant">$string-equal?:sizes</span>: +<span id="L35" class="LineNr"> 35 </span> <span class="subxComment"># if (ecx != benchmark->size) return false</span> <span id="L36" class="LineNr"> 36 </span> 39/compare 0/mod/indirect 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare *edi and ecx</span> <span id="L37" class="LineNr"> 37 </span> b8/copy-to-eax 0/imm32/false <span id="L38" class="LineNr"> 38 </span> 75/jump-if-!= $string-equal?:end/disp8 @@ -119,10 +119,10 @@ if ('onhashchange' in window) { <span id="L57" class="LineNr"> 57 </span> <span id="L58" class="LineNr"> 58 </span><span class="subxFunction">string-starts-with?</span>: <span class="subxComment"># s: (addr array byte), benchmark: (addr array byte) -> eax: boolean</span> <span id="L59" class="LineNr"> 59 </span> <span class="subxComment"># pseudocode:</span> -<span id="L60" class="LineNr"> 60 </span> <span class="subxComment"># if (s->length < benchmark->length) return false</span> +<span id="L60" class="LineNr"> 60 </span> <span class="subxComment"># if (s->size < benchmark->size) return false</span> <span id="L61" class="LineNr"> 61 </span> <span class="subxComment"># currs = s->data</span> <span id="L62" class="LineNr"> 62 </span> <span class="subxComment"># currb = benchmark->data</span> -<span id="L63" class="LineNr"> 63 </span> <span class="subxComment"># maxb = &benchmark->data[benchmark->length]</span> +<span id="L63" class="LineNr"> 63 </span> <span class="subxComment"># maxb = &benchmark->data[benchmark->size]</span> <span id="L64" class="LineNr"> 64 </span> <span class="subxComment"># while currb < maxb</span> <span id="L65" class="LineNr"> 65 </span> <span class="subxComment"># c1 = *currs</span> <span id="L66" class="LineNr"> 66 </span> <span class="subxComment"># c2 = *currb</span> @@ -149,17 +149,17 @@ if ('onhashchange' in window) { <span id="L87" class="LineNr"> 87 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span> <span id="L88" class="LineNr"> 88 </span> <span class="subxComment"># edi = benchmark</span> <span id="L89" class="LineNr"> 89 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to edi</span> -<span id="L90" class="LineNr"> 90 </span> <span class="subxComment"># var blen/ecx: int = benchmark->length</span> +<span id="L90" class="LineNr"> 90 </span> <span class="subxComment"># var bsize/ecx: int = benchmark->size</span> <span id="L91" class="LineNr"> 91 </span> 8b/copy 0/mod/indirect 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *edi to ecx</span> -<span id="L92" class="LineNr"> 92 </span><span class="Constant">$string-starts-with?:lengths</span>: -<span id="L93" class="LineNr"> 93 </span> <span class="subxComment"># if (s->length < blen) return false</span> +<span id="L92" class="LineNr"> 92 </span><span class="Constant">$string-starts-with?:sizes</span>: +<span id="L93" class="LineNr"> 93 </span> <span class="subxComment"># if (s->size < bsize) return false</span> <span id="L94" class="LineNr"> 94 </span> 39/compare 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare *esi with ecx</span> <span id="L95" class="LineNr"> 95 </span> 7c/jump-if-< $string-starts-with?:false/disp8 <span id="L96" class="LineNr"> 96 </span> <span class="subxComment"># var currs/esi: (addr byte) = s->data</span> <span id="L97" class="LineNr"> 97 </span> 81 0/subop/add 3/mod/direct 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to esi</span> <span id="L98" class="LineNr"> 98 </span> <span class="subxComment"># var currb/edi: (addr byte) = benchmark->data</span> <span id="L99" class="LineNr"> 99 </span> 81 0/subop/add 3/mod/direct 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to edi</span> -<span id="L100" class="LineNr">100 </span> <span class="subxComment"># var maxb/ecx: (addr byte) = &benchmark->data[benchmark->length]</span> +<span id="L100" class="LineNr">100 </span> <span class="subxComment"># var maxb/ecx: (addr byte) = &benchmark->data[benchmark->size]</span> <span id="L101" class="LineNr">101 </span> 01/add 3/mod/direct 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># add edi to ecx</span> <span id="L102" class="LineNr">102 </span> <span class="subxComment"># var c1/eax: byte = 0</span> <span id="L103" class="LineNr">103 </span> 31/xor 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear eax</span> @@ -219,7 +219,7 @@ if ('onhashchange' in window) { <span id="L157" class="LineNr">157 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0xc/imm32 <span class="subxComment"># add to esp</span> <span id="L158" class="LineNr">158 </span> c3/return <span id="L159" class="LineNr">159 </span> -<span id="L160" class="LineNr">160 </span><span class="subxTest">test-compare-empty-with-non-empty-string</span>: <span class="subxComment"># also checks length-mismatch code path</span> +<span id="L160" class="LineNr">160 </span><span class="subxTest">test-compare-empty-with-non-empty-string</span>: <span class="subxComment"># also checks size-mismatch code path</span> <span id="L161" class="LineNr">161 </span> <span class="subxComment"># eax = string-equal?("", "Abc")</span> <span id="L162" class="LineNr">162 </span> <span class="subxS2Comment"># . . push args</span> <span id="L163" class="LineNr">163 </span> 68/push <span class="Constant">"Abc"</span>/imm32 @@ -259,7 +259,7 @@ if ('onhashchange' in window) { <span id="L197" class="LineNr">197 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0xc/imm32 <span class="subxComment"># add to esp</span> <span id="L198" class="LineNr">198 </span> c3/return <span id="L199" class="LineNr">199 </span> -<span id="L200" class="LineNr">200 </span><span class="subxTest">test-compare-inequal-strings-equal-lengths</span>: +<span id="L200" class="LineNr">200 </span><span class="subxTest">test-compare-inequal-strings-equal-sizes</span>: <span id="L201" class="LineNr">201 </span> <span class="subxComment"># eax = string-equal?("Abc", "Adc")</span> <span id="L202" class="LineNr">202 </span> <span class="subxS2Comment"># . . push args</span> <span id="L203" class="LineNr">203 </span> 68/push <span class="Constant">"Adc"</span>/imm32 @@ -270,7 +270,7 @@ if ('onhashchange' in window) { <span id="L208" class="LineNr">208 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> <span id="L209" class="LineNr">209 </span> <span class="subxComment"># check-ints-equal(eax, 0, msg)</span> <span id="L210" class="LineNr">210 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L211" class="LineNr">211 </span> 68/push <span class="Constant">"F - test-compare-inequal-strings-equal-lengths"</span>/imm32 +<span id="L211" class="LineNr">211 </span> 68/push <span class="Constant">"F - test-compare-inequal-strings-equal-sizes"</span>/imm32 <span id="L212" class="LineNr">212 </span> 68/push 0/imm32/false <span id="L213" class="LineNr">213 </span> 50/push-eax <span id="L214" class="LineNr">214 </span> <span class="subxS2Comment"># . . call</span> |