diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-02-02 08:10:03 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-02-02 08:27:00 -0800 |
commit | f01db8bbc28f3133dd24c01a5ab26bc2f034c8b7 (patch) | |
tree | 132d84a6adc40ab46576262a8dd69fc0c720dfa3 /apps/mu.subx | |
parent | d624175a2afd64c2cace812f871751926023fde8 (diff) | |
download | mu-f01db8bbc28f3133dd24c01a5ab26bc2f034c8b7.tar.gz |
5979
Continuing to think about how to translate vars in a block when they're followed by early exits. To clean up everything between a statement and a target label, we need to know somehow the depth the target is defined at.
Diffstat (limited to 'apps/mu.subx')
-rw-r--r-- | apps/mu.subx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/mu.subx b/apps/mu.subx index e34ce6ac..8732e9d9 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -3300,7 +3300,7 @@ $parse-mu-stmt:abort: cd/syscall 0x80/imm8 # never gets here -add-operation-and-inputs-to-stmt: # stmt: (handle stmt), line: (addr stream byte) +add-operation-and-inputs-to-stmt: # stmt: (handle stmt), line: (addr stream byte), vars: (addr stack (handle var)) # pseudocode: # stmt->name = slice-to-string(next-mu-token(line)) # while true @@ -3337,7 +3337,7 @@ $add-operation-and-inputs-to-stmt:read-inouts: (slice-equal? %ecx "<-") 3d/compare-eax-and 0/imm32 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32 - # if (name starts with "$") treat it as a literal + # if (name starts with "$") it's a label { # var eax: byte = name[0] 8b/-> *ecx 0/r32/eax @@ -3347,6 +3347,7 @@ $add-operation-and-inputs-to-stmt:read-inouts: 3d/compare-eax-and 0x24/imm32/dollar 75/jump-if-!= break/disp8 # var eax: (handle var) + # labels aren't in vars; just create a new record on each use (new-label Heap %ecx) # => eax # stmt->inouts = append(eax, stmt->inouts) (append-list Heap %eax *(edi+8)) # Stmt1-inouts => eax |