Commit graph

302 commits

Author SHA1 Message Date
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
Ayaz Hafiz
dd6a72fc46
Update mono tests
These have changed because of how interned layouts are now sorted.
2022-12-28 18:50:50 -06:00
Ayaz
562a2748cb
Merge branch 'main' into i4732
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2022-12-28 11:56:08 -06:00
Ayaz
b400851586
Merge branch 'main' into i4717
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2022-12-27 18:58:16 -06:00
Ayaz Hafiz
23fc7f1413
Appropriately substitute symbols in switch conditions
Closes #4557
2022-12-27 12:29:23 -06:00
Ayaz Hafiz
a818b810f2
Better name for #4717 repro case 2022-12-27 11:05:12 -06:00
Ayaz Hafiz
7a6e68861c
Account for non-capturing functions in larger lambda sets passed to HOLLs
Previously, if the lambda set passed to a HOLL contained any function
that captured, we would assume that the specialization of the HOLL we
should make for each function in the lambda set that we dispatch to
should capture.

This is not right. Instead, we should specialize for each lambda in the
set passed to the HOLL. The present patch enforces that, making sure
that for each lambda in the set, we compute the exact proc layout needed
to call the lambda, based on the captures of the specific lambda in the
set, rather than looking at the set entirely.
2022-12-27 10:22:18 -06:00
Ayaz Hafiz
1e847efbfe
Correctly choose specialized shapes for anonymous closures 2022-12-27 09:18:41 -06:00
Joshua Warner
8abd5cf605
Fix bug in unification of tag args in polymorphic contexts 2022-12-26 13:01:31 -08:00
Ayaz Hafiz
ec0f1ce757
Update mono test name 2022-12-25 16:56:00 -06:00
Ayaz Hafiz
2a64b18c98
Update mono tests 2022-12-25 16:56:00 -06:00
Ayaz Hafiz
a8693e6102
Order list-min-size tests in descending order
Some of the head-constructor tests we generate can be supersets of other tests.
Edges must be ordered so that more general tests always happen after their
specialized variants.

For example, patterns

  [1, ..] -> ...
  [2, 1, ..] -> ...

may generate the edges

  ListLen(>=1) -> <rest>
  ListLen(>=2) -> <rest>

but evaluated in exactly this order, the second edge is never reachable.
The necessary ordering is

  ListLen(>=2) -> <rest>
  ListLen(>=1) -> <rest>

Closes #4732
2022-12-25 16:55:58 -06:00
Joshua Warner
174f7d5e4d
Fix bug in unifying records
This was leading us to have an infinitely-recursive type, which eventually causes layout to stack-overflow

Fixes #4739
2022-12-17 11:37:19 -08:00
Ayaz Hafiz
5606e2d61e
Update test 2022-12-14 17:15:51 -06:00
Ayaz Hafiz
0a071e2a98
Rename mono test 2022-12-14 17:13:58 -06:00
Ayaz Hafiz
b8aa8df100
Make sure to resolve lambda sets for imported top-levels correctly
Part of #4733
2022-12-14 17:13:43 -06:00
Ayaz Hafiz
ed4e047ee8
Reproduce #4733 2022-12-14 17:12:03 -06:00
Ayaz Hafiz
cec6da19de
Check in mono test 2022-12-14 14:20:10 -06:00
Richard Feldman
da5d0bd815
Merge pull request #4686 from roc-lang/list-range
Switch to more expressive list.range
2022-12-08 02:51:42 -05:00
Ayaz Hafiz
b66813d2db
Check in test for #4705 2022-12-07 10:59:05 -06:00
Ayaz
8ae8857125
Merge pull request #4696 from roc-lang/hash-nat
add the ability to hash Nats
2022-12-05 20:15:21 -06:00
Brendan Hansknecht
b07e4e8170
fix mono 2022-12-05 16:11:10 -08:00
Ayaz Hafiz
759127660d
Spread list tests can never touch exact-sized bounds tests
When compiling a pattern match like

```
[] -> ..
[_] -> ..
[_, ..] -> ..
```

to a decision tree, we must make sure that the last test (len >= 1)
does not touch the branch reached by the second test (len == 1). It is
enough to ban (len >=) tests from ever touching exact-sized list
patterns, because a spread test (len >=) can never reach an exact-sized
test.

On the other hand, an exact-sized test can reach a spread pattern,
because in

```
[_, _] -> ..
[..] -> ..
```

the last branch generates tests for patterns `[]` and `[_]`, and we would
like those patterns to be covered by the spread test (len >= 0)!

Closes #4685
2022-12-05 13:45:35 -06:00
Ayaz Hafiz
b6a96ebb85
Reproduce miscompilation in #4685 2022-12-05 13:14:32 -06:00
Brendan Hansknecht
415cac5179
update mono tests 2022-12-04 21:49:28 -08:00