Commit graph

176 commits

Author SHA1 Message Date
Ayaz Hafiz
aef21741ec
Update mono tests 2023-03-25 16:14:30 -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
5069d926bb
Update mono tests 2023-03-23 10:18:04 -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
Richard Feldman
2276c78d9f
Merge pull request #5093 from roc-lang/glue-getters-rtfeldman
Glue for functions and closures
2023-03-21 08:12:19 -04:00
Ayaz Hafiz
700d2d1b31
Check in mono golden 2023-03-21 07:18:12 -04:00
Seth Workman
29e0673308
update dict.txt 2023-03-17 11:33:39 -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
Brendan Hansknecht
00a3d7b259
update mono tests 2023-03-15 16:44:02 -07:00
Luke Boswell
90dd31aaca
update mono 2023-03-15 18:24:16 +11:00
Brendan Hansknecht
9e2a36f1d4
update mono 2023-03-13 18:03:05 -07:00
Folkert
fdf1489df6
Merge remote-tracking branch 'origin/main' into glue-getters-rtfeldman 2023-03-14 01:01:26 +01:00
Brendan Hansknecht
85306953e9
update mono 2023-03-12 08:42:37 -07:00
Folkert
e9fc9dd3f9
update mono tests 2023-03-08 23:03:32 +01:00
Luke Boswell
5d321e354b
update mono 2023-03-07 17:28:04 +11:00
Ayaz Hafiz
739bdfe64e
Fix a bug in chasing assigned/hole on switch 2023-03-05 22:19:16 -06: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
a2389c7652
Eliminate joinpoints in trivial lambda set switches 2023-03-05 21:59:01 -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
Luke Boswell
ac95c9a71a
update mono tests 2023-03-05 19:05:24 +11:00
Brendan Hansknecht
a86c8d7994
update mono tests 2023-02-27 16:36:08 -08:00
Anton-4
4d91fe01ca
update mono tests 2023-02-24 14:35:05 +01:00
Folkert de Vries
34340de60c
Merge pull request #5020 from roc-lang/dev-unbox-u32
dev backend: reading and writing 32, 16 and 8-bit values
2023-02-21 17:33:21 +01:00
Ayaz Hafiz
fbc75016e1
Check in mono goldens 2023-02-20 19:31:22 -06:00
Folkert
aac8c76c5f
fix mono tests 2023-02-18 16:43:51 +01: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
Joshua Warner
5a6be05ead
implement mono / lowering for tuples 2023-02-07 18:54:50 -08:00
Ayaz Hafiz
478d4a2d44
Support lambda sets with recursive pointers and their equivalence-checking 2023-01-25 17:57:49 -06:00
Folkert de Vries
8e5efe67b4
Merge pull request #4912 from roc-lang/remove-polymorphic-expression-compilation
Rip out polymorphic expression compilation
2023-01-24 21:35:08 +01:00
Brian Carroll
a249e14ee5
builtins: restore nicer hash code for Dict 2023-01-23 22:39:24 +00:00
Ayaz Hafiz
d4e8fe81cb
Update mono tests 2023-01-21 12:37:10 -06:00
Ayaz Hafiz
f0ab9f77ca
Don't mark accessors as thunks 2023-01-21 12:37:09 -06:00
Ayaz Hafiz
36f8ed6478
Rip out polymorphic expression compilation
We no longer need this except for number literals, which are simple to
handle.
2023-01-21 12:37:09 -06:00
Ayaz Hafiz
52063b2df2
Add test to regression-test over-specialization as in #4717 2023-01-18 18:11:59 -06:00
Ayaz Hafiz
9a4e4f25c2
Add regression tests for #4772
Closes #4772
2023-01-18 18:11:57 -06:00
Ayaz Hafiz
e6ab8dcf60
Fix mono test 2023-01-18 10:06:14 -06:00
Ayaz
ed7123ed5b
Merge pull request #4887 from roc-lang/weakening-5
Finish weakening let-bindings
2023-01-17 12:47:12 -06:00
Ayaz Hafiz
1c8cef2547
Update mono 2023-01-16 12:46:40 -06:00
Ayaz Hafiz
011c2ffd47
Add mono tests for function-specialization information preserved in lambda sets 2023-01-16 12:45:08 -06:00
Ayaz Hafiz
48049ed956
Weaken tags behind let bindings 2023-01-16 10:49:17 -06:00
Ayaz Hafiz
52c2f3a054
Weaken zero-argument tags in let bindings 2023-01-16 10:49:16 -06:00
Ayaz Hafiz
b8712bcb30
Weaken records in let-bindings
This change also means we must update the interface of `Dict.empty` and
`Set.empty` from

```
Dict.empty : Dict k v
```

to

```
Dict.empty : {} -> Dict k v
```
2023-01-14 15:33:51 +01:00
Ayaz Hafiz
cb1373a3a4
Weaken let-binding calls 2023-01-14 15:33:49 +01:00
Ayaz Hafiz
b2cdddbdfb
Weaken lists 2023-01-12 10:02:20 -06:00
Folkert
cf15654ee5
implement standard as patterns in mono IR 2023-01-11 14:18:13 +01:00
Ayaz Hafiz
ba2527a020
Check in mono test case 2023-01-09 16:35:25 -06:00
Ayaz
858670fac7
Merge pull request #4833 from roc-lang/intern-layouts
Intern all the layouts
2022-12-29 18:28:44 -06:00
Ayaz Hafiz
3aab378bab
Correct pattern matching of nullable wrapped tag unions
The nullable ID always has zero tags. For everything else, we should
just match with the arity of the number of arguments, which doesn't
include the tag ID.
2022-12-29 12:22:05 -06:00