Commit graph

160 commits

Author SHA1 Message Date
Ayaz Hafiz
44c4797d9a
Parameterize program solving on a FunctionKind
This new flag determines whether we should introduce a new kind to
represent lambda sets, or whether lambdas should be erased. The latter
is not yet implemented.
2023-07-12 13:53:50 -05:00
Folkert
ef39bad7c6
auto clippy fixes 2023-07-10 18:27:08 +02:00
Ayaz Hafiz
a5e1558a6e
Do not drop uninhabited captures from lambda sets
Previously, we would drop uninhabited captures from lambda sets' runtime
representations, which meant sets like

```
[L1 {a: Str}, L2 {a: []}]
```

had runtime representation

```
{Str}
```

rather than

```
Union({Str}, {[]})
```

if we drop unreachable lambdas from the representation, then the
reachable lambdas are somewhat more efficient to compile (as there are
less material tag options), but the compiler complexity increases
because we must represent voided capture sets in the lambda set.

Even if a lambda has voided captures, we must specialize it, because
failing to do so opens us up to losing relevant specializations needed
later on. See 2f7020aa31 for a
previous occurence of that.

As such, simply keep voided layouts in place during lambda set
compilation. The optimizer should elide them anyway.
2023-06-29 17:32:50 -05:00
Folkert
ae47cc5171
in TRMC, still apply normal TCE 2023-06-24 19:45:44 +02:00
Folkert
9c85fb90d3
fix bugs 2023-06-24 14:49:47 +02:00
Folkert
4a9514d2c4
rough implementation 2023-06-24 14:49:46 +02:00
Ayaz Hafiz
c91b82198d
Use correct variable when compiling dbg continuation
Closes #5479
2023-06-13 16:45:02 -05:00
Folkert
ed3551a14c
make more mono tests use larger stack 2023-06-10 23:58:42 +02:00
J.Teeuwissen
46bff75517
progress 2023-06-10 23:55:09 +02:00
J.Teeuwissen
d735742fdb
used resulting incremented_symbols 2023-06-10 23:54:00 +02:00
J.Teeuwissen
94fb89bde4
Start drop specialisation for joinpoints 2023-06-10 23:53:19 +02:00
Luke Boswell
15b7b62c4f
merge remote/main, fix merge conflicts, update mono 2023-06-08 19:41:53 +10:00
Ayaz
c7f5007cd8
Merge pull request #5400 from roc-lang/semantic-layouts-for-newtypes
Implement semantic layouts for newtypes
2023-06-07 05:39:20 -05:00
Ayaz Hafiz
43259b9ad6
Compile dbgs that appear in expects
Closes #5480
2023-06-06 18:07:34 -05:00
Ayaz Hafiz
4e690103b0
Use larger stacks for some mono tests 2023-06-06 16:05:12 -05:00
Luke Boswell
c1ff49be6c
change just Json module name 2023-06-04 17:37:01 +10:00
J.Teeuwissen
93ea086115
Merge branch 'main' into record-update-index-top 2023-05-30 10:47:19 +02:00
J.Teeuwissen
8f022d4310
fixed specialisation box 2023-05-28 21:18:28 +02:00
J.Teeuwissen
d988ab5378
newlines 2023-05-28 20:09:43 +02:00
J.Teeuwissen
6e6e1ce833
Merge remote-tracking branch 'origin/main' into save-construction-children 2023-05-28 20:08:22 +02:00
J.Teeuwissen
378a298b45
move record index to start of update 2023-05-27 14:42:37 +02:00
J.Teeuwissen
b0705a00ad
saved info and added test 2023-05-26 15:56:18 +02:00
J.Teeuwissen
d7304f86e5
allow lowlevel and match 2023-05-24 16:13:24 +02:00
David Smith
7f1a242a7c
Disable some tests in debug failing with stack overflow 2023-05-17 16:33:59 -04:00
Richard Feldman
a6bda6eccf
Merge pull request #5163 from lukewilliamboswell/builtin-json
More tests and updates for Json builtin
2023-05-15 19:08:54 -04:00
Luke Boswell
4d4cfcf981
merge remote/main and update mono tests 2023-05-15 16:51:56 +10:00
J.Teeuwissen
ec731443c4
moved drop specialization up 2023-05-15 00:53:07 +02:00
J.Teeuwissen
d82f3ee09d
Start reuse similar layouts 2023-05-15 00:51:33 +02:00
Ayaz Hafiz
155375062a
Fmt 2023-05-02 10:52:49 -05:00
Ayaz
19c04c69c0
Merge branch 'main' into i5318
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2023-05-01 18:47:56 -05:00
Ayaz Hafiz
a9975b1f7f
Crash at runtime rather than panicking when if condition is erroneous
Closes #5318
2023-05-01 15:48:05 -05:00
Ayaz Hafiz
1916a6dba5
Add mono test for #4770
Closes #4770
2023-05-01 13:14:59 -05:00
Folkert
a332d77756
reinstate test 2023-04-28 22:03:08 +02:00
Luke Boswell
4f22b0747f
mono and update Json.fromUtf8 and Json.toUtf8 to Json.json 2023-04-21 10:57:48 +10: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
2a9e0583bc
Remove inaccurate debug assertion in IR gen
There might be more symbols than field layouts when restructuring a
record if the record is a newtype.

