diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/mu.subx | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/apps/mu.subx b/apps/mu.subx index 553b3a21..76e7c6f3 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -10430,7 +10430,6 @@ emit-subx-function: # out: (addr buffered-file), f: (addr function), err: (addr 50/push-eax 51/push-ecx 52/push-edx - 57/push-edi # initialize some global state c7 0/subop/copy *Curr-block-depth 1/imm32 # Important: keep this in sync with the parse phase c7 0/subop/copy *Curr-local-stack-offset 0/imm32 @@ -10447,13 +10446,10 @@ emit-subx-function: # out: (addr buffered-file), f: (addr function), err: (addr (write-buffered *(ebp+8) %eax) (write-buffered *(ebp+8) ":\n") (emit-subx-prologue *(ebp+8)) - # var outputs/edi: (addr list var) = lookup(f->outputs) - (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax - 89/<- %edi 0/r32/eax # var body/eax: (addr block) = lookup(f->body) (lookup *(ecx+0x18) *(ecx+0x1c)) # Function-body Function-body => eax # - (emit-subx-block *(ebp+8) %eax %edx %edi *(ebp+0x10) *(ebp+0x14)) + (emit-subx-block *(ebp+8) %eax %edx *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) (emit-subx-epilogue *(ebp+8)) # TODO: validate that *Curr-block-depth and *Curr-local-stack-offset have # been cleaned up @@ -10461,7 +10457,6 @@ $emit-subx-function:end: # . reclaim locals 81 0/subop/add %esp 0xc08/imm32 # . restore registers - 5f/pop-to-edi 5a/pop-to-edx 59/pop-to-ecx 58/pop-to-eax @@ -10525,7 +10520,7 @@ $populate-mu-type-offsets-in-inouts:end: 5d/pop-to-ebp c3/return -emit-subx-stmt-list: # out: (addr buffered-file), stmts: (addr list stmt), vars: (addr stack live-var), fn-outputs: (addr list var), err: (addr buffered-file), ed: (addr exit-descriptor) +emit-subx-stmt-list: # out: (addr buffered-file), stmts: (addr list stmt), vars: (addr stack live-var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -10712,7 +10707,7 @@ $emit-subx-stmt-list:end: c3/return # 'later-stmts' includes 'stmt', but will behave the same even without it; reg-var-def stmts are guaranteed not to write to function outputs. -push-output-and-maybe-emit-spill: # out: (addr buffered-file), stmt: (addr reg-var-def), vars: (addr stack (handle var)), later-stmts: (addr list stmt), fn-outputs: (addr list var), err: (addr buffered-file), ed: (addr exit-descriptor) +push-output-and-maybe-emit-spill: # out: (addr buffered-file), stmt: (addr reg-var-def), vars: (addr stack (handle var)), later-stmts: (addr list stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -10741,7 +10736,7 @@ push-output-and-maybe-emit-spill: # out: (addr buffered-file), stmt: (addr reg- # ensure that v is in a register 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register 0f 84/jump-if-= $push-output-and-maybe-emit-spill:abort/disp32 - # var emit-spill?/edx: boolean = not-yet-spilled-this-block? && will-not-write-some-register?(fn-outputs) + # var emit-spill?/edx: boolean = not-yet-spilled-this-block? && will-not-write-some-register?(fn) (not-yet-spilled-this-block? %ecx *(ebp+0x10)) # => eax 89/<- %edx 0/r32/eax 3d/compare-eax-and 0/imm32/false @@ -11219,7 +11214,7 @@ $not-yet-spilled-this-block?:end: c3/return # could the register of 'v' ever be written to by one of the vars in fn-outputs? -will-not-write-some-register?: # v: (addr var), stmts: (addr list stmt), fn-outputs: (addr list var) -> result/eax: boolean +will-not-write-some-register?: # v: (addr var), stmts: (addr list stmt), fn: (addr function) -> result/eax: boolean # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -11247,16 +11242,18 @@ $will-not-write-some-register?:end: 5d/pop-to-ebp c3/return -# return output var with matching register +# return fn output with matching register # always returns false if 'reg' is null -find-register: # fn-outputs: (addr list var), reg: (addr array byte) -> result/eax: (addr var) +find-register: # fn: (addr function), reg: (addr array byte) -> result/eax: (addr var) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # . save registers 51/push-ecx - # var curr/ecx: (addr list var) = fn-outputs + # var curr/ecx: (addr list var) = lookup(fn->outputs) 8b/-> *(ebp+8) 1/r32/ecx + (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax + 89/<- %ecx 0/r32/eax { $find-register:loop: # if (curr == 0) break @@ -12449,7 +12446,7 @@ $emit-get-offset:end: 5d/pop-to-ebp c3/return -emit-subx-block: # out: (addr buffered-file), block: (addr block), vars: (addr stack live-var), fn-outputs: (addr list var), err: (addr buffered-file), ed: (addr exit-descriptor) +emit-subx-block: # out: (addr buffered-file), block: (addr block), vars: (addr stack live-var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp |