Commit graph

400 commits

Author SHA1 Message Date
Folkert
75ab8afc2b
remove optimization when values move between pointers, it was unsound (see comment in source) 2022-03-26 18:50:56 +01:00
Folkert
e6ae01384f
fix applied_tag_function_linked_list 2022-03-26 18:40:51 +01:00
Folkert
8e1e709fc1
pass all string tests 2022-03-26 18:25:20 +01:00
Folkert
8e6b1ff481
more string operations 2022-03-26 18:13:05 +01:00
Folkert
576e02ed85
Str.trim and friends 2022-03-26 18:03:53 +01:00
Folkert
71c11784a0
step 1: Deriv works and has no valgrind problems 2022-03-26 17:56:56 +01:00
Folkert
84c6e741fe
rework how tags are created 2022-03-26 14:09:16 +01:00
Folkert
75c15f9b00
use roc_ helpers for box loading and storing 2022-03-26 13:10:18 +01:00
Folkert
0f3ae18c74
add debug print 2022-03-26 12:54:00 +01:00
Folkert
f132a527c0
rename a function 2022-03-26 12:52:13 +01:00
Folkert
bff4e03867
store string literals (also the struct) as a const value 2022-03-26 12:31:03 +01:00
Folkert
6134e57921
Merge remote-tracking branch 'origin/trunk' into list-str-capacity 2022-03-18 18:13:55 +01:00
ayazhafiz
530fa9943a Generate unsigned div and modulo correctly
Closes #2705
2022-03-13 18:44:38 -05:00
Folkert
8488390a9b
fix RocStr/RocList C argument passing 2022-03-13 00:12:47 +01:00
Folkert
d7a5cd7b11
some debugging niceties 2022-03-13 00:12:16 +01:00
Folkert
39792ccb93
accept output parameter as first argument 2022-03-13 00:11:57 +01:00
Folkert
f66b111c7a
create small strings with fewer instructions 2022-03-13 00:06:13 +01:00
Folkert
4e22ae57cd
make specific twice_ptr_width helper 2022-03-12 19:57:26 +01:00
Brian Carroll
456d8ff9cb Merge branch 'trunk' of github.com:rtfeldman/roc into list-str-capacity 2022-03-11 19:28:13 +00:00
Brendan Hansknecht
cdf19e3feb
Merge pull request #2698 from rtfeldman/i/2696
Make sure casting to unsigned types performs zero-extension
2022-03-10 20:10:33 -08:00
ayazhafiz
a90bba3d1d Make sure casting to unsigned types performs zero-extension
Closes #2696
2022-03-10 17:39:37 -06:00
Folkert
e90c12ba1f
Merge remote-tracking branch 'origin/trunk' into box-all-the-things 2022-03-10 18:01:09 +01:00
Folkert de Vries
7fc1272840
Merge pull request #2692 from rtfeldman/walk-return-tag
`List.walk` return tag
2022-03-10 10:12:42 +01:00
Folkert
de6349fbbd
don't double-alloca non-recursive tags 2022-03-09 22:54:56 +01:00
Folkert
29e053abf3
clarify basic_type_from_layout function 2022-03-09 19:01:03 +01:00
Folkert
5d15166bb5
rename 2022-03-09 16:33:36 +01:00
Folkert
07063a8e18
Merge remote-tracking branch 'origin/trunk' into list-str-capacity 2022-03-09 14:36:34 +01:00
Folkert
6543c9bbc6
Merge remote-tracking branch 'origin/trunk' into box-all-the-things 2022-03-09 00:00:15 +01:00
Folkert
4cca0b3b3c
llvm codegen 2022-03-08 22:21:03 +01:00
Derek Gustafson
78cf0b8d2e
Fix fmt. 2022-03-07 15:49:09 -05:00
Derek Gustafson
ba6b225761
Hide RocDec implemntation details. 2022-03-07 15:34:02 -05:00
Folkert
b3b3b8790c
add new Expr variants 2022-03-07 21:13:48 +01:00
Folkert
3510bad1d5
add scaffolding 2022-03-07 20:55:40 +01:00
Brian Carroll
f2adf71873 Move alias analysis to its own crate instead of roc_mono
Shrinks roc_repl_wasm by 400kB (~8%)
2022-03-04 14:50:02 +00:00
Brendan Hansknecht
2e70bb8458 remove list set low level 2022-02-27 15:07:09 -08:00
Brendan Hansknecht
b802d681a3 Merge remote-tracking branch 'origin/trunk' into list-replace 2022-02-27 00:28:08 -08:00
Brendan Hansknecht
7c6c9b52a9 Merge remote-tracking branch 'origin/trunk' into list-replace 2022-02-25 07:35:00 -08:00
Richard Feldman
a49b66e379
Merge branch 'trunk' into gui-example 2022-02-25 08:22:36 -05:00
Brendan Hansknecht
dddf8ff785 switch from pair to record and change name to ListReplaceUnsafe 2022-02-24 20:41:26 -08:00
Brendan Hansknecht
ba2e8cd32b Add base piping for list.Replace 2022-02-24 17:58:56 -08:00
Brendan Hansknecht
69b4e78ac7 Add --opt-size and compiling smaller binaries 2022-02-24 15:39:50 -08:00
Richard Feldman
655373dbe7
Merge remote-tracking branch 'origin/trunk' into gui-example 2022-02-23 21:25:01 -05:00
ayazhafiz
2151e715dd Fix rebased compile error 2022-02-21 14:12:49 -05:00
ayazhafiz
e52d427ac8 Hash record field name order in generated layouts
Closes #2535

