about summary refs log blame commit diff stats
path: root/subx/003trace.cc
blob: 2262293030d5a79ca039db8cfabaa3b428a0cacf (plain) (tree)
n>"subxComment"># ++currb</span> <span id="L112" class="LineNr">112 </span> 47/increment-edi <span id="L113" class="LineNr">113 </span> eb/jump $string-starts-with?:<span class="Constant">loop</span>/disp8 <span id="L114" class="LineNr">114 </span><span class="Constant">$string-starts-with?:true</span>: <span id="L115" class="LineNr">115 </span> b8/copy-to-eax 1/imm32 <span id="L116" class="LineNr">116 </span> eb/jump $string-starts-with?:end/disp8 <span id="L117" class="LineNr">117 </span><span class="Constant">$string-starts-with?:false</span>: <span id="L118" class="LineNr">118 </span> b8/copy-to-eax 0/imm32 <span id="L119" class="LineNr">119 </span><span class="Constant">$string-starts-with?:end</span>: <span id="L120" class="LineNr">120 </span> <span class="subxS1Comment"># . restore registers</span> <span id="L121" class="LineNr">121 </span> 5f/pop-to-edi <span id="L122" class="LineNr">122 </span> 5e/pop-to-esi <span id="L123" class="LineNr">123 </span> 5a/pop-to-edx <span id="L124" class="LineNr">124 </span> 59/pop-to-ecx <span id="L125" class="LineNr">125 </span> <span class="subxS1Comment"># . epilogue</span> <span id="L126" class="LineNr">126 </span> 89/copy 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 5/r32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ebp to esp</span> <span id="L127" class="LineNr">127 </span> 5d/pop-to-ebp <span id="L128" class="LineNr">128 </span> c3/return <span id="L129" class="LineNr">129 </span> <span id="L130" class="LineNr">130 </span><span class="subxH1Comment"># - tests</span> <span id="L131" class="LineNr">131 </span> <span id="L132" class="LineNr">132 </span><span class="subxTest">test-compare-empty-with-empty-string</span>: <span id="L133" class="LineNr">133 </span> <span class="subxComment"># eax = string-equal?(&quot;&quot;, &quot;&quot;)</span> <span id="L134" class="LineNr">134 </span> <span class="subxS2Comment"># . . push args</span> <span id="L135" class="LineNr">135 </span> 68/push <span class="Constant">&quot;&quot;</span>/imm32 <span id="L136" class="LineNr">136 </span> 68/push <span class="Constant">&quot;&quot;</span>/imm32 <span id="L137" class="LineNr">137 </span> <span class="subxS2Comment"># . . call</span> <span id="L138" class="LineNr">138 </span> e8/call <a href='105string-equal.subx.html#L8'>string-equal?</a>/disp32 <span id="L139" class="LineNr">139 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L140" class="LineNr">140 </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="L141" class="LineNr">141 </span> <span class="subxComment"># check-ints-equal(eax, 1, msg)</span> <span id="L142" class="LineNr">142 </span> <span class="subxS2Comment"># . . push args</span> <span id="L143" class="LineNr">143 </span> 68/push <span class="Constant">&quot;F - test-compare-empty-with-empty-string&quot;</span>/imm32 <span id="L144" class="LineNr">144 </span> 68/push 1/imm32/true <span id="L145" class="LineNr">145 </span> 50/push-eax <span id="L146" class="LineNr">146 </span> <span class="subxS2Comment"># . . call</span> <span id="L147" class="LineNr">147 </span> e8/call <a href='502test.mu.html#L2'>check-ints-equal</a>/disp32 <span id="L148" class="LineNr">148 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L149" class="LineNr">149 </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="L150" class="LineNr">150 </span> c3/return <span id="L151" class="LineNr">151 </span> <span id="L152" class="LineNr">152 </span><span class="subxTest">test-compare-empty-with-non-empty-string</span>: <span class="subxComment"># also checks size-mismatch code path</span> <span id="L153" class="LineNr">153 </span> <span class="subxComment"># eax = string-equal?(&quot;&quot;, &quot;Abc&quot;)</span> <span id="L154" class="LineNr">154 </span> <span class="subxS2Comment"># . . push args</span> <span id="L155" class="LineNr">155 </span> 68/push <span class="Constant">&quot;Abc&quot;</span>/imm32 <span id="L156" class="LineNr">156 </span> 68/push <span class="Constant">&quot;&quot;</span>/imm32 <span id="L157" class="LineNr">157 </span> <span class="subxS2Comment"># . . call</span> <span id="L158" class="LineNr">158 </span> e8/call <a href='105string-equal.subx.html#L8'>string-equal?</a>/disp32 <span id="L159" class="LineNr">159 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L160" class="LineNr">160 </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="L161" class="LineNr">161 </span> <span class="subxComment"># check-ints-equal(eax, 0, msg)</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">&quot;F - test-compare-empty-with-non-empty-string&quot;</span>/imm32 <span id="L164" class="LineNr">164 </span> 68/push 0/imm32/false <span id="L165" class="LineNr">165 </span> 50/push-eax <span id="L166" class="LineNr">166 </span> <span class="subxS2Comment"># . . call</span> <span id="L167" class="LineNr">167 </span> e8/call <a href='502test.mu.html#L2'>check-ints-equal</a>/disp32 <span id="L168" class="LineNr">168 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L169" class="LineNr">169 </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="L170" class="LineNr">170 </span> c3/return <span id="L171" class="LineNr">171 </span> <span id="L172" class="LineNr">172 </span><span class="subxTest">test-compare-equal-strings</span>: <span id="L173" class="LineNr">173 </span> <span class="subxComment"># eax = string-equal?(&quot;Abc&quot;, &quot;Abc&quot;)</span> <span id="L174" class="LineNr">174 </span> <span class="subxS2Comment"># . . push args</span> <span id="L175" class="LineNr">175 </span> 68/push <span class="Constant">&quot;Abc&quot;</span>/imm32 <span id="L176" class="LineNr">176 </span> 68/push <span class="Constant">&quot;Abc&quot;</span>/imm32 <span id="L177" class="LineNr">177 </span> <span class="subxS2Comment"># . . call</span> <span id="L178" class="LineNr">178 </span> e8/call <a href='105string-equal.subx.html#L8'>string-equal?</a>/disp32 <span id="L179" class="LineNr">179 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L180" class="LineNr">180 </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="L181" class="LineNr">181 </span> <span class="subxComment"># check-ints-equal(eax, 1, msg)</span> <span id="L182" class="LineNr">182 </span> <span class="subxS2Comment"># . . push args</span> <span id="L183" class="LineNr">183 </span> 68/push <span class="Constant">&quot;F - test-compare-equal-strings&quot;</span>/imm32 <span id="L184" class="LineNr">184 </span> 68/push 1/imm32/true <span id="L185" class="LineNr">185 </span> 50/push-eax <span id="L186" class="LineNr">186 </span> <span class="subxS2Comment"># . . call</span> <span id="L187" class="LineNr">187 </span> e8/call <a href='502test.mu.html#L2'>check-ints-equal</a>/disp32 <span id="L188" class="LineNr">188 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L189" class="LineNr">189 </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="L190" class="LineNr">190 </span> c3/return <span id="L191" class="LineNr">191 </span> <span id="L192" class="LineNr">192 </span><span class="subxTest">test-compare-inequal-strings-equal-sizes</span>: <span id="L193" class="LineNr">193 </span> <span class="subxComment"># eax = string-equal?(&quot;Abc&quot;, &quot;Adc&quot;)</span> <span id="L194" class="LineNr">194 </span> <span class="subxS2Comment"># . . push args</span> <span id="L195" class="LineNr">195 </span> 68/push <span class="Constant">&quot;Adc&quot;</span>/imm32 <span id="L196" class="LineNr">196 </span> 68/push <span class="Constant">&quot;Abc&quot;</span>/imm32 <span id="L197" class="LineNr">197 </span> <span class="subxS2Comment"># . . call</span> <span id="L198" class="LineNr">198 </span> e8/call <a href='105string-equal.subx.html#L8'>string-equal?</a>/disp32 <span id="L199" class="LineNr">199 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L200" class="LineNr">200 </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="L201" class="LineNr">201 </span> <span class="subxComment"># check-ints-equal(eax, 0, msg)</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">&quot;F - test-compare-inequal-strings-equal-sizes&quot;</span>/imm32 <span id="L204" class="LineNr">204 </span> 68/push 0/imm32/false <span id="L205" class="LineNr">205 </span> 50/push-eax <span id="L206" class="LineNr">206 </span> <span class="subxS2Comment"># . . call</span> <span id="L207" class="LineNr">207 </span> e8/call <a href='502test.mu.html#L2'>check-ints-equal</a>/disp32 <span id="L208" class="LineNr">208 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L209" class="LineNr">209 </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="L210" class="LineNr">210 </span> c3/return <span id="L211" class="LineNr">211 </span> <span id="L212" class="LineNr">212 </span><span class="subxComment"># helper for later tests</span> <span id="L213" class="LineNr">213 </span><span class="subxFunction">check-strings-equal</span>: <span class="subxComment"># s: (addr array byte), expected: (addr array byte), msg: (addr array byte)</span> <span id="L214" class="LineNr">214 </span> <span class="subxS1Comment"># . prologue</span> <span id="L215" class="LineNr">215 </span> 55/push-ebp <span id="L216" class="LineNr">216 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span> <span id="L217" class="LineNr">217 </span> <span class="subxS1Comment"># . save registers</span> <span id="L218" class="LineNr">218 </span> 50/push-eax <span id="L219" class="LineNr">219 </span> <span class="subxComment"># var eax: boolean = string-equal?(s, expected)</span> <span id="L220" class="LineNr">220 </span> <span class="subxS2Comment"># . . push args</span> <span id="L221" class="LineNr">221 </span> ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># push *(ebp+12)</span> <span id="L222" class="LineNr">222 </span> ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># push *(ebp+8)</span> <span id="L223" class="LineNr">223 </span> <span class="subxS2Comment"># . . call</span> <span id="L224" class="LineNr">224 </span> e8/call <a href='105string-equal.subx.html#L8'>string-equal?</a>/disp32 <span id="L225" class="LineNr">225 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L226" class="LineNr">226 </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="L227" class="LineNr">227 </span> <span class="subxComment"># check-ints-equal(eax, 1, msg)</span> <span id="L228" class="LineNr">228 </span> <span class="subxS2Comment"># . . push args</span> <span id="L229" class="LineNr">229 </span> ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0x10/disp8 <span class="Normal"> . </span> <span class="subxComment"># push *(ebp+16)</span> <span id="L230" class="LineNr">230 </span> 68/push 1/imm32 <span id="L231" class="LineNr">231 </span> 50/push-eax <span id="L232" class="LineNr">232 </span> <span class="subxS2Comment"># . . call</span> <span id="L233" class="LineNr">233 </span> e8/call <a href='502test.mu.html#L2'>check-ints-equal</a>/disp32 <span id="L234" class="LineNr">234 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L235" class="LineNr">235 </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="L236" class="LineNr">236 </span><span class="Constant">$check-strings-equal:end</span>: <span id="L237" class="LineNr">237 </span> <span class="subxS1Comment"># . restore registers</span> <span id="L238" class="LineNr">238 </span> 58/pop-to-eax <span id="L239" class="LineNr">239 </span> <span class="subxS1Comment"># . epilogue</span> <span id="L240" class="LineNr">240 </span> 89/copy 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 5/r32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ebp to esp</span> <span id="L241" class="LineNr">241 </span> 5d/pop-to-ebp <span id="L242" class="LineNr">242 </span> c3/return <span id="L243" class="LineNr">243 </span> <span id="L244" class="LineNr">244 </span><span class="subxComment"># test the helper</span> <span id="L245" class="LineNr">245 </span><span class="subxTest">test-check-strings-equal</span>: <span id="L246" class="LineNr">246 </span> <span class="subxComment"># check-strings-equal(&quot;Abc&quot;, &quot;Abc&quot;)</span> <span id="L247" class="LineNr">247 </span> <span class="subxS2Comment"># . . push args</span> <span id="L248" class="LineNr">248 </span> 68/push <span class="Constant">&quot;Abc&quot;</span>/imm32 <span id="L249" class="LineNr">249 </span> 68/push <span class="Constant">&quot;Abc&quot;</span>/imm32 <span id="L250" class="LineNr">250 </span> <span class="subxS2Comment"># . . call</span> <span id="L251" class="LineNr">251 </span> e8/call <a href='105string-equal.subx.html#L213'>check-strings-equal</a>/disp32 <span id="L252" class="LineNr">252 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L253" class="LineNr">253 </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="L254" class="LineNr">254 </span> c3/return <span id="L255" class="LineNr">255 </span> <span id="L256" class="LineNr">256 </span><span class="subxS2Comment"># . . vim&#0058;nowrap:textwidth=0</span> </pre> </body> </html> <!-- vim: set foldmethod=manual : -->