diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-02-24 22:46:45 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-02-24 22:46:45 -0800 |
commit | 5f3c324783dd111193a5ae557d9df6abee4f281b (patch) | |
tree | 39d2a8726e89d67e99b54b249b806de4408d542a /apps | |
parent | 08b9511af51c48042f167d83a4bdc38e32fe256b (diff) | |
download | mu-5f3c324783dd111193a5ae557d9df6abee4f281b.tar.gz |
6054
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/mu | bin | 154343 -> 154450 bytes | |||
-rw-r--r-- | apps/mu.subx | 24 |
2 files changed, 21 insertions, 3 deletions
diff --git a/apps/mu b/apps/mu index 228884f6..05dbe434 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx index b2ab76e1..ca4dc4b0 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -2580,7 +2580,7 @@ parse-type: # ad: (address allocation-descriptor), in: (addr stream byte) -> re # result = allocate(Tree) # zero-out(result, *Tree-size) # if s != "(" - # result->left = pos-slice(Type-id, s) + # result->left = pos-or-insert-slice(Type-id, s) # return # result->left = parse-type(ad, in) # result->right = parse-type-tree(ad, in) @@ -2631,8 +2631,8 @@ parse-type: # ad: (address allocation-descriptor), in: (addr stream byte) -> re (slice-equal? %ecx "(") 3d/compare-eax-and 0/imm32/false 75/jump-if-!= break/disp8 - # result->left = pos-slice(Type-id, s) - (pos-slice Type-id %ecx) + # result->left = pos-or-insert-slice(Type-id, s) + (pos-or-insert-slice Type-id %ecx) #? (write-buffered Stderr "=> {") #? (print-int32-buffered Stderr %eax) #? (write-buffered Stderr ", 0}\n") @@ -2891,6 +2891,24 @@ $next-mu-token:end: 5d/pop-to-ebp c3/return +pos-or-insert-slice: # arr: (addr stream (handle array byte)), s: (addr slice) -> index/eax: int + # . prologue + 55/push-ebp + 89/<- %ebp 4/r32/esp + # if (pos-slice(arr, s) != -1) return it + (pos-slice *(ebp+8) *(ebp+0xc)) # => eax + 3d/compare-eax-and -1/imm32 + 75/jump-if-not-equal $pos-or-insert-slice:end/disp8 + # + (slice-to-string Heap *(ebp+0xc)) # => eax + (write-int *(ebp+8) %eax) + (pos-slice *(ebp+8) *(ebp+0xc)) # => eax +$pos-or-insert-slice:end: + # . epilogue + 89/<- %esp 5/r32/ebp + 5d/pop-to-ebp + c3/return + # return the index in an array of strings matching 's' # index is denominated in elements, not bytes pos-slice: # arr: (addr stream (handle array byte)), s: (addr slice) -> index/eax: int |