diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-08-03 21:45:41 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-08-03 21:45:41 -0700 |
commit | 208b28303cc2fa55939b06b5effac1cbd69d6356 (patch) | |
tree | c05d475ba5310718d8ccc9e85e59aecf8746021a | |
parent | 672ea33132c3e1870fa50661ded468b1da4f1794 (diff) | |
download | mu-208b28303cc2fa55939b06b5effac1cbd69d6356.tar.gz |
6715
There's a question of how we should match array types with a capacity on ones without. For now we're going to do the simplest possible thing and just make type-match? more robust. It'll always return false if the types don't match exactly. For ignoring capacity we'll rely on the checks of the `address` operation (which don't exist yet). This means we should do this to pass an address to an array to a function f with signature `f (addr array int)`: var a: (array int 3) var b/eax: (addr array int) <- address a f b rather than this: var a: (array int 3) var b/eax: (addr array int 3) <- address a f b Similar reasoning applies to stream types. Arrays and streams are currently the only types that can have an optional capacity.
-rwxr-xr-x | apps/mu | bin | 369145 -> 369174 bytes | |||
-rw-r--r-- | apps/mu.subx | 7 |
2 files changed, 7 insertions, 0 deletions
diff --git a/apps/mu b/apps/mu index 04eefef8..336596d1 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx index 912b2b1f..f1fc3ed7 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -12895,6 +12895,13 @@ $type-component-match?:compare-addr: 39/compare %edx 0/r32/eax # Var-type b8/copy-to-eax 1/imm32/true 0f 84/jump-if-= $type-component-match?:end/disp32 + # if (def == 0) return false + b8/copy-to-eax 0/imm32/false + 81 7/subop/compare %ecx 0/imm32 # Type-tree-is-atom + 0f 84/jump-if-= $type-component-match?:end/disp32 + # if (call == 0) return false + 81 7/subop/compare %edx 0/imm32 # Type-tree-is-atom + 0f 84/jump-if-= $type-component-match?:end/disp32 # if def is a type parameter, just check in type-parameters { $type-component-match?:check-type-parameter: |