diff options
-rwxr-xr-x | apps/mu | bin | 199082 -> 199228 bytes | |||
-rw-r--r-- | apps/mu.subx | 44 |
2 files changed, 42 insertions, 2 deletions
diff --git a/apps/mu b/apps/mu index d95c6016..22676861 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx index a5217492..2047868c 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -9840,8 +9840,7 @@ $emit-subx-call-operand:check-for-register-indirect: 81 7/subop/compare *(ecx+8) 0/imm32/false # Stmt-var-is-deref 74/jump-if-= break/disp8 $emit-subx-call-operand:register-indirect: - (write-buffered *(ebp+8) " *") - (write-buffered *(ebp+8) *(esi+0x10)) # Var-register + (emit-subx-call-operand-register-indirect *(ebp+8) %esi) e9/jump $emit-subx-call-operand:end/disp32 } # else if (operand->stack-offset) emit "*(ebp+__)" @@ -9874,6 +9873,47 @@ $emit-subx-call-operand:end: 5d/pop-to-ebp c3/return +emit-subx-call-operand-register-indirect: # out: (addr buffered-file), v: (handle var) + # . prologue + 55/push-ebp + 89/<- %ebp 4/r32/esp + # . save registers + 50/push-eax + 51/push-ecx + 56/push-esi + # esi = v + 8b/-> *(ebp+0xc) 6/r32/esi + # var size/ecx: int = size-of(v) + (size-of %esi) # => eax + # TODO: assert size is a multiple of 4 + # var i/eax: int = 0 + b8/copy-to-eax 0/imm32 + { +$emit-subx-call-operand-register-indirect:loop: + # if (i >= size) break + 39/compare %eax 1/r32/ecx + 7d/jump-if->= break/disp8 + # emit " *(" v->register "+" i ")" + (write-buffered *(ebp+8) " *(") + (write-buffered *(ebp+8) *(esi+0x10)) # Var-register + (write-buffered *(ebp+8) "+") + (print-int32-buffered *(ebp+8) %eax) + (write-buffered *(ebp+8) ")") + # i += 4 + 05/add-to-eax 4/imm32 + # + eb/jump loop/disp8 + } +$emit-subx-call-operand-register-indirect:end: + # . restore registers + 5e/pop-to-esi + 59/pop-to-ecx + 58/pop-to-eax + # . epilogue + 89/<- %esp 5/r32/ebp + 5d/pop-to-ebp + c3/return + emit-subx-var-as-rm32: # out: (addr buffered-file), s: (handle stmt-var) # . prologue 55/push-ebp |