Commit graph

30 commits

Author SHA1 Message Date
Folkert
29e053abf3
clarify basic_type_from_layout function 2022-03-09 19:01:03 +01:00
Folkert
5d15166bb5
rename 2022-03-09 16:33:36 +01:00
ayazhafiz
e52d427ac8 Hash record field name order in generated layouts
Closes #2535

See the referenced issue for longer discussion - here's the synopsis.
Consider this program

```
app "test" provides [ nums ] to "./platform"

alpha = { a: 1, b: 2 }

nums : List U8
nums =
    [
        alpha.a,
        alpha.b,
    ]
```

Here's its IR:

```
procedure : `#UserApp.alpha` {I64, U8}
procedure = `#UserApp.alpha` ():
    let `#UserApp.5` : Builtin(Int(I64)) = 1i64;
    let `#UserApp.6` : Builtin(Int(U8)) = 2i64;
    let `#UserApp.4` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = Struct {`#UserApp.5`, `#UserApp.6`};
    ret `#UserApp.4`;

procedure : `#UserApp.nums` List U8
procedure = `#UserApp.nums` ():
    let `#UserApp.7` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = CallByName `#UserApp.alpha`;
    let `#UserApp.1` : Builtin(Int(U8)) = StructAtIndex 1 `#UserApp.7`;
    let `#UserApp.3` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = CallByName `#UserApp.alpha`;
    let `#UserApp.2` : Builtin(Int(U8)) = StructAtIndex 1 `#UserApp.3`;
    let `#UserApp.0` : Builtin(List(Builtin(Int(U8)))) = Array [`#UserApp.1`, `#UserApp.2`];
    ret `#UserApp.0`;
```

What's happening is that we need to specialize `alpha` twice - once for the
type of a narrowed to a U8, another time for the type of b narrowed to a U8.

We do the specialization for alpha.b first - record fields are sorted by
layout, so we generate a record of type {i64, u8}. But then we go to
specialize alpha.a, but this has the same layout - {i64, u8} - so we reuse
the existing one! So (at least for records), we need to include record field
order associated with the sorted layout fields, so that we don't reuse
monomorphizations like this incorrectly!
2022-02-21 14:10:45 -05:00
Folkert
40246607aa update inkwell to ease the llvm13 transition 2021-12-08 19:36:29 +01:00
Folkert
79d5c82dfb cleanup 2021-11-27 16:36:43 +01:00
Folkert
a1fd34feef remove empty layout types (list,str,dict,set) 2021-11-27 14:05:16 +01:00
Folkert
7d231f87cd remove usize llvm gen 2021-11-21 13:24:53 +01:00
Folkert
123c963ff1 llvm build working 2021-11-21 00:23:59 +01:00
Folkert
c4ec9aa898 working mono 2021-11-20 23:25:30 +01:00
Folkert
8266284567 clippy 2021-11-08 22:31:08 +01:00
Folkert
bd0f02c542 another waypoint 2021-11-06 19:27:16 +01:00
Brendan Hansknecht
0c6f8f308f Remove f16. It is not really supported by modern CPU hardware. 2021-09-21 16:51:47 -07:00
Folkert
350891468a add LambdaSet layout variant 2021-09-12 17:00:09 +02:00
Folkert
ce6ab15139 use usize instead of i64 in hash and compare 2021-08-25 20:47:03 +02:00
Folkert
c09b3b89f3 test_gen works again 2021-08-18 13:46:09 +02:00
Folkert
ceb5cc66fa use IdentStr 2021-08-03 21:14:36 +02:00
Folkert
899cbeabd7 fix extra ampersands 2021-07-29 17:32:08 +02:00
Folkert
cb42f0c039 Merge remote-tracking branch 'origin/trunk' into add-dec-types 2021-07-18 16:54:38 +02:00
Folkert
c57913f767 fix hash and compare 2021-07-17 22:00:57 +02:00
Folkert
0171fd0959 remove Boxed 2021-07-14 15:33:59 +02:00
Folkert
09f01ba193 Boxed skeleton 2021-07-12 17:01:53 +02:00
Jared Ramirez
67eef2c97f Merge branch 'trunk' of https://github.com/rtfeldman/roc into add-dec-types 2021-07-08 16:47:42 -07:00
Folkert
978cea4b8a passing tests 2021-06-28 22:28:47 +02:00
Folkert
3e53f0a14d cleanup 2021-06-27 20:37:44 +02:00
Folkert
16f6259f7f fix all the things 2021-06-27 14:39:28 +02:00
Folkert
98a9dc0945 remove tag id from data bytes for non-recursive tags 2021-06-26 17:01:23 +02:00
Jared Ramirez
ecb89da7b8 Add basic Dec operations 2021-06-25 10:25:03 -07:00
Jared Ramirez
4d6e5a1a4f [WIP] Add Dec/Decimal builtin types 2021-06-23 19:30:16 -07:00
Folkert
f2f9897187 remove FunctionPointer completely 2021-06-19 15:04:28 +02:00
Richard Feldman
57676057fa Rename gen to gen_llvm
This way, we have gen_dev and gen_llvm representing the two
different compiler backends.
2021-06-06 07:56:47 -04:00
Renamed from compiler/gen/src/llvm/compare.rs (Browse further)