From 999c529cb972079df3bc693945be34a77336ddf4 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 26 Oct 2019 23:51:14 -0700 Subject: 5716 --- html/apps/braces.subx.html | 200 +++++++++++++++++++++------------------------ 1 file changed, 91 insertions(+), 109 deletions(-) (limited to 'html/apps/braces.subx.html') diff --git a/html/apps/braces.subx.html b/html/apps/braces.subx.html index 7a5d5d7c..498489b5 100644 --- a/html/apps/braces.subx.html +++ b/html/apps/braces.subx.html @@ -136,8 +136,8 @@ if ('onhashchange' in window) { 77 78 subx-braces: # in : (address buffered-file), out : (address buffered-file) 79 # pseudocode: - 80 # var line = new-stream(512, 1) - 81 # var label-stack : (address stack) = new-stack(32*4) # at most 32 levels of nesting + 80 # var line : (stream byte 512) + 81 # var label-stack : (stack address 32) # at most 32 levels of nesting 82 # var next-label-id : int = 1 83 # while true 84 # clear-stream(line) @@ -182,13 +182,13 @@ if ('onhashchange' in window) { 123 57/push-edi 124 # esi = in 125 8b/-> *(ebp+8) 6/r32/esi -126 # var line/ecx : (address stream byte) = stream(512) +126 # var line/ecx : (stream byte 512) 127 81 5/subop/subtract %esp 0x200/imm32 128 68/push 0x200/imm32/length 129 68/push 0/imm32/read 130 68/push 0/imm32/write 131 89/<- %ecx 4/r32/esp -132 # var label-stack/edx : (address stack) +132 # var label-stack/edx : (stack int 32) 133 81 5/subop/subtract %esp 0x80/imm32 134 68/push 0x80/imm32/length 135 68/push 0/imm32/top @@ -219,7 +219,7 @@ if ('onhashchange' in window) { 160 $subx-braces:emit-curly-open: 161 # print(out, "_loop" next-label-id ":") 162 (write-buffered *(ebp+0xc) "_loop") -163 (print-int32-buffered *(ebp+0xc) %ebx) +163 (print-int32-buffered *(ebp+0xc) %ebx) 164 (write-buffered *(ebp+0xc) ":") 165 # push(label-stack, next-label-id) 166 (push %edx %ebx) @@ -236,7 +236,7 @@ if ('onhashchange' in window) { 177 (pop %edx) 178 # print(out, "_break" eax ":") 179 (write-buffered *(ebp+0xc) "_break") -180 (print-int32-buffered *(ebp+0xc) %eax) +180 (print-int32-buffered *(ebp+0xc) %eax) 181 (write-buffered *(ebp+0xc) ":") 182 # continue 183 e9/jump $subx-braces:next-line/disp32 @@ -267,7 +267,7 @@ if ('onhashchange' in window) { 208 (top %edx) 209 # print(out, "_break" eax) 210 (write-buffered *(ebp+0xc) "_break") -211 (print-int32-buffered *(ebp+0xc) %eax) +211 (print-int32-buffered *(ebp+0xc) %eax) 212 # word-slice->start += len("break") 213 81 0/subop/add *edi 5/imm32/strlen 214 # emit rest of word as usual @@ -283,7 +283,7 @@ if ('onhashchange' in window) { 224 (top %edx) 225 # print(out, "_loop" eax) 226 (write-buffered *(ebp+0xc) "_loop") -227 (print-int32-buffered *(ebp+0xc) %eax) +227 (print-int32-buffered *(ebp+0xc) %eax) 228 # word-slice->start += len("loop") 229 81 0/subop/add *edi 4/imm32/strlen 230 # fall through @@ -299,7 +299,7 @@ if ('onhashchange' in window) { 240 # loop to next line 241 e9/jump $subx-braces:line-loop/disp32 242 $subx-braces:break: -243 (flush *(ebp+0xc)) +243 (flush *(ebp+0xc)) 244 $subx-braces:end: 245 # . reclaim locals 246 81 0/subop/add %esp 0x29c/imm32 @@ -322,107 +322,89 @@ if ('onhashchange' in window) { 263 # setup 264 (clear-stream _test-input-stream) 265 (clear-stream _test-output-stream) -266 # . clear-stream(_test-input-buffered-file+4) -267 b8/copy-to-eax _test-input-buffered-file/imm32 -268 05/add-to-eax 4/imm32 -269 (clear-stream %eax) -270 # . clear-stream(_test-output-buffered-file+4) -271 b8/copy-to-eax _test-output-buffered-file/imm32 -272 05/add-to-eax 4/imm32 -273 (clear-stream %eax) -274 # test -275 (write _test-input-stream "== abcd 0x1") -276 (subx-braces _test-input-buffered-file _test-output-buffered-file) -277 # check that the line just passed through -278 (flush _test-output-buffered-file) -279 +-- 5 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------- -284 (check-stream-equal _test-output-stream "== abcd 0x1 \n" "F - test-subx-braces-passes-most-words-through") -285 # . epilogue -286 89/<- %esp 5/r32/ebp -287 5d/pop-to-ebp -288 c3/return -289 -290 test-subx-braces-1: -291 # input: -292 # { -293 # ab break/imm32 -294 # cd loop/imm32 -295 # } +266 (clear-stream _test-input-buffered-file->buffer) +267 (clear-stream _test-output-buffered-file->buffer) +268 # test +269 (write _test-input-stream "== abcd 0x1") +270 (subx-braces _test-input-buffered-file _test-output-buffered-file) +271 # check that the line just passed through +272 (flush _test-output-buffered-file) +273 +-- 5 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------- +278 (check-stream-equal _test-output-stream "== abcd 0x1 \n" "F - test-subx-braces-passes-most-words-through") +279 # . epilogue +280 89/<- %esp 5/r32/ebp +281 5d/pop-to-ebp +282 c3/return +283 +284 test-subx-braces-1: +285 # input: +286 # { +287 # ab break/imm32 +288 # cd loop/imm32 +289 # } +290 # +291 # output: +292 # _loop1: +293 # ab _break1/imm32 +294 # cd _loop1/imm32 +295 # _break1: 296 # -297 # output: -298 # _loop1: -299 # ab _break1/imm32 -300 # cd _loop1/imm32 -301 # _break1: -302 # -303 # . prologue -304 55/push-ebp -305 89/<- %ebp 4/r32/esp -306 # setup -307 (clear-stream _test-input-stream) -308 (clear-stream _test-output-stream) -309 # . clear-stream(_test-input-buffered-file+4) -310 b8/copy-to-eax _test-input-buffered-file/imm32 -311 05/add-to-eax 4/imm32 -312 (clear-stream %eax) -313 # . clear-stream(_test-output-buffered-file+4) -314 b8/copy-to-eax _test-output-buffered-file/imm32 -315 05/add-to-eax 4/imm32 -316 (clear-stream %eax) -317 # test -318 (write _test-input-stream "{\nab break/imm32\ncd loop/imm32\n}") -319 (subx-braces _test-input-buffered-file _test-output-buffered-file) -320 # check that the line just passed through -321 (flush _test-output-buffered-file) -322 +-- 5 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------- -327 (check-stream-equal _test-output-stream "_loop0x00000001:\nab _break0x00000001/imm32 \ncd _loop0x00000001/imm32 \n_break0x00000001:\n" "F - test-subx-braces-1") -328 # . epilogue -329 89/<- %esp 5/r32/ebp -330 5d/pop-to-ebp -331 c3/return -332 -333 test-subx-braces-2: -334 # input: -335 # { -336 # { -337 # ab break/imm32 -338 # } -339 # cd loop/imm32 -340 # } -341 # -342 # output: -343 # _loop1: -344 # _loop2: -345 # ab _break2/imm32 -346 # _break2: -347 # cd _loop1/imm32 -348 # _break1: -349 # -350 # . prologue -351 55/push-ebp -352 89/<- %ebp 4/r32/esp -353 # setup -354 (clear-stream _test-input-stream) -355 (clear-stream _test-output-stream) -356 # . clear-stream(_test-input-buffered-file+4) -357 b8/copy-to-eax _test-input-buffered-file/imm32 -358 05/add-to-eax 4/imm32 -359 (clear-stream %eax) -360 # . clear-stream(_test-output-buffered-file+4) -361 b8/copy-to-eax _test-output-buffered-file/imm32 -362 05/add-to-eax 4/imm32 -363 (clear-stream %eax) -364 # test -365 (write _test-input-stream "{\n{\nab break/imm32\n}\ncd loop/imm32\n}") -366 (subx-braces _test-input-buffered-file _test-output-buffered-file) -367 # check that the line just passed through -368 (flush _test-output-buffered-file) -369 +-- 5 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------- -374 (check-stream-equal _test-output-stream "_loop0x00000001:\n_loop0x00000002:\nab _break0x00000002/imm32 \n_break0x00000002:\ncd _loop0x00000001/imm32 \n_break0x00000001:\n" "F - test-subx-braces-2") -375 # . epilogue -376 89/<- %esp 5/r32/ebp -377 5d/pop-to-ebp -378 c3/return +297 # . prologue +298 55/push-ebp +299 89/<- %ebp 4/r32/esp +300 # setup +301 (clear-stream _test-input-stream) +302 (clear-stream _test-output-stream) +303 (clear-stream _test-input-buffered-file->buffer) +304 (clear-stream _test-output-buffered-file->buffer) +305 # test +306 (write _test-input-stream "{\nab break/imm32\ncd loop/imm32\n}") +307 (subx-braces _test-input-buffered-file _test-output-buffered-file) +308 # check that the line just passed through +309 (flush _test-output-buffered-file) +310 +-- 5 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------- +315 (check-stream-equal _test-output-stream "_loop0x00000001:\nab _break0x00000001/imm32 \ncd _loop0x00000001/imm32 \n_break0x00000001:\n" "F - test-subx-braces-1") +316 # . epilogue +317 89/<- %esp 5/r32/ebp +318 5d/pop-to-ebp +319 c3/return +320 +321 test-subx-braces-2: +322 # input: +323 # { +324 # { +325 # ab break/imm32 +326 # } +327 # cd loop/imm32 +328 # } +329 # +330 # output: +331 # _loop1: +332 # _loop2: +333 # ab _break2/imm32 +334 # _break2: +335 # cd _loop1/imm32 +336 # _break1: +337 # +338 # . prologue +339 55/push-ebp +340 89/<- %ebp 4/r32/esp +341 # setup +342 (clear-stream _test-input-stream) +343 (clear-stream _test-output-stream) +344 (clear-stream _test-input-buffered-file->buffer) +345 (clear-stream _test-output-buffered-file->buffer) +346 # test +347 (write _test-input-stream "{\n{\nab break/imm32\n}\ncd loop/imm32\n}") +348 (subx-braces _test-input-buffered-file _test-output-buffered-file) +349 # check that the line just passed through +350 (flush _test-output-buffered-file) +351 +-- 5 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------- +356 (check-stream-equal _test-output-stream "_loop0x00000001:\n_loop0x00000002:\nab _break0x00000002/imm32 \n_break0x00000002:\ncd _loop0x00000001/imm32 \n_break0x00000001:\n" "F - test-subx-braces-2") +357 # . epilogue +358 89/<- %esp 5/r32/ebp +359 5d/pop-to-ebp +360 c3/return -- cgit 1.4.1-2-gfad0