Commit graph

26 commits

Author SHA1 Message Date
Anton-4
eee85fa45d
moved all crates into seperate folder + related path fixes 2022-07-01 17:37:43 +02:00
Richard Feldman
4eec34becf
Update to use new square brace formatting 2022-05-22 23:15:54 -04:00
Brian Carroll
c27a152059
Fix confusion between isize and usize in mono code_gen_help 2022-05-02 04:28:33 -07:00
Folkert
76754e4d2a
use &str instead of Ident in some key places 2022-04-30 20:43:12 +02:00
Folkert
d3ef35d935
rename 2022-04-26 11:33:26 +02:00
Folkert
af6c3231f3
Improved IdentIds 2022-04-25 23:15:57 +02:00
Brian Carroll
7b96e953ba wasm: Get List.map2 working 2022-04-11 14:36:31 +01:00
Brian Carroll
51789f38c2 wasm: generate RC inc for higher order builtins 2022-04-05 00:02:05 +01:00
Brian Carroll
5de539b9fa mono: Generate IR for refcount reset procedures 2022-03-20 22:48:23 +00:00
Brian Carroll
9b6b81a438 WIP 2022-03-20 11:17:34 +00:00
Brian Carroll
4c7aeb69a4 mono: add rc reset procs to code_gen_help 2022-03-19 09:25:24 +00:00
Folkert
92f2927046
initial implementation 2022-03-08 19:09:42 +01:00
Brian Carroll
ce6d5b1727 mono: Fix recursive union arg layout for calls to helper functions 2022-02-22 23:42:48 +00: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
0ed259a80d phase 3 2022-01-26 14:37:32 +01:00
Brian Carroll
5560ecb63e Implement tail recursion for union refcounting procs 2022-01-06 22:43:02 +00:00
Brian Carroll
456bda0895 Prevent confusion between separate instances of RecursivePointer 2022-01-06 10:49:34 +00:00
Brian Carroll
ad95ea4a3b Remove a debug assert 2022-01-06 10:49:34 +00:00
Brian Carroll
5e642c880c Mask out union tag ID from pointer when calculating refcount address 2022-01-06 10:49:34 +00:00
Brian Carroll
5d7b4018b7 Generate refcounting helper procedures for tag unions 2022-01-05 12:24:04 +00:00
Brian Carroll
1de26c084d Make Struct DecRef a no-op 2022-01-01 21:57:28 +00:00
Brian Carroll
98ab97083a For DecRef, remove assumption that the refcounted symbol is ARG_1 2022-01-01 21:57:28 +00:00
Brian Carroll
176bb6f6aa Use joinpoints for DecRef 2022-01-01 21:57:28 +00:00
Brian Carroll
12a330dd76 Refactor to move all refcount IR gen to the same file 2021-12-31 23:09:11 +00:00
Brian Carroll
c5663e3538 Generate IR helper proc for list refcounting 2021-12-30 17:15:31 +00:00
Brian Carroll
37de499248 Reorganise code gen helper in roc_mono 2021-12-28 11:03:33 +00:00