Commit graph

187 commits

Author SHA1 Message Date
Ayaz Hafiz
c06ffc434b
Begin generating semantic reprs for records 2023-05-10 15:38:25 -05:00
Ayaz Hafiz
7b2d149deb
Move repr-specific functions to LayoutRepr and impl deref 2023-05-10 15:26:31 -05:00
Ayaz Hafiz
f100e8753c
Introduce the concept of SemanticRepr 2023-05-10 13:51:04 -05:00
Ayaz Hafiz
c3eeb5e2cc
Wrap layouts in a LayoutRepr constructor
Part 1 of support semantic layout representations.
2023-05-10 13:22:10 -05:00
Folkert
f9f4d5eb49
infra for exposed_generic in the dev backend 2023-05-01 18:39:10 +02:00
Folkert
2e6c632fb4
make only used fields pub(crate) 2023-04-28 22:08:55 +02:00
Folkert
b5bd0f4fb0
find extern names using the variables (not layouts) 2023-04-21 18:21:01 +02:00
Folkert
4cd8f0a056 clippy --fix fixes 2023-04-21 12:05:51 +02:00
Folkert
c848a85eb4
fix index bug in recursive decrements 2023-04-17 14:22:27 +02:00
Folkert
e0b5a76a04
correct alignment calculation in RC code 2023-04-17 13:53:54 +02:00
Folkert
92c2931678
make all glue tests run! 2023-04-05 23:19:17 +02:00
Ayaz Hafiz
8ca7f91fcd
Clippy 2023-03-30 18:25:31 -05:00
Ayaz Hafiz
247913dc20
Record all nested recursive structures an entry in the layout cache contains
If an entry in the layout cache contains recursive structures, the entry
is not reusable if the recursive structure is currently in the "seen"
set. The example elucidated in the source code is as follows:

Suppose we are constructing the layout of

```
[A, B (List r)] as r
```

and we have already constructed and cached the layout of `List r`, which would
be

```
List (Recursive [Unit, List RecursivePointer])
```

If we use the cached entry of `List r`, we would end up with the layout

```
Recursive [Unit, (List (Recursive [Unit, List RecursivePointer]))]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cached layout for `List r`
```

but this is not correct; the canonical layout of `[A, B (List r)] as r` is

```
Recursive [Unit, (List RecursivePointer)]
```

However, the current implementation only preserves this behavior for
structures that contain one recursive structure under them. In practice,
there can be structures that contain multiple recursive structures under
them, and we must be sure to record all those structures in the
layout-cache.
2023-03-30 18:15:35 -05:00
Ayaz Hafiz
92657b6f4c
Don't intern recursive unions with pointer-fixing if they've been resolved 2023-03-28 14:49:39 -05:00
Ayaz Hafiz
3f532df981
Generate code for recursive nullable wrapped lambda sets 2023-03-27 10:11:49 -05:00
Folkert
0d4135c57a
Merge remote-tracking branch 'origin/main' into glue-getters-rtfeldman 2023-02-22 21:11:39 +01:00
Folkert de Vries
bd6623dab4
Merge pull request #5055 from roc-lang/abilities-bug-generic
Lambda set compaction must preserve unique specializations of concrete types
2023-02-21 15:24:23 +01:00
Ayaz Hafiz
e5c3376e90
Debug ProcLayouts 2023-02-20 18:49:18 -06:00
Folkert
68524ef07e
generate callers based on layout traversal 2023-02-20 22:05:35 +01:00
Ayaz
b0d3d8fc7c
Merge pull request #5029 from roc-lang/lambda-set-cleanup 2023-02-14 08:51:35 -06:00
Ayaz Hafiz
b11cf19658
Remove unreachable lambda set layout branches
Lambda sets can only appear under function types, so we don't need to
handle them independently in layout gen.
2023-02-13 17:50:24 -06:00
Ayaz Hafiz
a3de22c88a
Do not fixup recursion pointers in non-recursive lambda sets
If a lambda set is non-recursive, but contains naked recursion pointers,
we should not fill those naked pointers in with the slot of the lambda
set during interning. Such naked pointers must belong to an encompassing
lambda set that is in fact recursive, and will be filled in later.

For example, `LambdaSet([Foo, LambdaSet(Bar, [<rec>])] as <rec>)` should
not have the inner lambda set's capture be filled in with itself.

