Commit graph

244 commits

Author SHA1 Message Date
Brendan Hansknecht
6dc5bfb1b7
Use roc_target over target_lexicon
Tailors a target class for our needs.
Replaces tons of uses across the entire compiler.
This is a base for later adding new targets like thumb.
2024-03-31 10:50:26 -07:00
Richard Feldman
e06b134228
Fix the TagOrClosure case 2024-03-11 10:58:38 +02:00
Folkert
d95bc02145
WIP 2024-03-11 10:58:36 +02:00
Richard Feldman
204cee7d60
Clean up more unused Nat stuff 2024-01-26 16:23:21 -05:00
Richard Feldman
76dcbee25f
Drop unused target_info from layout 2024-01-26 16:23:21 -05:00
Richard Feldman
c4497f2c1c
Remove Nat from Num 2024-01-26 16:19:51 -05:00
Folkert
6ab54c02e2
drop into_iter in some places 2023-10-07 19:11:36 +02:00
Folkert
e850f94d05
a proper fix for llvm wasm checked arithmetic 2023-09-15 14:53:00 +02:00
Richard Feldman
2ebc1c415e
Default decimal literals to Dec, not F64 2023-09-13 20:24:14 +02:00
Richard Feldman
995c985fbe
Give up on exhaustively enumerating aliases
Keep getting errors in the build ruby example on
Json, and it doesn't tell me the name of the
symbol, just the IdentId, which makes this
really hard to track down.

This approach works fine, it'll just be harder
to debug the next time we run into a special
case like ElemWalker.
2023-08-14 19:00:37 -04:00
Richard Feldman
83ead6b2b2
Special-case TotallyNotJson types for now 2023-08-14 18:58:50 -04:00
Richard Feldman
5d6c787deb
Special-case layout conversions for builtin alias 2023-08-14 14:58:28 -04:00
Folkert
334253f47f
check inside a lambda set for whether it is reference counted 2023-07-26 20:06:37 +02:00
Ayaz
b36ad76cdd
Merge pull request #5576 from roc-lang/spike-erasure
Implement function erasure
2023-07-17 03:27:29 -05:00
Folkert
48fa4f7a8e
When possible, prefer NonNullableUnwrapped over NullableWrapped
e.g. in the scenario of `[ A Str, B, C, D ]`, rather than having one tag be nullable, we want
to store the tag id in the pointer. This generally saves 8 bytes for
every allocation, and prevents an allocations for all tags except A.
2023-07-16 20:06:46 +02:00
Ayaz Hafiz
8d9c6d09b9
Load as a stack pointer 2023-07-12 14:46:11 -05:00
Ayaz Hafiz
13d1232f7d
Erased functions do not take a func spec 2023-07-12 14:44:17 -05:00
Ayaz Hafiz
cd64134b0a
Allow direct packing, unpacking of erased types 2023-07-12 14:43:25 -05:00
Ayaz Hafiz
dc56a0ffef
First pass update erasure IR 2023-07-12 14:43:24 -05:00
Ayaz Hafiz
7ea85e44d2
Add Layout::Erased 2023-07-12 14:43:24 -05:00
Ayaz Hafiz
fbad6bcb90
First pass at specialized erased 2023-07-12 14:21:28 -05:00
Ayaz Hafiz
d17d8c72ad
Exercise building erased function 2023-07-12 14:21:28 -05:00
Ayaz Hafiz
63db2c0eea
Add erased layout 2023-07-12 14:17:57 -05:00
Ayaz Hafiz
a6bb3ab03c
Get started on calling erased functions 2023-07-12 14:14:25 -05:00
Ayaz Hafiz
6312d75ee0
Add FunctionPointer layout 2023-07-12 13:59:50 -05:00
Ayaz Hafiz
a9e3f967a8
First pass at erased function layouts 2023-07-12 13:57:19 -05:00
Ayaz Hafiz
6e5a308557
Content variant ErasedLambda 2023-07-12 13:57:17 -05:00
Ayaz Hafiz
c459757062
Thread simple model of "ErasedLambdas" through proc layouts
But none of these paths are yet exercised.
2023-07-12 13:53:52 -05:00
Folkert
ef39bad7c6
auto clippy fixes 2023-07-10 18:27:08 +02:00
Folkert
6d2d65bb1e
remove Boxed layout 2023-07-09 15:47:28 +02:00
Folkert
a9813aeae7
use a NonNullableUnwrapped union for Box 2023-07-09 15:47:27 +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
654cf7b861
changes after review 2023-06-24 14:49:57 +02:00
Folkert
7637506037
skip is_null check if possible 2023-06-24 14:49:49 +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
Folkert
17512873e8
add LayoutRepr::Ptr 2023-06-24 14:49:45 +02:00
Ayaz Hafiz
ee25735731
LayoutIds use LayoutRepr 2023-06-17 18:13:02 -05:00
Ayaz Hafiz
bc41db2a34
Get rid of passing target_info a bunch 2023-06-17 18:13:00 -05:00
Ayaz Hafiz
314cc7855a
Revert "Check if benchmarks are weird"
This reverts commit 24e7a56f4b.
2023-06-16 15:26:02 -05:00
Ayaz Hafiz
24e7a56f4b
Check if benchmarks are weird 2023-06-16 14:49:01 -05:00
Ayaz Hafiz
5b0d47c9eb
Drop Layout::alignment_bytes_for_llvm 2023-06-16 10:30:44 -05:00
Ayaz Hafiz
2294f6994f
TERRIBLE HACK to support x86 compilation 2023-06-16 10:30:44 -05:00
Ayaz Hafiz
47fb9fe6f2
Implement struct-by-reference for structs over 4 machine words 2023-06-16 10:30:40 -05:00
Folkert
59da1ea891
consistently name function symbols
previously the dev backend did not take into account lambda name information to generate function names. This could cause the same function name to be defined twice
2023-06-11 13:39:43 +02:00
Ayaz Hafiz
80a98668d5
Fix type errors 2023-06-06 16:07:51 -05:00
Ayaz Hafiz
a6b3656471
Begin generating newtype wrappers for struct layouts 2023-06-06 16:04:41 -05:00
Ayaz Hafiz
5274dbcd00
Add a Newtype variant to LayoutWrapper 2023-06-06 16:03:52 -05:00
Ayaz Hafiz
457cdabc5c
Make repr private and accessible only via the interner 2023-06-06 16:01:27 -05:00
Ayaz Hafiz
a67c148be7
Convert LayoutRepr::Struct into a tuple variant 2023-05-16 11:58:16 -05:00