Commit graph

1161 commits

Author SHA1 Message Date
Folkert
b7119e9b3a
return record containing function 2023-04-03 23:45:30 +02:00
J.Teeuwissen
9aed9d3a31
Typos 2023-04-03 10:26:35 +02:00
J.Teeuwissen
39d90a240d
Merge branch 'joinpoint-reuse' into Frame-Limited 2023-04-03 10:04:43 +02:00
J.Teeuwissen
87abe8df7d
Merge branch 'resetref' into Frame-Limited 2023-04-03 10:02:31 +02:00
J.Teeuwissen
fd3f58b4a1
Propagate body jump tokens 2023-04-02 20:22:56 +02:00
J.Teeuwissen
12352ceb6a
updated match 2023-03-31 21:12:40 +02:00
J.Teeuwissen
018e142997
merge remainders 2023-03-31 21:11:13 +02:00
J.Teeuwissen
fbd243e28c
null pointer 2023-03-31 21:09:59 +02:00
J.Teeuwissen
48a44222bb
void pointer 2023-03-31 21:02:32 +02:00
J.Teeuwissen
c2ddb971f4
Merge branch 'Frame-Limited' into joinpoint-reuse 2023-03-31 20:47:22 +02:00
J.Teeuwissen
7759ce6fc4
Merge branch 'main' into Frame-Limited 2023-03-31 20:46:39 +02:00
Folkert de Vries
305753b4a7
Merge pull request #5239 from roc-lang/layout-cache-structure-with-multiple-recursive-structures
Record all nested recursive structures an entry in the layout cache contains
2023-03-31 17:54:48 +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
J.Teeuwissen
7136750ee1
Merge errors 2023-03-30 20:44:33 +02:00
J.Teeuwissen
36f4969a5c
Merge branch 'Frame-Limited' into joinpoint-reuse 2023-03-30 20:38:30 +02:00
J.Teeuwissen
9b410694fe
Merge branch 'main' into Frame-Limited 2023-03-30 20:38:05 +02:00
Folkert
09779f65ad
add NullPointer to mono::ir::Expr 2023-03-30 20:18:04 +02:00
J.Teeuwissen
9b0daebf3c
unique symbols 2023-03-30 13:10:44 +02:00
J.Teeuwissen
ac255f8d8f
progress joinpoint reuse 2023-03-30 11:18:07 +02:00
J.Teeuwissen
9e8b1c0dee
reset ref implementation 2023-03-30 09:30:09 +02:00
J.Teeuwissen
aa7585e160
More progress on reuse for join points 2023-03-29 16:14:36 +02:00
J.Teeuwissen
d4ed6f7778
start resetref 2023-03-29 11:57:13 +02:00
J.Teeuwissen
3b083aebf6
start reuse 2023-03-29 11:07:49 +02:00
Folkert de Vries
294d32f62b
Merge pull request #5221 from roc-lang/fixes-for-nick
Fix a couple bugs Nick Hallstrom ran into
2023-03-29 01:34:17 +02: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
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
J.Teeuwissen
61efec6fe2
params for joinpoint body 2023-03-26 11:36:08 +02:00
Ayaz
eadbb4eddd
Merge pull request #5202 from roc-lang/i5176
Compilation of when expressions with redundant branches and guards
2023-03-25 20:02:22 -05:00
Ayaz
8c55e8126d
Merge pull request #5203 from roc-lang/virtual-dom-annotations
Fix a few bugs Virtual-DOM cropped up
2023-03-25 20:00:51 -05:00
Ayaz Hafiz
5e950134c3
Clippy 2023-03-25 17:06:41 -05:00
Ayaz Hafiz
93dc3714de
Use an iterator to walk over pattern bindings 2023-03-25 17:03:34 -05:00
Ayaz Hafiz
f75248d206
Factor out mono literal and pattern into smaller crates 2023-03-25 16:33:55 -05:00
Ayaz Hafiz
01c15c0648
Use empty slices 2023-03-25 16:15:13 -05:00
Ayaz Hafiz
570876129b
Format 2023-03-25 16:14:31 -05:00
Ayaz Hafiz
dd55be6142
Handle guards that appear multiple times in a compiled decision tree
Suppose we have a when expression

```
15 if foo -> <b1>
b  if bar -> <b2>
_         -> <b3>
```

that may have a decision tree like

```
15?
  \true => foo?
              \true  => <b1>
              \false => bar?
                           \true  => <b2>
                           \false => <b3>
  \false => bar?
               \true  => <b2>
               \false => <b3>
```

In this case, the guard "bar?" appears twice in the compiled decision
tree. We need to materialize the guard expression in both locations in
the compiled tree, which means we cannot as-is stamp a compiled `bar?`
twice in each location. The reason is that

- the compiled joinpoint for each `bar?` guard needs to have a unique ID
- the guard expression might have call which needs unique call spec IDs,
  or other joins that need unique joinpoint IDs.

So, save the expression as we build up the decision tree and materialize
the guard each time we need it. In practice the guards should be quite
small, so duplicating should be fine. We could avoid duplication, but
it's not clear to me how to do that exactly since the branches after the
guard might end up being different.
2023-03-25 16:14:21 -05:00
Ayaz Hafiz
f3ddc254c1
Update comment 2023-03-25 16:14:21 -05:00
Ayaz Hafiz
ecad660e7f
Ensure that when jumping to a branch, all pattern symbols are loaded
If we are jumping to a target branch, it is necessary that the target
branch has all required pattern symbols loaded in it. Usually this is
already the case, but there is an exception with guarded patterns.
Guarded patterns have their patterns loaded only right before the guard
is evaluated, which happens at some point further along the decision
tree. As such, when a guarded pattern jumps to its target destination,
it should append the loaded patterns as parameters on the target
joinpoint.
2023-03-25 16:14:21 -05:00
Ayaz Hafiz
393250db92
Utility to collect symbols bound by a pattern 2023-03-25 16:14:21 -05:00
Ayaz Hafiz
fe9be63787
Utility to substitute many symbols at once 2023-03-25 16:14:20 -05:00
Ayaz Hafiz
f3d1582a5e
More debugging for missing lambda sets 2023-03-25 15:01:41 -05:00
J.Teeuwissen
93d0e2cc31
joinpoint default 2023-03-25 14:52:07 +01:00
J.Teeuwissen
386cd70181
retain non empty 2023-03-25 13:57:01 +01:00
J.Teeuwissen
209370623d
removed comment 2023-03-25 11:57:34 +01:00
J.Teeuwissen
ca767bf385
matching closure_arguments 2023-03-23 10:59:46 +01:00
J.Teeuwissen
675109eda1
reuse join points 2023-03-23 09:18:51 +01:00
Ayaz Hafiz
e6094df69b
Fast-path for determining ability member impls for builtin opaques 2023-03-22 17:08:41 -05:00
Anton-4
f1b1aa6a7b
Merge branch 'main' of github.com:roc-lang/roc into glue-getters-rtfeldman 2023-03-17 11:34:29 +01:00
J.Teeuwissen
32d0d525aa
increment when creating reference 2023-03-16 15:07:45 +01:00