Also, during reification of recursion pointers, we do not need to
traverse re-inserted lambda sets again, since they were just fixed-up.

Closes #5026
2023-02-13 17:14:04 -06:00
Folkert
6c15284a8f
more wip; now we just need to generate the exposed procs at the right time 2023-02-08 22:56:38 +01:00
Joshua Warner
5a6be05ead
implement mono / lowering for tuples 2023-02-07 18:54:50 -08:00
Ayaz Hafiz
8c68044c54
Prime the cache with a default layer 2023-01-30 16:48:01 -06:00
Ayaz Hafiz
a16ea95a04
Always start off with an empty cache
Adding a cache layer can only be done with a snapshot and rollback.
This is necessary to prevent extra variables just lying around on the
toplevel of the layout cache.
2023-01-30 13:08:21 -06:00
Ayaz Hafiz
1e22a2bbcd
Layout-cache variable invalidation must compare by root keys
After unification, variable roots can change. So, when we invalidate
entries in the layout cache, we must compare for variable equivalence
relative to the current state of subs.
2023-01-30 13:06:44 -06:00
Ahmad Sattar
f80edb6ed6
Put list_element_layout! macro into mono 2023-01-28 02:01:02 +01:00
Ayaz Hafiz
478d4a2d44
Support lambda sets with recursive pointers and their equivalence-checking 2023-01-25 17:57:49 -06:00
Ayaz Hafiz
741b1a1bd5
Always show one level of unions when printing layouts 2023-01-25 15:16:06 -06:00
Ayaz
ad84e02abf
Merge pull request #4950 from roc-lang/keep-recptr-index
Initial support for linking recursive pointer layouts back to their source layouts
2023-01-24 14:42:00 -06:00
Ayaz Hafiz
efd7d71dc4
Use Layout::NAKED_RECURSIVE_PTR and update comments 2023-01-23 16:10:54 -06:00
Ayaz Hafiz
37d9307fbf
Call insert_recursive for union layouts 2023-01-23 15:40:40 -06:00
Ayaz Hafiz
8750127111
Begin support for looping-back recursive pointers to their source layouts 2023-01-23 14:37:48 -06:00
Joshua Warner
de828416bf
Initial implementation of tuples in type checking
This leaves in place a bunch of TODOs and likely many bugs - notably, I haven't tested codegen/layout at all here.
2023-01-22 12:40:44 -08:00
Folkert
bb44063419
Merge remote-tracking branch 'origin/main' into glue-getters-rtfeldman 2023-01-18 20:06:26 +01:00
Ayaz
c5788e62c6
Merge branch 'main' into tag-union-ext
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2023-01-16 16:32:02 -06:00
Ayaz Hafiz
ff625397ed
Fix wasm sizeof 2023-01-16 14:26:50 -06:00
Ayaz Hafiz
3109b2b00f
Store args/return layout in the lambda set specialization layout 2023-01-16 12:45:08 -06:00
Ayaz Hafiz
237bb6bcd5
Use env when constructing lambda sets rather than clearing their envs 2023-01-16 12:45:08 -06:00
Ayaz Hafiz
81d2d2923d
Remove lambda set recursion var as appropriate after construction 2023-01-16 12:45:08 -06:00
Ayaz Hafiz
8dc2a5daa7
Store args, return type on lambda set 2023-01-16 12:45:07 -06:00
Ayaz Hafiz
f08a8aa8c7
Fix release build 2023-01-16 10:54:39 -06:00
Ayaz Hafiz
1c93727822
Add a notion of "openness" tag extensions suitable only for size-polymorphism 2023-01-16 10:52:23 -06:00
Ayaz Hafiz
1960f429bd
Cleanup of lints 2023-01-11 14:39:12 -06:00
Ayaz Hafiz
6e0e11ea79
Avoid needless re-entry to the interner 2023-01-11 14:39:12 -06:00
Ayaz Hafiz
9d70c45781
Update wasm backend 2023-01-11 14:38:43 -06:00
Ayaz Hafiz
6859c2e15c
Update dev backend 2023-01-11 14:38:42 -06:00
Ayaz Hafiz
45aa9768f7
Hide lambda set runtime representation 2023-01-11 14:38:42 -06:00
Ayaz Hafiz
fa8effd3e8
Make all layouts interned in mono 2023-01-11 14:38:41 -06:00