From 7fa80570a065353fad6d0698180e583e26a4c19e Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 31 Jul 2020 16:11:34 -0700 Subject: 6693 --- html/309stream.subx.html | 248 ++++++++++++++++++++++++++++------------------- 1 file changed, 148 insertions(+), 100 deletions(-) (limited to 'html/309stream.subx.html') diff --git a/html/309stream.subx.html b/html/309stream.subx.html index c577fb42..d9560b98 100644 --- a/html/309stream.subx.html +++ b/html/309stream.subx.html @@ -58,111 +58,159 @@ if ('onhashchange' in window) { 1 # Some unsafe methods not intended to be used directly in SubX, only through 2 # Mu after proper type-checking. 3 - 4 write-to-stream: # s: (addr stream), in: (addr byte), n: int + 4 stream-empty?: # s: (addr stream _) -> result/eax: boolean 5 # . prologue 6 55/push-ebp 7 89/<- %ebp 4/r32/esp 8 # . save registers - 9 50/push-eax - 10 51/push-ecx - 11 52/push-edx - 12 53/push-ebx - 13 57/push-edi - 14 # edi = s - 15 8b/-> *(ebp+8) 7/r32/edi - 16 # var swrite/edx: int = s->write - 17 8b/-> *edi 2/r32/edx - 18 # if (swrite + n > s->size) abort - 19 8b/-> *(ebp+0x10) 1/r32/ecx - 20 01/add-to %ecx 2/r32/edx - 21 3b/compare 1/r32/ecx *(edi+8) - 22 0f 8f/jump-if-> $write-to-stream:abort/disp32 - 23 # var out/edx: (addr byte) = s->data + s->write - 24 8d/copy-address *(edi+edx+0xc) 2/r32/edx - 25 # var outend/ebx: (addr byte) = out + n - 26 8b/-> *(ebp+0x10) 3/r32/ebx - 27 8d/copy-address *(edx+ebx) 3/r32/ebx - 28 # eax = in - 29 8b/-> *(ebp+0xc) 0/r32/eax - 30 # var inend/ecx: (addr byte) = in + n - 31 8b/-> *(ebp+0x10) 1/r32/ecx - 32 8d/copy-address *(eax+ecx) 1/r32/ecx - 33 # - 34 (_append-4 %edx %ebx %eax %ecx) # => eax - 35 # s->write += n - 36 8b/-> *(ebp+0x10) 1/r32/ecx - 37 01/add-to *edi 1/r32/ecx - 38 $write-to-stream:end: - 39 # . restore registers - 40 5f/pop-to-edi - 41 5b/pop-to-ebx - 42 5a/pop-to-edx - 43 59/pop-to-ecx - 44 58/pop-to-eax - 45 # . epilogue - 46 89/<- %esp 5/r32/ebp - 47 5d/pop-to-ebp - 48 c3/return - 49 - 50 $write-to-stream:abort: - 51 (write-buffered Stderr "write-to-stream: stream full\n") - 52 (flush Stderr) - 53 bb/copy-to-ebx 1/imm32 - 54 (syscall_exit) - 55 # never gets here - 56 - 57 read-from-stream: # s: (addr stream), out: (addr byte), n: int - 58 # . prologue - 59 55/push-ebp - 60 89/<- %ebp 4/r32/esp - 61 # . save registers - 62 50/push-eax - 63 51/push-ecx - 64 52/push-edx - 65 53/push-ebx - 66 56/push-esi - 67 # esi = s - 68 8b/-> *(ebp+8) 6/r32/esi - 69 # var sread/edx: int = s->read - 70 8b/-> *(esi+4) 2/r32/edx - 71 # if (sread + n > s->write) abort - 72 8b/-> *(ebp+0x10) 1/r32/ecx - 73 01/add-to %ecx 2/r32/edx - 74 3b/compare 1/r32/ecx *esi - 75 0f 8f/jump-if-> $read-from-stream:abort/disp32 - 76 # var in/edx: (addr byte) = s->data + s->read - 77 8d/copy-address *(esi+edx+0xc) 2/r32/edx - 78 # var inend/ebx: (addr byte) = in + n - 79 8b/-> *(ebp+0x10) 3/r32/ebx - 80 8d/copy-address *(edx+ebx) 3/r32/ebx - 81 # eax = out - 82 8b/-> *(ebp+0xc) 0/r32/eax - 83 # var outend/ecx: (addr byte) = out + n + 9 51/push-ecx + 10 56/push-esi + 11 # result = false + 12 b8/copy-to-eax 0/imm32/false + 13 # esi = s + 14 8b/-> *(ebp+8) 6/r32/esi + 15 # return s->read >= s->write + 16 8b/-> *esi 1/r32/ecx + 17 39/compare-with *(esi+4) 1/r32/ecx + 18 0f 9d/set-if->= %al + 19 $stream-empty?:end: + 20 # . restore registers + 21 5e/pop-to-esi + 22 59/pop-to-ecx + 23 # . epilogue + 24 89/<- %esp 5/r32/ebp + 25 5d/pop-to-ebp + 26 c3/return + 27 + 28 stream-full?: # s: (addr stream _) -> result/eax: boolean + 29 # . prologue + 30 55/push-ebp + 31 89/<- %ebp 4/r32/esp + 32 # . save registers + 33 51/push-ecx + 34 56/push-esi + 35 # result = false + 36 b8/copy-to-eax 0/imm32/false + 37 # esi = s + 38 8b/-> *(ebp+8) 6/r32/esi + 39 # return s->write >= s->size + 40 8b/-> *(esi+8) 1/r32/ecx + 41 39/compare-with *esi 1/r32/ecx + 42 0f 9d/set-if->= %al + 43 $stream-full?:end: + 44 # . restore registers + 45 5e/pop-to-esi + 46 59/pop-to-ecx + 47 # . epilogue + 48 89/<- %esp 5/r32/ebp + 49 5d/pop-to-ebp + 50 c3/return + 51 + 52 write-to-stream: # s: (addr stream _), in: (addr byte), n: int + 53 # . prologue + 54 55/push-ebp + 55 89/<- %ebp 4/r32/esp + 56 # . save registers + 57 50/push-eax + 58 51/push-ecx + 59 52/push-edx + 60 53/push-ebx + 61 57/push-edi + 62 # edi = s + 63 8b/-> *(ebp+8) 7/r32/edi + 64 # var swrite/edx: int = s->write + 65 8b/-> *edi 2/r32/edx + 66 # if (swrite + n > s->size) abort + 67 8b/-> *(ebp+0x10) 1/r32/ecx + 68 01/add-to %ecx 2/r32/edx + 69 3b/compare 1/r32/ecx *(edi+8) + 70 0f 8f/jump-if-> $write-to-stream:abort/disp32 + 71 # var out/edx: (addr byte) = s->data + s->write + 72 8d/copy-address *(edi+edx+0xc) 2/r32/edx + 73 # var outend/ebx: (addr byte) = out + n + 74 8b/-> *(ebp+0x10) 3/r32/ebx + 75 8d/copy-address *(edx+ebx) 3/r32/ebx + 76 # eax = in + 77 8b/-> *(ebp+0xc) 0/r32/eax + 78 # var inend/ecx: (addr byte) = in + n + 79 8b/-> *(ebp+0x10) 1/r32/ecx + 80 8d/copy-address *(eax+ecx) 1/r32/ecx + 81 # + 82 (_append-4 %edx %ebx %eax %ecx) # => eax + 83 # s->write += n 84 8b/-> *(ebp+0x10) 1/r32/ecx - 85 8d/copy-address *(eax+ecx) 1/r32/ecx - 86 # - 87 (_append-4 %eax %ecx %edx %ebx) # => eax - 88 # s->read += n - 89 8b/-> *(ebp+0x10) 1/r32/ecx - 90 01/add-to *(esi+4) 1/r32/ecx - 91 $read-from-stream:end: - 92 # . restore registers - 93 5e/pop-to-esi - 94 5b/pop-to-ebx - 95 5a/pop-to-edx - 96 59/pop-to-ecx - 97 58/pop-to-eax - 98 # . epilogue - 99 89/<- %esp 5/r32/ebp -100 5d/pop-to-ebp -101 c3/return -102 -103 $read-from-stream:abort: -104 (write-buffered Stderr "read-from-stream: stream empty\n") -105 (flush Stderr) -106 bb/copy-to-ebx 1/imm32 -107 (syscall_exit) -108 # never gets here + 85 01/add-to *edi 1/r32/ecx + 86 $write-to-stream:end: + 87 # . restore registers + 88 5f/pop-to-edi + 89 5b/pop-to-ebx + 90 5a/pop-to-edx + 91 59/pop-to-ecx + 92 58/pop-to-eax + 93 # . epilogue + 94 89/<- %esp 5/r32/ebp + 95 5d/pop-to-ebp + 96 c3/return + 97 + 98 $write-to-stream:abort: + 99 (write-buffered Stderr "write-to-stream: stream full\n") +100 (flush Stderr) +101 bb/copy-to-ebx 1/imm32 +102 (syscall_exit) +103 # never gets here +104 +105 read-from-stream: # s: (addr stream _), out: (addr byte), n: int +106 # . prologue +107 55/push-ebp +108 89/<- %ebp 4/r32/esp +109 # . save registers +110 50/push-eax +111 51/push-ecx +112 52/push-edx +113 53/push-ebx +114 56/push-esi +115 # esi = s +116 8b/-> *(ebp+8) 6/r32/esi +117 # var sread/edx: int = s->read +118 8b/-> *(esi+4) 2/r32/edx +119 # if (sread + n > s->write) abort +120 8b/-> *(ebp+0x10) 1/r32/ecx +121 01/add-to %ecx 2/r32/edx +122 3b/compare 1/r32/ecx *esi +123 0f 8f/jump-if-> $read-from-stream:abort/disp32 +124 # var in/edx: (addr byte) = s->data + s->read +125 8d/copy-address *(esi+edx+0xc) 2/r32/edx +126 # var inend/ebx: (addr byte) = in + n +127 8b/-> *(ebp+0x10) 3/r32/ebx +128 8d/copy-address *(edx+ebx) 3/r32/ebx +129 # eax = out +130 8b/-> *(ebp+0xc) 0/r32/eax +131 # var outend/ecx: (addr byte) = out + n +132 8b/-> *(ebp+0x10) 1/r32/ecx +133 8d/copy-address *(eax+ecx) 1/r32/ecx +134 # +135 (_append-4 %eax %ecx %edx %ebx) # => eax +136 # s->read += n +137 8b/-> *(ebp+0x10) 1/r32/ecx +138 01/add-to *(esi+4) 1/r32/ecx +139 $read-from-stream:end: +140 # . restore registers +141 5e/pop-to-esi +142 5b/pop-to-ebx +143 5a/pop-to-edx +144 59/pop-to-ecx +145 58/pop-to-eax +146 # . epilogue +147 89/<- %esp 5/r32/ebp +148 5d/pop-to-ebp +149 c3/return +150 +151 $read-from-stream:abort: +152 (write-buffered Stderr "read-from-stream: stream empty\n") +153 (flush Stderr) +154 bb/copy-to-ebx 1/imm32 +155 (syscall_exit) +156 # never gets here -- cgit 1.4.1-2-gfad0