4818
This commit is contained in:
parent
f75f333f52
commit
c98d4b1c6a
|
@ -105,9 +105,9 @@ if ('onhashchange' in window) {
|
|||
<span id="L40" class="LineNr"> 40 </span> 57/push-EDI
|
||||
<span id="L41" class="LineNr"> 41 </span>
|
||||
<span id="L42" class="LineNr"> 42 </span> <span class="subxComment"># pseudocode:</span>
|
||||
<span id="L43" class="LineNr"> 43 </span> <span class="subxComment"># initialize n = b.length</span>
|
||||
<span id="L43" class="LineNr"> 43 </span> <span class="subxComment"># initialize n = b->length</span>
|
||||
<span id="L44" class="LineNr"> 44 </span> <span class="subxComment"># initialize s1 = s</span>
|
||||
<span id="L45" class="LineNr"> 45 </span> <span class="subxComment"># initialize s2 = b.data</span>
|
||||
<span id="L45" class="LineNr"> 45 </span> <span class="subxComment"># initialize s2 = b->data</span>
|
||||
<span id="L46" class="LineNr"> 46 </span> <span class="subxComment"># i = 0</span>
|
||||
<span id="L47" class="LineNr"> 47 </span> <span class="subxComment"># for (i = 0; i < n; ++n)</span>
|
||||
<span id="L48" class="LineNr"> 48 </span> <span class="subxComment"># c1 = *s1</span>
|
||||
|
|
|
@ -90,7 +90,7 @@ if ('onhashchange' in window) {
|
|||
<span id="L27" class="LineNr">27 </span> 55/push-EBP
|
||||
<span id="L28" class="LineNr">28 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span>
|
||||
<span id="L29" class="LineNr">29 </span> 53/push-EBX
|
||||
<span id="L30" class="LineNr">30 </span> <span class="subxComment"># copy len to _mmap-new-segment.len</span>
|
||||
<span id="L30" class="LineNr">30 </span> <span class="subxComment"># copy len to _mmap-new-segment->len</span>
|
||||
<span id="L31" class="LineNr">31 </span> <span class="subxComment"># TODO: compute _mmap-new-segment+4 before runtime</span>
|
||||
<span id="L32" class="LineNr">32 </span> 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> 0/r32/EAX 8/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># copy *(EBP+8) to EAX</span>
|
||||
<span id="L33" class="LineNr">33 </span> bb/copy-to-EBX _mmap-new-segment/imm32
|
||||
|
|
|
@ -88,14 +88,14 @@ if ('onhashchange' in window) {
|
|||
<span id="L23" class="LineNr"> 23 </span> 53/push-EBX
|
||||
<span id="L24" class="LineNr"> 24 </span> 56/push-ESI
|
||||
<span id="L25" class="LineNr"> 25 </span> <span class="subxComment"># pseudocode:</span>
|
||||
<span id="L26" class="LineNr"> 26 </span> <span class="subxComment"># if s.length != b.length return false</span>
|
||||
<span id="L27" class="LineNr"> 27 </span> <span class="subxComment"># for i = 0; i < s.length; ++i</span>
|
||||
<span id="L26" class="LineNr"> 26 </span> <span class="subxComment"># if s->length != b->length return false</span>
|
||||
<span id="L27" class="LineNr"> 27 </span> <span class="subxComment"># for i = 0; i < s->length; ++i</span>
|
||||
<span id="L28" class="LineNr"> 28 </span> <span class="subxComment"># if s[i] != b[i] return false</span>
|
||||
<span id="L29" class="LineNr"> 29 </span> <span class="subxComment"># return true</span>
|
||||
<span id="L30" class="LineNr"> 30 </span> <span class="subxComment"># registers:</span>
|
||||
<span id="L31" class="LineNr"> 31 </span> <span class="subxComment"># i: ECX</span>
|
||||
<span id="L32" class="LineNr"> 32 </span> <span class="subxComment"># s.length: EDX</span>
|
||||
<span id="L33" class="LineNr"> 33 </span> <span class="subxComment"># b.length: EBX</span>
|
||||
<span id="L32" class="LineNr"> 32 </span> <span class="subxComment"># s->length: EDX</span>
|
||||
<span id="L33" class="LineNr"> 33 </span> <span class="subxComment"># b->length: EBX</span>
|
||||
<span id="L34" class="LineNr"> 34 </span> <span class="subxComment"># b[i]: EBX</span>
|
||||
<span id="L35" class="LineNr"> 35 </span> <span class="subxComment"># s[i]: EAX</span>
|
||||
<span id="L36" class="LineNr"> 36 </span> <span class="subxComment">#</span>
|
||||
|
@ -103,10 +103,10 @@ if ('onhashchange' in window) {
|
|||
<span id="L38" class="LineNr"> 38 </span> 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> 0/r32/EAX 8/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># copy *(EBP+8) to EAX</span>
|
||||
<span id="L39" class="LineNr"> 39 </span> <span class="subxComment"># var benchmark/EBX : (address array byte)</span>
|
||||
<span id="L40" class="LineNr"> 40 </span> 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> 3/r32/EBX 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># copy *(EBP+12) to EBX</span>
|
||||
<span id="L41" class="LineNr"> 41 </span> <span class="subxComment"># if s.length != b.length return false</span>
|
||||
<span id="L42" class="LineNr"> 42 </span> <span class="subxComment"># EDX = s.length</span>
|
||||
<span id="L41" class="LineNr"> 41 </span> <span class="subxComment"># if s->length != b->length return false</span>
|
||||
<span id="L42" class="LineNr"> 42 </span> <span class="subxComment"># EDX = s->length</span>
|
||||
<span id="L43" class="LineNr"> 43 </span> 8b/copy 0/mod/indirect 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 2/r32/EDX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy *EAX to EDX</span>
|
||||
<span id="L44" class="LineNr"> 44 </span> <span class="subxComment"># compare s.length and b.length</span>
|
||||
<span id="L44" class="LineNr"> 44 </span> <span class="subxComment"># compare s->length and b->length</span>
|
||||
<span id="L45" class="LineNr"> 45 </span> 39/compare 0/mod/indirect 3/rm32/EBX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 2/r32/EDX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># compare *EBX with EDX</span>
|
||||
<span id="L46" class="LineNr"> 46 </span> 75/jump-if-not-equal $string-equal:false/disp8
|
||||
<span id="L47" class="LineNr"> 47 </span><span class="Constant">$string-equal:lengths</span>:
|
||||
|
@ -117,7 +117,7 @@ if ('onhashchange' in window) {
|
|||
<span id="L52" class="LineNr"> 52 </span> <span class="subxComment"># EAX = &s[i]</span>
|
||||
<span id="L53" class="LineNr"> 53 </span> 40/inc-EAX
|
||||
<span id="L54" class="LineNr"> 54 </span><span class="Constant">$string-equal:loop</span>:
|
||||
<span id="L55" class="LineNr"> 55 </span> <span class="subxComment"># if i >= s.length return true</span>
|
||||
<span id="L55" class="LineNr"> 55 </span> <span class="subxComment"># if i >= s->length return true</span>
|
||||
<span id="L56" class="LineNr"> 56 </span> 39/compare 3/mod/direct 1/rm32/ECX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 2/r32/EDX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># compare ECX with EDX</span>
|
||||
<span id="L57" class="LineNr"> 57 </span> 7d/jump-if-greater-or-equal $string-equal:true/disp8
|
||||
<span id="L58" class="LineNr"> 58 </span> <span class="subxComment"># if b[i] != s[i] return false</span>
|
||||
|
|
|
@ -128,7 +128,7 @@ if ('onhashchange' in window) {
|
|||
<span id="L62" class="LineNr"> 62 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/imm32 <span class="subxComment"># add to ESP</span>
|
||||
<span id="L63" class="LineNr"> 63 </span> <span class="subxComment"># copy EAX to *Trace-stream</span>
|
||||
<span id="L64" class="LineNr"> 64 </span> 89/copy 0/mod/indirect 5/rm32/.disp32 <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0/r32/EAX <span class="SpecialChar">Trace-stream</span>/disp32 <span class="subxComment"># copy EAX to *Trace-stream</span>
|
||||
<span id="L65" class="LineNr"> 65 </span> <span class="subxComment"># Trace-stream.length = 0x1000/N - 12</span>
|
||||
<span id="L65" class="LineNr"> 65 </span> <span class="subxComment"># Trace-stream->length = 0x1000/N - 12</span>
|
||||
<span id="L66" class="LineNr"> 66 </span> c7 0/copy 1/mod/*+disp8 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/disp8 0xff4/imm32 <span class="subxComment"># copy 0xff4 to *(EAX+8)</span>
|
||||
<span id="L67" class="LineNr"> 67 </span> c3/return
|
||||
<span id="L68" class="LineNr"> 68 </span>
|
||||
|
@ -257,11 +257,11 @@ if ('onhashchange' in window) {
|
|||
<span id="L191" class="LineNr">191 </span> e8/call trace/disp32
|
||||
<span id="L192" class="LineNr">192 </span> <span class="subxS2Comment"># . . discard args</span>
|
||||
<span id="L193" class="LineNr">193 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span>
|
||||
<span id="L194" class="LineNr">194 </span> <span class="subxComment"># check-ints-equal(*_test-trace-stream.data, 41/A 62/b 0a/newline 00, msg)</span>
|
||||
<span id="L194" class="LineNr">194 </span> <span class="subxComment"># check-ints-equal(*_test-trace-stream->data, 41/A 62/b 0a/newline 00, msg)</span>
|
||||
<span id="L195" class="LineNr">195 </span> <span class="subxS2Comment"># . . push args</span>
|
||||
<span id="L196" class="LineNr">196 </span> 68/push <span class="Constant">"F - test-trace-single"</span>/imm32
|
||||
<span id="L197" class="LineNr">197 </span> 68/push 0x0a6241/imm32/Ab-newline
|
||||
<span id="L198" class="LineNr">198 </span> <span class="subxS2Comment"># . . push *_test-trace-stream.data</span>
|
||||
<span id="L198" class="LineNr">198 </span> <span class="subxS2Comment"># . . push *_test-trace-stream->data</span>
|
||||
<span id="L199" class="LineNr">199 </span> b8/copy-to-EAX _test-trace-stream/imm32
|
||||
<span id="L200" class="LineNr">200 </span> ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EAX+12)</span>
|
||||
<span id="L201" class="LineNr">201 </span> <span class="subxS2Comment"># . . call</span>
|
||||
|
@ -295,11 +295,11 @@ if ('onhashchange' in window) {
|
|||
<span id="L229" class="LineNr">229 </span> e8/call trace/disp32
|
||||
<span id="L230" class="LineNr">230 </span> <span class="subxS2Comment"># . . discard args</span>
|
||||
<span id="L231" class="LineNr">231 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span>
|
||||
<span id="L232" class="LineNr">232 </span> <span class="subxComment"># check-ints-equal(*_test-trace-stream.data, 43/C 0a/newline 44/D 0a/newline, msg)</span>
|
||||
<span id="L232" class="LineNr">232 </span> <span class="subxComment"># check-ints-equal(*_test-trace-stream->data, 43/C 0a/newline 44/D 0a/newline, msg)</span>
|
||||
<span id="L233" class="LineNr">233 </span> <span class="subxS2Comment"># . . push args</span>
|
||||
<span id="L234" class="LineNr">234 </span> 68/push <span class="Constant">"F - test-trace-appends"</span>/imm32
|
||||
<span id="L235" class="LineNr">235 </span> 68/push 0x0a440a43/imm32/C-newline-D-newline
|
||||
<span id="L236" class="LineNr">236 </span> <span class="subxS2Comment"># . . push *_test-trace-stream.data</span>
|
||||
<span id="L236" class="LineNr">236 </span> <span class="subxS2Comment"># . . push *_test-trace-stream->data</span>
|
||||
<span id="L237" class="LineNr">237 </span> b8/copy-to-EAX _test-trace-stream/imm32
|
||||
<span id="L238" class="LineNr">238 </span> ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EAX+12)</span>
|
||||
<span id="L239" class="LineNr">239 </span> <span class="subxS2Comment"># . . call</span>
|
||||
|
@ -325,11 +325,11 @@ if ('onhashchange' in window) {
|
|||
<span id="L259" class="LineNr">259 </span> e8/call trace/disp32
|
||||
<span id="L260" class="LineNr">260 </span> <span class="subxS2Comment"># . . discard args</span>
|
||||
<span id="L261" class="LineNr">261 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span>
|
||||
<span id="L262" class="LineNr">262 </span> <span class="subxComment"># check-ints-equal(*_test-trace-stream.data, 0, msg)</span>
|
||||
<span id="L262" class="LineNr">262 </span> <span class="subxComment"># check-ints-equal(*_test-trace-stream->data, 0, msg)</span>
|
||||
<span id="L263" class="LineNr">263 </span> <span class="subxS2Comment"># . . push args</span>
|
||||
<span id="L264" class="LineNr">264 </span> 68/push <span class="Constant">"F - test-trace-empty-line"</span>/imm32
|
||||
<span id="L265" class="LineNr">265 </span> 68/push 0/imm32
|
||||
<span id="L266" class="LineNr">266 </span> <span class="subxS2Comment"># . . push *_test-trace-stream.data</span>
|
||||
<span id="L266" class="LineNr">266 </span> <span class="subxS2Comment"># . . push *_test-trace-stream->data</span>
|
||||
<span id="L267" class="LineNr">267 </span> b8/copy-to-EAX _test-trace-stream/imm32
|
||||
<span id="L268" class="LineNr">268 </span> ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EAX+12)</span>
|
||||
<span id="L269" class="LineNr">269 </span> <span class="subxS2Comment"># . . call</span>
|
||||
|
@ -348,13 +348,13 @@ if ('onhashchange' in window) {
|
|||
<span id="L282" class="LineNr">282 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span>
|
||||
<span id="L283" class="LineNr">283 </span> <span class="subxS1Comment"># . save registers</span>
|
||||
<span id="L284" class="LineNr">284 </span> 51/push-ECX
|
||||
<span id="L285" class="LineNr">285 </span> <span class="subxComment"># _append-4(out, outend, &s.data[0], &s.data[s.length]) -> num_bytes_appended/EAX</span>
|
||||
<span id="L286" class="LineNr">286 </span> <span class="subxS2Comment"># . . push &s.data[s.length]</span>
|
||||
<span id="L285" class="LineNr">285 </span> <span class="subxComment"># _append-4(out, outend, &s->data[0], &s->data[s->length]) -> num_bytes_appended/EAX</span>
|
||||
<span id="L286" class="LineNr">286 </span> <span class="subxS2Comment"># . . push &s->data[s->length]</span>
|
||||
<span id="L287" class="LineNr">287 </span> 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 0/r32/EAX 0x10/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># copy *(EBP+16) to EAX</span>
|
||||
<span id="L288" class="LineNr">288 </span> 8b/copy 0/mod/indirect 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 1/r32/ECX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy *EAX to ECX</span>
|
||||
<span id="L289" class="LineNr">289 </span> 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX <span class="CommentedCode"> . </span> 1/r32/ECX 4/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># copy EAX+ECX+4 to ECX</span>
|
||||
<span id="L290" class="LineNr">290 </span> 51/push-ECX
|
||||
<span id="L291" class="LineNr">291 </span> <span class="subxS2Comment"># . . push &s.data[0]</span>
|
||||
<span id="L291" class="LineNr">291 </span> <span class="subxS2Comment"># . . push &s->data[0]</span>
|
||||
<span id="L292" class="LineNr">292 </span> 8d/copy-address 1/mod/*+disp8 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 1/r32/ECX 4/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># copy EAX+4 to ECX</span>
|
||||
<span id="L293" class="LineNr">293 </span> 51/push-ECX
|
||||
<span id="L294" class="LineNr">294 </span> <span class="subxS2Comment"># . . push outend</span>
|
||||
|
|
|
@ -167,7 +167,7 @@ if ('onhashchange' in window) {
|
|||
<span id="L101" class="LineNr">101 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x10/imm32 <span class="subxComment"># add to ESP</span>
|
||||
<span id="L102" class="LineNr">102 </span> <span class="subxComment"># s->write += EAX</span>
|
||||
<span id="L103" class="LineNr">103 </span> 01/add 0/mod/indirect 7/rm32/EDI <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0/r32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># add EAX to *EDI</span>
|
||||
<span id="L104" class="LineNr">104 </span> <span class="subxComment"># f.read += EAX</span>
|
||||
<span id="L104" class="LineNr">104 </span> <span class="subxComment"># f->read += EAX</span>
|
||||
<span id="L105" class="LineNr">105 </span> 01/add 1/mod/*+disp8 6/rm32/ESI <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0/r32/EAX 4/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># add EAX to *(ESI+4)</span>
|
||||
<span id="L106" class="LineNr">106 </span> <span class="subxS1Comment"># . restore registers</span>
|
||||
<span id="L107" class="LineNr">107 </span> 5f/pop-to-EDI
|
||||
|
@ -180,7 +180,7 @@ if ('onhashchange' in window) {
|
|||
<span id="L114" class="LineNr">114 </span>
|
||||
<span id="L115" class="LineNr">115 </span><span class="subxH1Comment"># - helpers</span>
|
||||
<span id="L116" class="LineNr">116 </span>
|
||||
<span id="L117" class="LineNr">117 </span><span class="subxComment"># idea: a clear-if-empty method on streams that clears only if f.read == f.write</span>
|
||||
<span id="L117" class="LineNr">117 </span><span class="subxComment"># idea: a clear-if-empty method on streams that clears only if f->read == f->write</span>
|
||||
<span id="L118" class="LineNr">118 </span><span class="subxComment"># Unclear how I'd use it, though. Callers seem to need the check anyway.</span>
|
||||
<span id="L119" class="LineNr">119 </span><span class="subxComment"># Maybe a better helper would be 'empty-stream?'</span>
|
||||
<span id="L120" class="LineNr">120 </span>
|
||||
|
@ -351,7 +351,7 @@ if ('onhashchange' in window) {
|
|||
<span id="L285" class="LineNr">285 </span> <span class="subxS2Comment"># . . push args</span>
|
||||
<span id="L286" class="LineNr">286 </span> 68/push <span class="Constant">"F - test-read-is-stateful"</span>/imm32
|
||||
<span id="L287" class="LineNr">287 </span> 68/push 0x00004443/imm32/C-D
|
||||
<span id="L288" class="LineNr">288 </span> <span class="subxS1Comment"># . push *_test-stream-buffer->data</span>
|
||||
<span id="L288" class="LineNr">288 </span> <span class="subxS2Comment"># . . push *_test-stream-buffer->data</span>
|
||||
<span id="L289" class="LineNr">289 </span> b8/copy-to-EAX _test-stream-buffer/imm32
|
||||
<span id="L290" class="LineNr">290 </span> ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EAX+12)</span>
|
||||
<span id="L291" class="LineNr">291 </span> <span class="subxS2Comment"># . . call</span>
|
||||
|
|
|
@ -107,7 +107,7 @@ if ('onhashchange' in window) {
|
|||
<span id="L41" class="LineNr"> 41 </span>
|
||||
<span id="L42" class="LineNr"> 42 </span><span class="subxComment"># return next byte value in EAX, with top 3 bytes cleared.</span>
|
||||
<span id="L43" class="LineNr"> 43 </span><span class="subxComment"># On EOF, return 0xffffffff.</span>
|
||||
<span id="L44" class="LineNr"> 44 </span><span class="subxFunction">read-byte</span>: <span class="subxComment"># f : (address buffered-file) -> byte/EAX</span>
|
||||
<span id="L44" class="LineNr"> 44 </span><span class="subxFunction">read-byte</span>: <span class="subxComment"># f : (address buffered-file) -> byte-or-eof/EAX</span>
|
||||
<span id="L45" class="LineNr"> 45 </span> <span class="subxS1Comment"># . prolog</span>
|
||||
<span id="L46" class="LineNr"> 46 </span> 55/push-EBP
|
||||
<span id="L47" class="LineNr"> 47 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span>
|
||||
|
|
|
@ -215,11 +215,11 @@ if ('onhashchange' in window) {
|
|||
<span id="L150" class="LineNr">150 </span> e8/call write-stream/disp32
|
||||
<span id="L151" class="LineNr">151 </span> <span class="subxS2Comment"># . . discard args</span>
|
||||
<span id="L152" class="LineNr">152 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span>
|
||||
<span id="L153" class="LineNr">153 </span> <span class="subxComment"># check-ints-equal(*_test-stream.data, 41/A 62/b 00 00, msg)</span>
|
||||
<span id="L153" class="LineNr">153 </span> <span class="subxComment"># check-ints-equal(*_test-stream->data, 41/A 62/b 00 00, msg)</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">"F - test-write-stream-single"</span>/imm32
|
||||
<span id="L156" class="LineNr">156 </span> 68/push 0x006241/imm32/Ab
|
||||
<span id="L157" class="LineNr">157 </span> <span class="subxComment"># push *_test-stream.data</span>
|
||||
<span id="L157" class="LineNr">157 </span> <span class="subxS2Comment"># . . push *_test-stream->data</span>
|
||||
<span id="L158" class="LineNr">158 </span> b8/copy-to-EAX _test-stream/imm32
|
||||
<span id="L159" class="LineNr">159 </span> ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EAX+12)</span>
|
||||
<span id="L160" class="LineNr">160 </span> <span class="subxS2Comment"># . . call</span>
|
||||
|
@ -279,11 +279,11 @@ if ('onhashchange' in window) {
|
|||
<span id="L214" class="LineNr">214 </span> e8/call write-stream/disp32
|
||||
<span id="L215" class="LineNr">215 </span> <span class="subxS2Comment"># . . discard args</span>
|
||||
<span id="L216" class="LineNr">216 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span>
|
||||
<span id="L217" class="LineNr">217 </span> <span class="subxComment"># check-ints-equal(*_test-stream.data, 43/C 44/D 00 00, msg)</span>
|
||||
<span id="L217" class="LineNr">217 </span> <span class="subxComment"># check-ints-equal(*_test-stream->data, 43/C 44/D 00 00, msg)</span>
|
||||
<span id="L218" class="LineNr">218 </span> <span class="subxS2Comment"># . . push args</span>
|
||||
<span id="L219" class="LineNr">219 </span> 68/push <span class="Constant">"F - test-write-stream-appends"</span>/imm32
|
||||
<span id="L220" class="LineNr">220 </span> 68/push 0x00004443/imm32/C-D
|
||||
<span id="L221" class="LineNr">221 </span> <span class="subxComment"># push *_test-stream.data</span>
|
||||
<span id="L221" class="LineNr">221 </span> <span class="subxS2Comment"># . . push *_test-stream->data</span>
|
||||
<span id="L222" class="LineNr">222 </span> b8/copy-to-EAX _test-stream/imm32
|
||||
<span id="L223" class="LineNr">223 </span> ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EAX+12)</span>
|
||||
<span id="L224" class="LineNr">224 </span> <span class="subxS2Comment"># . . call</span>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -267,11 +267,11 @@ if ('onhashchange' in window) {
|
|||
<span id="L201" class="LineNr">201 </span> <span class="subxComment"># pseudocode:</span>
|
||||
<span id="L202" class="LineNr">202 </span> <span class="subxComment"># if !is-digit?(Look) expected(ed, err, "integer")</span>
|
||||
<span id="L203" class="LineNr">203 </span> <span class="subxComment"># do</span>
|
||||
<span id="L204" class="LineNr">204 </span> <span class="subxComment"># if out.write >= out.length</span>
|
||||
<span id="L204" class="LineNr">204 </span> <span class="subxComment"># if out->write >= out->length</span>
|
||||
<span id="L205" class="LineNr">205 </span> <span class="subxComment"># write(err, "Error: too many digits in number\n")</span>
|
||||
<span id="L206" class="LineNr">206 </span> <span class="subxComment"># stop(ed, 1)</span>
|
||||
<span id="L207" class="LineNr">207 </span> <span class="subxComment"># out.data[out.write] = LSB(Look)</span>
|
||||
<span id="L208" class="LineNr">208 </span> <span class="subxComment"># ++out.write</span>
|
||||
<span id="L207" class="LineNr">207 </span> <span class="subxComment"># out->data[out->write] = LSB(Look)</span>
|
||||
<span id="L208" class="LineNr">208 </span> <span class="subxComment"># ++out->write</span>
|
||||
<span id="L209" class="LineNr">209 </span> <span class="subxComment"># Look = get-char(in)</span>
|
||||
<span id="L210" class="LineNr">210 </span> <span class="subxComment"># while is-digit?(Look)</span>
|
||||
<span id="L211" class="LineNr">211 </span> <span class="subxComment"># This is complicated because I don't want to hard-code the error strategy in</span>
|
||||
|
@ -458,7 +458,7 @@ if ('onhashchange' in window) {
|
|||
<span id="L392" class="LineNr">392 </span> <span class="subxComment"># registers except ESP may be clobbered at this point</span>
|
||||
<span id="L393" class="LineNr">393 </span> <span class="subxS2Comment"># . . discard args</span>
|
||||
<span id="L394" class="LineNr">394 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x10/imm32 <span class="subxComment"># add to ESP</span>
|
||||
<span id="L395" class="LineNr">395 </span> <span class="subxComment"># check-ints-equal(*_test-output-stream.data, '3')</span>
|
||||
<span id="L395" class="LineNr">395 </span> <span class="subxComment"># check-ints-equal(*_test-output-stream->data, '3')</span>
|
||||
<span id="L396" class="LineNr">396 </span> <span class="subxS2Comment"># . . push args</span>
|
||||
<span id="L397" class="LineNr">397 </span> 68/push <span class="Constant">"F - test-get-num-reads-single-digit"</span>/imm32
|
||||
<span id="L398" class="LineNr">398 </span> 68/push 0x33/imm32
|
||||
|
@ -634,7 +634,7 @@ if ('onhashchange' in window) {
|
|||
<span id="L568" class="LineNr">568 </span> <span class="subxComment"># registers except ESP may be clobbered at this point</span>
|
||||
<span id="L569" class="LineNr">569 </span> <span class="subxS2Comment"># . . discard args</span>
|
||||
<span id="L570" class="LineNr">570 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x10/imm32 <span class="subxComment"># add to ESP</span>
|
||||
<span id="L571" class="LineNr">571 </span> <span class="subxComment"># check-ints-equal(*_test-output-stream.data, '3456')</span>
|
||||
<span id="L571" class="LineNr">571 </span> <span class="subxComment"># check-ints-equal(*_test-output-stream->data, '3456')</span>
|
||||
<span id="L572" class="LineNr">572 </span> <span class="subxS2Comment"># . . push args</span>
|
||||
<span id="L573" class="LineNr">573 </span> 68/push <span class="Constant">"F - test-get-num-reads-multiple-digits"</span>/imm32
|
||||
<span id="L574" class="LineNr">574 </span> 68/push 0x36353433/imm32
|
||||
|
@ -725,7 +725,7 @@ if ('onhashchange' in window) {
|
|||
<span id="L659" class="LineNr">659 </span> <span class="subxComment"># registers except ESP may be clobbered at this point</span>
|
||||
<span id="L660" class="LineNr">660 </span> <span class="subxS2Comment"># . . discard args</span>
|
||||
<span id="L661" class="LineNr">661 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x10/imm32 <span class="subxComment"># add to ESP</span>
|
||||
<span id="L662" class="LineNr">662 </span> <span class="subxComment"># check-ints-equal(*_test-output-stream.data, '3456')</span>
|
||||
<span id="L662" class="LineNr">662 </span> <span class="subxComment"># check-ints-equal(*_test-output-stream->data, '3456')</span>
|
||||
<span id="L663" class="LineNr">663 </span> <span class="subxS2Comment"># . . push args</span>
|
||||
<span id="L664" class="LineNr">664 </span> 68/push <span class="Constant">"F - test-get-num-reads-multiple-digits-followed-by-nondigit"</span>/imm32
|
||||
<span id="L665" class="LineNr">665 </span> 68/push 0x36353433/imm32
|
||||
|
|
|
@ -105,9 +105,9 @@ if ('onhashchange' in window) {
|
|||
<span id="L40" class="LineNr"> 40 </span> 57/push-EDI
|
||||
<span id="L41" class="LineNr"> 41 </span>
|
||||
<span id="L42" class="LineNr"> 42 </span> <span class="subxComment"># pseudocode:</span>
|
||||
<span id="L43" class="LineNr"> 43 </span> <span class="subxComment"># initialize n = b.length</span>
|
||||
<span id="L43" class="LineNr"> 43 </span> <span class="subxComment"># initialize n = b->length</span>
|
||||
<span id="L44" class="LineNr"> 44 </span> <span class="subxComment"># initialize s1 = s</span>
|
||||
<span id="L45" class="LineNr"> 45 </span> <span class="subxComment"># initialize s2 = b.data</span>
|
||||
<span id="L45" class="LineNr"> 45 </span> <span class="subxComment"># initialize s2 = b->data</span>
|
||||
<span id="L46" class="LineNr"> 46 </span> <span class="subxComment"># i = 0</span>
|
||||
<span id="L47" class="LineNr"> 47 </span> <span class="subxComment"># for (i = 0; i < n; ++n)</span>
|
||||
<span id="L48" class="LineNr"> 48 </span> <span class="subxComment"># c1 = *s1</span>
|
||||
|
|
|
@ -40,9 +40,9 @@ kernel-string-equal: # s : null-terminated ascii string, benchmark : length-pre
|
|||
57/push-EDI
|
||||
|
||||
# pseudocode:
|
||||
# initialize n = b.length
|
||||
# initialize n = b->length
|
||||
# initialize s1 = s
|
||||
# initialize s2 = b.data
|
||||
# initialize s2 = b->data
|
||||
# i = 0
|
||||
# for (i = 0; i < n; ++n)
|
||||
# c1 = *s1
|
||||
|
|
|
@ -27,7 +27,7 @@ new-segment: # len : int -> address
|
|||
55/push-EBP
|
||||
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
|
||||
53/push-EBX
|
||||
# copy len to _mmap-new-segment.len
|
||||
# copy len to _mmap-new-segment->len
|
||||
# TODO: compute _mmap-new-segment+4 before runtime
|
||||
8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 0/r32/EAX 8/disp8 . # copy *(EBP+8) to EAX
|
||||
bb/copy-to-EBX _mmap-new-segment/imm32
|
||||
|
|
|
@ -23,14 +23,14 @@ string-equal: # s : string, benchmark : string -> EAX : boolean
|
|||
53/push-EBX
|
||||
56/push-ESI
|
||||
# pseudocode:
|
||||
# if s.length != b.length return false
|
||||
# for i = 0; i < s.length; ++i
|
||||
# if s->length != b->length return false
|
||||
# for i = 0; i < s->length; ++i
|
||||
# if s[i] != b[i] return false
|
||||
# return true
|
||||
# registers:
|
||||
# i: ECX
|
||||
# s.length: EDX
|
||||
# b.length: EBX
|
||||
# s->length: EDX
|
||||
# b->length: EBX
|
||||
# b[i]: EBX
|
||||
# s[i]: EAX
|
||||
#
|
||||
|
@ -38,10 +38,10 @@ string-equal: # s : string, benchmark : string -> EAX : boolean
|
|||
8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 0/r32/EAX 8/disp8 . # copy *(EBP+8) to EAX
|
||||
# var benchmark/EBX : (address array byte)
|
||||
8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 3/r32/EBX 0xc/disp8 . # copy *(EBP+12) to EBX
|
||||
# if s.length != b.length return false
|
||||
# EDX = s.length
|
||||
# if s->length != b->length return false
|
||||
# EDX = s->length
|
||||
8b/copy 0/mod/indirect 0/rm32/EAX . . . 2/r32/EDX . . # copy *EAX to EDX
|
||||
# compare s.length and b.length
|
||||
# compare s->length and b->length
|
||||
39/compare 0/mod/indirect 3/rm32/EBX . . . 2/r32/EDX . . # compare *EBX with EDX
|
||||
75/jump-if-not-equal $string-equal:false/disp8
|
||||
$string-equal:lengths:
|
||||
|
@ -52,7 +52,7 @@ $string-equal:lengths:
|
|||
# EAX = &s[i]
|
||||
40/inc-EAX
|
||||
$string-equal:loop:
|
||||
# if i >= s.length return true
|
||||
# if i >= s->length return true
|
||||
39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . . # compare ECX with EDX
|
||||
7d/jump-if-greater-or-equal $string-equal:true/disp8
|
||||
# if b[i] != s[i] return false
|
||||
|
|
|
@ -62,7 +62,7 @@ initialize-trace-stream:
|
|||
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
|
||||
# copy EAX to *Trace-stream
|
||||
89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Trace-stream/disp32 # copy EAX to *Trace-stream
|
||||
# Trace-stream.length = 0x1000/N - 12
|
||||
# Trace-stream->length = 0x1000/N - 12
|
||||
c7 0/copy 1/mod/*+disp8 0/rm32/EAX . . . . 8/disp8 0xff4/imm32 # copy 0xff4 to *(EAX+8)
|
||||
c3/return
|
||||
|
||||
|
@ -191,11 +191,11 @@ test-trace-single:
|
|||
e8/call trace/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
|
||||
# check-ints-equal(*_test-trace-stream.data, 41/A 62/b 0a/newline 00, msg)
|
||||
# check-ints-equal(*_test-trace-stream->data, 41/A 62/b 0a/newline 00, msg)
|
||||
# . . push args
|
||||
68/push "F - test-trace-single"/imm32
|
||||
68/push 0x0a6241/imm32/Ab-newline
|
||||
# . . push *_test-trace-stream.data
|
||||
# . . push *_test-trace-stream->data
|
||||
b8/copy-to-EAX _test-trace-stream/imm32
|
||||
ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 . # push *(EAX+12)
|
||||
# . . call
|
||||
|
@ -229,11 +229,11 @@ test-trace-appends:
|
|||
e8/call trace/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
|
||||
# check-ints-equal(*_test-trace-stream.data, 43/C 0a/newline 44/D 0a/newline, msg)
|
||||
# check-ints-equal(*_test-trace-stream->data, 43/C 0a/newline 44/D 0a/newline, msg)
|
||||
# . . push args
|
||||
68/push "F - test-trace-appends"/imm32
|
||||
68/push 0x0a440a43/imm32/C-newline-D-newline
|
||||
# . . push *_test-trace-stream.data
|
||||
# . . push *_test-trace-stream->data
|
||||
b8/copy-to-EAX _test-trace-stream/imm32
|
||||
ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 . # push *(EAX+12)
|
||||
# . . call
|
||||
|
@ -259,11 +259,11 @@ test-trace-empty-line:
|
|||
e8/call trace/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
|
||||
# check-ints-equal(*_test-trace-stream.data, 0, msg)
|
||||
# check-ints-equal(*_test-trace-stream->data, 0, msg)
|
||||
# . . push args
|
||||
68/push "F - test-trace-empty-line"/imm32
|
||||
68/push 0/imm32
|
||||
# . . push *_test-trace-stream.data
|
||||
# . . push *_test-trace-stream->data
|
||||
b8/copy-to-EAX _test-trace-stream/imm32
|
||||
ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 . # push *(EAX+12)
|
||||
# . . call
|
||||
|
@ -282,13 +282,13 @@ _append-3: # out : address, outend : address, s : (array byte) -> num_bytes_app
|
|||
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
|
||||
# . save registers
|
||||
51/push-ECX
|
||||
# _append-4(out, outend, &s.data[0], &s.data[s.length]) -> num_bytes_appended/EAX
|
||||
# . . push &s.data[s.length]
|
||||
# _append-4(out, outend, &s->data[0], &s->data[s->length]) -> num_bytes_appended/EAX
|
||||
# . . push &s->data[s->length]
|
||||
8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 0/r32/EAX 0x10/disp8 . # copy *(EBP+16) to EAX
|
||||
8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . . # copy *EAX to ECX
|
||||
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 . # copy EAX+ECX+4 to ECX
|
||||
51/push-ECX
|
||||
# . . push &s.data[0]
|
||||
# . . push &s->data[0]
|
||||
8d/copy-address 1/mod/*+disp8 0/rm32/EAX . . . 1/r32/ECX 4/disp8 . # copy EAX+4 to ECX
|
||||
51/push-ECX
|
||||
# . . push outend
|
||||
|
|
|
@ -101,7 +101,7 @@ $read:fake:
|
|||
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32 # add to ESP
|
||||
# s->write += EAX
|
||||
01/add 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . . # add EAX to *EDI
|
||||
# f.read += EAX
|
||||
# f->read += EAX
|
||||
01/add 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 . # add EAX to *(ESI+4)
|
||||
# . restore registers
|
||||
5f/pop-to-EDI
|
||||
|
@ -114,7 +114,7 @@ $read:end:
|
|||
|
||||
# - helpers
|
||||
|
||||
# idea: a clear-if-empty method on streams that clears only if f.read == f.write
|
||||
# idea: a clear-if-empty method on streams that clears only if f->read == f->write
|
||||
# Unclear how I'd use it, though. Callers seem to need the check anyway.
|
||||
# Maybe a better helper would be 'empty-stream?'
|
||||
|
||||
|
@ -285,7 +285,7 @@ test-read-is-stateful:
|
|||
# . . push args
|
||||
68/push "F - test-read-is-stateful"/imm32
|
||||
68/push 0x00004443/imm32/C-D
|
||||
# . push *_test-stream-buffer->data
|
||||
# . . push *_test-stream-buffer->data
|
||||
b8/copy-to-EAX _test-stream-buffer/imm32
|
||||
ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 . # push *(EAX+12)
|
||||
# . . call
|
||||
|
|
|
@ -41,7 +41,7 @@ Stdin:
|
|||
|
||||
# return next byte value in EAX, with top 3 bytes cleared.
|
||||
# On EOF, return 0xffffffff.
|
||||
read-byte: # f : (address buffered-file) -> byte/EAX
|
||||
read-byte: # f : (address buffered-file) -> byte-or-eof/EAX
|
||||
# . prolog
|
||||
55/push-EBP
|
||||
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
|
||||
|
|
|
@ -150,11 +150,11 @@ test-write-stream-single:
|
|||
e8/call write-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
|
||||
# check-ints-equal(*_test-stream.data, 41/A 62/b 00 00, msg)
|
||||
# check-ints-equal(*_test-stream->data, 41/A 62/b 00 00, msg)
|
||||
# . . push args
|
||||
68/push "F - test-write-stream-single"/imm32
|
||||
68/push 0x006241/imm32/Ab
|
||||
# push *_test-stream.data
|
||||
# . . push *_test-stream->data
|
||||
b8/copy-to-EAX _test-stream/imm32
|
||||
ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 . # push *(EAX+12)
|
||||
# . . call
|
||||
|
@ -214,11 +214,11 @@ test-write-stream-appends:
|
|||
e8/call write-stream/disp32
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
|
||||
# check-ints-equal(*_test-stream.data, 43/C 44/D 00 00, msg)
|
||||
# check-ints-equal(*_test-stream->data, 43/C 44/D 00 00, msg)
|
||||
# . . push args
|
||||
68/push "F - test-write-stream-appends"/imm32
|
||||
68/push 0x00004443/imm32/C-D
|
||||
# push *_test-stream.data
|
||||
# . . push *_test-stream->data
|
||||
b8/copy-to-EAX _test-stream/imm32
|
||||
ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 . # push *(EAX+12)
|
||||
# . . call
|
||||
|
|
|
@ -88,6 +88,7 @@ compile: # in : (address buffered-file), out : fd or (address stream), err : fd
|
|||
# . save registers
|
||||
50/push-EAX
|
||||
51/push-ECX
|
||||
# prime the pump
|
||||
# . Look = get-char(in)
|
||||
# . . push args
|
||||
ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8)
|
||||
|
@ -198,11 +199,11 @@ compile: # in : (address buffered-file), out : fd or (address stream), err : fd
|
|||
get-num: # in : (address buffered-file), out : (address stream), err : fd or (address stream), ed : (address exit-descriptor) -> <void>
|
||||
# pseudocode:
|
||||
# if !is-digit?(Look) expected(ed, err, "integer")
|
||||
# if out.write >= out.length
|
||||
# if out->write >= out->length
|
||||
# write(err, "Error: too many digits in number\n")
|
||||
# stop(ed, 1)
|
||||
# out.data[out.write] = LSB(Look)
|
||||
# ++out.write
|
||||
# out->data[out->write] = LSB(Look)
|
||||
# ++out->write
|
||||
# Look = get-char(in)
|
||||
#
|
||||
# registers:
|
||||
|
@ -303,7 +304,7 @@ test-get-num-reads-single-digit:
|
|||
# This test uses exit-descriptors. Use EBP for setting up local variables.
|
||||
55/push-EBP
|
||||
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
|
||||
# setup
|
||||
# clear all streams
|
||||
# . clear-stream(_test-stream)
|
||||
# . . push args
|
||||
68/push _test-stream/imm32
|
||||
|
@ -374,7 +375,7 @@ test-get-num-reads-single-digit:
|
|||
# registers except ESP may be clobbered at this point
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32 # add to ESP
|
||||
# check-ints-equal(*_test-output-stream.data, '3')
|
||||
# check-ints-equal(*_test-output-stream->data, '3')
|
||||
# . . push args
|
||||
68/push "F - test-get-num-reads-single-digit"/imm32
|
||||
68/push 0x33/imm32
|
||||
|
@ -394,7 +395,7 @@ test-get-num-aborts-on-non-digit-in-Look:
|
|||
# This test uses exit-descriptors. Use EBP for setting up local variables.
|
||||
55/push-EBP
|
||||
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
|
||||
# setup
|
||||
# clear all streams
|
||||
# . clear-stream(_test-stream)
|
||||
# . . push args
|
||||
68/push _test-stream/imm32
|
||||
|
|
|
@ -201,11 +201,11 @@ get-num: # in : (address buffered-file), out : (address stream), err : fd or (a
|
|||
# pseudocode:
|
||||
# if !is-digit?(Look) expected(ed, err, "integer")
|
||||
# do
|
||||
# if out.write >= out.length
|
||||
# if out->write >= out->length
|
||||
# write(err, "Error: too many digits in number\n")
|
||||
# stop(ed, 1)
|
||||
# out.data[out.write] = LSB(Look)
|
||||
# ++out.write
|
||||
# out->data[out->write] = LSB(Look)
|
||||
# ++out->write
|
||||
# Look = get-char(in)
|
||||
# while is-digit?(Look)
|
||||
# This is complicated because I don't want to hard-code the error strategy in
|
||||
|
@ -392,7 +392,7 @@ test-get-num-reads-single-digit:
|
|||
# registers except ESP may be clobbered at this point
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32 # add to ESP
|
||||
# check-ints-equal(*_test-output-stream.data, '3')
|
||||
# check-ints-equal(*_test-output-stream->data, '3')
|
||||
# . . push args
|
||||
68/push "F - test-get-num-reads-single-digit"/imm32
|
||||
68/push 0x33/imm32
|
||||
|
@ -568,7 +568,7 @@ test-get-num-reads-multiple-digits:
|
|||
# registers except ESP may be clobbered at this point
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32 # add to ESP
|
||||
# check-ints-equal(*_test-output-stream.data, '3456')
|
||||
# check-ints-equal(*_test-output-stream->data, '3456')
|
||||
# . . push args
|
||||
68/push "F - test-get-num-reads-multiple-digits"/imm32
|
||||
68/push 0x36353433/imm32
|
||||
|
@ -659,7 +659,7 @@ test-get-num-reads-multiple-digits-followed-by-nondigit:
|
|||
# registers except ESP may be clobbered at this point
|
||||
# . . discard args
|
||||
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32 # add to ESP
|
||||
# check-ints-equal(*_test-output-stream.data, '3456')
|
||||
# check-ints-equal(*_test-output-stream->data, '3456')
|
||||
# . . push args
|
||||
68/push "F - test-get-num-reads-multiple-digits-followed-by-nondigit"/imm32
|
||||
68/push 0x36353433/imm32
|
||||
|
|
|
@ -40,9 +40,9 @@ kernel-string-equal: # s : null-terminated ascii string, benchmark : length-pre
|
|||
57/push-EDI
|
||||
|
||||
# pseudocode:
|
||||
# initialize n = b.length
|
||||
# initialize n = b->length
|
||||
# initialize s1 = s
|
||||
# initialize s2 = b.data
|
||||
# initialize s2 = b->data
|
||||
# i = 0
|
||||
# for (i = 0; i < n; ++n)
|
||||
# c1 = *s1
|
||||
|
|
Loading…
Reference in New Issue