Closes #4759
2023-03-28 15:06:44 -05:00
Ayaz Hafiz
3f532df981
Generate code for recursive nullable wrapped lambda sets 2023-03-27 10:11:49 -05:00
Ayaz Hafiz
b8a0ff8e7c
Add a mono test for recursive lambda sets with late specialization 2023-03-27 10:11:26 -05:00
Richard Feldman
72530916e5
Merge pull request #5204 from roc-lang/i4561
Check in mono test that works now
2023-03-25 21:58:16 -04:00
Ayaz Hafiz
aef21741ec
Update mono tests 2023-03-25 16:14:30 -05:00
Ayaz Hafiz
c13abb03be
Check in mono test that works now
Closes #4561
2023-03-25 15:58:39 -05:00
Ayaz
6b3f3ba1a1
Merge pull request #5167 from roc-lang/fix-closure-captures-recursive
Ensure that closures inside recursive closures capture correctly
2023-03-21 13:53:33 -04:00
Ayaz Hafiz
e8a29d2df4
Ensure that closures inside recursive closures capture correctly
With a code like

```
thenDo = \x, callback ->
    callback x

f = \{} ->
    code = 10u16

    bf = \{} ->
        thenDo code \_ -> bf {}

    bf {}
```

The lambda `\_ -> bf {}` must capture `bf`. Previously, this would not
happen correctly, because we assumed that mutually recursive functions
(including singleton recursive functions, like `bf` here) cannot capture
themselves.

Of course, that premise does not hold in general. Instead, we should have
mutually recursive functions capture the closure (haha, get it) of
values captured by all functions constituting the mutual recursion.
Then, any nested closures can capture outer recursive closures' values
appropriately.
2023-03-20 17:44:59 -04:00
Folkert
3de3937553
disable a test that glue cannot handle 2023-03-13 21:30:12 +01:00
Folkert
fe15a2e79c
Merge remote-tracking branch 'origin/main' into glue-getters-rtfeldman 2023-03-08 19:46:00 +01:00
Ayaz Hafiz
7914b07a2f
Eliminate unneeded joinpoints in union lambda dispatches 2023-03-05 22:10:42 -06:00
Ayaz Hafiz
8e4de80aa9
Add test for enum lambda set elimination 2023-03-05 22:01:50 -06:00
Ayaz Hafiz
7867ffb62b
Rename test 2023-03-05 21:47:06 -06:00
Ayaz Hafiz
fb5ac9fc6e
Check in failing reproduction for #5086 2023-03-05 21:40:10 -06:00
Folkert
454f3c603e
give the new exposed symbols to the surgical linker 2023-02-25 19:35:46 +01:00