See the referenced issue for longer discussion - here's the synopsis.
Consider this program

```
app "test" provides [ nums ] to "./platform"

alpha = { a: 1, b: 2 }

nums : List U8
nums =
    [
        alpha.a,
        alpha.b,
    ]
```

Here's its IR:

```
procedure : `#UserApp.alpha` {I64, U8}
procedure = `#UserApp.alpha` ():
    let `#UserApp.5` : Builtin(Int(I64)) = 1i64;
    let `#UserApp.6` : Builtin(Int(U8)) = 2i64;
    let `#UserApp.4` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = Struct {`#UserApp.5`, `#UserApp.6`};
    ret `#UserApp.4`;

procedure : `#UserApp.nums` List U8
procedure = `#UserApp.nums` ():
    let `#UserApp.7` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = CallByName `#UserApp.alpha`;
    let `#UserApp.1` : Builtin(Int(U8)) = StructAtIndex 1 `#UserApp.7`;
    let `#UserApp.3` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = CallByName `#UserApp.alpha`;
    let `#UserApp.2` : Builtin(Int(U8)) = StructAtIndex 1 `#UserApp.3`;
    let `#UserApp.0` : Builtin(List(Builtin(Int(U8)))) = Array [`#UserApp.1`, `#UserApp.2`];
    ret `#UserApp.0`;
```

What's happening is that we need to specialize `alpha` twice - once for the
type of a narrowed to a U8, another time for the type of b narrowed to a U8.

We do the specialization for alpha.b first - record fields are sorted by
layout, so we generate a record of type {i64, u8}. But then we go to
specialize alpha.a, but this has the same layout - {i64, u8} - so we reuse
the existing one! So (at least for records), we need to include record field
order associated with the sorted layout fields, so that we don't reuse
monomorphizations like this incorrectly!
2022-02-21 14:10:45 -05:00
Folkert
3e413764e2
make llvm gen tests work 2022-02-20 14:25:26 +01:00
Folkert
177529bfb6
all string tests passing 2022-02-20 13:04:12 +01:00
Folkert
1c0d092c48
fix str_to_utf8 2022-02-20 01:10:09 +01:00
Folkert
dea6cfbc8f
various fixes 2022-02-20 00:20:50 +01:00
ayazhafiz
13067f2908 Implement Num.toNNNChecked
Closes #2411
2022-02-19 16:20:21 -05:00
ayazhafiz
d90915a8cd Implement Num.to* builtins
Just wrap over Num.intCast
2022-02-19 11:28:41 -05:00