diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-11-26 22:11:23 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-11-26 22:11:23 -0800 |
commit | 70187b1c01a0540bc677fbbfeaef129549d3075d (patch) | |
tree | ac869a1cabf2d0bf839cfbe93e22d304662e4693 /apps/mu.subx | |
parent | 55628fb6932c0468ca7f20db6ed3ec454be8c91f (diff) | |
download | mu-70187b1c01a0540bc677fbbfeaef129549d3075d.tar.gz |
5765
A couple more primitives now working. In the process I ran into an issue with some buffer filling up when running ntranslate. Isolating it to survey.subx was straightforward, but --trace ran out of RAM, and --trace --dump ran out of (7GB of) disk. In the end what helped was just repeatedly inserting exits at different points, and I realized there was a magic number that hadn't been turned into a named constant.
Diffstat (limited to 'apps/mu.subx')
-rw-r--r-- | apps/mu.subx | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/apps/mu.subx b/apps/mu.subx index 6385c020..c3a1020a 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -2176,6 +2176,118 @@ test-add-reg-to-reg: 5d/pop-to-ebp c3/return +test-add-reg-to-mem: + # add-to var1 var2/reg + # => + # 01 *(ebp+__) var2 + # + # . prologue + 55/push-ebp + 89/<- %ebp 4/r32/esp + # setup + (clear-stream _test-output-stream) + (clear-stream _test-output-buffered-file->buffer) + # var-var1/ecx : var + 68/push 0/imm32/no-register + 68/push 8/imm32/stack-offset + 68/push 1/imm32/block-depth + 68/push 1/imm32/type-int + 68/push "var1"/imm32 + 89/<- %ecx 4/r32/esp + # var-var2/edx : var in ecx + 68/push "ecx"/imm32/register + 68/push 0/imm32/no-stack-offset + 68/push 1/imm32/block-depth + 68/push 1/imm32/type-int + 68/push "var2"/imm32 + 89/<- %edx 4/r32/esp + # inouts/esi : (list var2) + 68/push 0/imm32/next + 52/push-edx/var-var2 + 89/<- %esi 4/r32/esp + # inouts = (list var1 var2) + 56/push-esi/next + 51/push-ecx/var-var1 + 89/<- %esi 4/r32/esp + # stmt/esi : statement + 68/push 0/imm32/next + 68/push 0/imm32/outputs + 56/push-esi/inouts + 68/push "add-to"/imm32/operation + 68/push 1/imm32 + 89/<- %esi 4/r32/esp + # convert + (emit-subx-statement _test-output-buffered-file %esi 0 Primitives 0) + (flush _test-output-buffered-file) +#? # dump _test-output-stream {{{ +#? (write 2 "^") +#? (write-stream 2 _test-output-stream) +#? (write 2 "$\n") +#? (rewind-stream _test-output-stream) +#? # }}} + # check output + (check-next-stream-line-equal _test-output-stream "01 *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem") + # . epilogue + 89/<- %esp 5/r32/ebp + 5d/pop-to-ebp + c3/return + +test-add-mem-to-reg: + # var1/reg <- add var2 + # => + # 03 *(ebp+__) var1 + # + # . prologue + 55/push-ebp + 89/<- %ebp 4/r32/esp + # setup + (clear-stream _test-output-stream) + (clear-stream _test-output-buffered-file->buffer) + # var-var1/ecx : var in eax + 68/push "eax"/imm32/register + 68/push 0/imm32/no-stack-offset + 68/push 1/imm32/block-depth + 68/push 1/imm32/type-int + 68/push "var1"/imm32 + 89/<- %ecx 4/r32/esp + # var-var2/edx : var + 68/push 0/imm32/no-register + 68/push 8/imm32/stack-offset + 68/push 1/imm32/block-depth + 68/push 1/imm32/type-int + 68/push "var2"/imm32 + 89/<- %edx 4/r32/esp + # inouts/esi : (list var2) + 68/push 0/imm32/next + 52/push-edx/var-var2 + 89/<- %esi 4/r32/esp + # outputs/edi : (list var1) + 68/push 0/imm32/next + 51/push-ecx/var-var1 + 89/<- %edi 4/r32/esp + # stmt/esi : statement + 68/push 0/imm32/next + 57/push-edi/outputs + 56/push-esi/inouts + 68/push "add"/imm32/operation + 68/push 1/imm32 + 89/<- %esi 4/r32/esp + # convert + (emit-subx-statement _test-output-buffered-file %esi 0 Primitives 0) + (flush _test-output-buffered-file) +#? # dump _test-output-stream {{{ +#? (write 2 "^") +#? (write-stream 2 _test-output-stream) +#? (write 2 "$\n") +#? (rewind-stream _test-output-stream) +#? # }}} + # check output + (check-next-stream-line-equal _test-output-stream "03 *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg") + # . epilogue + 89/<- %esp 5/r32/ebp + 5d/pop-to-ebp + c3/return + test-add-literal-to-reg: # var1/eax <- add 0x34 # => |