Brian Carroll
448140d223
wasm: refactor to prepare for HigherOrder calls
2022-04-05 00:01:11 +01:00
Folkert
c73c01aa34
Merge remote-tracking branch 'origin/trunk' into list-str-capacity
2022-03-30 14:07:17 +02:00
Folkert
877b9eab7a
Merge remote-tracking branch 'origin/trunk' into builtins-in-roc
2022-03-23 17:33:58 +01:00
Brian Carroll
3c9d624a73
Merge pull request #2757 from rtfeldman/fix_shift_filling
...
Fix (flip) `Num.shiftRight*` builtins
2022-03-23 00:07:19 +00:00
Brian Carroll
24e6cd80e7
wasm: fix argument order for shiftRightBy & disable tests with 8-bit values
2022-03-22 22:28:18 +00:00
Folkert
7b221d6115
Merge branch 'simplify-identids' into builtins-in-roc
2022-03-22 22:25:55 +01:00
Folkert de Vries
5e9e7f3ad5
Merge pull request #2760 from rtfeldman/wasm-reset-reuse
...
Wasm reset & reuse
2022-03-21 23:02:28 +01:00
Brian Carroll
1f82310832
wasm: Add support for Expr::Reuse
2022-03-20 23:01:54 +00:00
Brian Carroll
5de539b9fa
mono: Generate IR for refcount reset procedures
2022-03-20 22:48:23 +00:00
Folkert
6a9b08ed11
Merge remote-tracking branch 'origin/trunk' into builtins-in-roc
2022-03-20 13:01:00 +01:00
Brian Carroll
9b6b81a438
WIP
2022-03-20 11:17:34 +00:00
Brian Carroll
c9efeed17e
wasm: add support for Expr::Reset
2022-03-19 09:37:45 +00:00
Brian Carroll
bb62571e3a
wasm: reorder some code
2022-03-19 09:27:17 +00:00
Folkert
4e1197165b
Merge remote-tracking branch 'origin/trunk' into builtins-in-roc-delayed-alias
2022-03-18 21:25:52 +01:00
Folkert
6134e57921
Merge remote-tracking branch 'origin/trunk' into list-str-capacity
2022-03-18 18:13:55 +01:00
Brian Carroll
136b42cbeb
formatting
2022-03-18 15:17:45 +00:00
Brian Carroll
21ee531e8c
wasm: Add Roc procedure names to Names section for debug
2022-03-18 14:46:53 +00:00
Brian Carroll
1afada4075
wasm: fix panic on empty Struct expression
2022-03-12 09:30:27 +00:00
Brendan Hansknecht
bc492fa22b
run cargo fmt
2022-03-11 19:29:34 -08:00
Brian Carroll
456d8ff9cb
Merge branch 'trunk' of github.com:rtfeldman/roc into list-str-capacity
2022-03-11 19:28:13 +00:00
Brian Carroll
ad5da76588
wasm: fix remaining tests for capacity
2022-03-11 19:20:57 +00:00
Brian Carroll
20f6330f72
wasm: Fix Str.isEmpty for capacity
2022-03-10 06:59:15 +00:00
Brian Carroll
0c6fef0ba3
wasm: Generate Str literals with capacity
2022-03-09 21:18:30 +00:00
Folkert
574f14522d
placeholders in the wasm code
2022-03-09 00:04:23 +01:00
Folkert
6543c9bbc6
Merge remote-tracking branch 'origin/trunk' into box-all-the-things
2022-03-09 00:00:15 +01:00
Folkert
831a90e310
Merge remote-tracking branch 'origin/trunk' into builtins-in-roc
2022-03-08 22:36:06 +01:00
Folkert
92f2927046
initial implementation
2022-03-08 19:09:42 +01:00
Brian Carroll
70804e9bec
Merge branch 'trunk' of github.com:rtfeldman/roc into wasm-runtime-error
2022-03-08 08:58:15 +00:00
Brian Carroll
9ae26c5aac
wasm: use __data_end to account for all constant data including zero (bss) data
2022-03-08 08:56:34 +00:00
Derek Gustafson
ba6b225761
Hide RocDec implemntation details.
2022-03-07 15:34:02 -05:00
Folkert
3510bad1d5
add scaffolding
2022-03-07 20:55:40 +01:00
Folkert
adf4ad22a5
Merge remote-tracking branch 'origin/trunk' into builtins-in-roc
2022-03-05 20:55:15 +01:00
Brian Carroll
770155312c
Merge branch 'trunk' of github.com:rtfeldman/roc into wasm-runtime-error
2022-03-04 21:22:08 +00:00
Brian Carroll
20e46fbda4
wasm: address PR feedback
2022-03-04 19:12:18 +00:00
Brian Carroll
5882ee4af0
wasm: add comment on why DataSection::bytes is public
2022-03-02 08:03:00 +00:00
Brendan Hansknecht
0ae0e689fc
Merge pull request #2602 from rtfeldman/list-replace
...
List replace
2022-03-01 23:29:32 +00:00
Brian Carroll
9bf0fdb808
Fix clippy errors
2022-03-01 22:04:29 +00:00
Brian Carroll
21a3ed4258
wasm: fix dead code elimination in the case where there are live imports
2022-02-28 21:51:07 +00:00
Folkert
bd31503855
Merge remote-tracking branch 'origin/trunk' into builtins-in-roc
2022-02-28 18:55:20 +01:00
Brian Carroll
4e7c1fe5e1
wasm: simplify ElementSection
2022-02-27 23:58:02 +00:00
Brian Carroll
7958158d89
wasm: comments & renaming
2022-02-27 23:42:05 +00:00
Brendan Hansknecht
2e70bb8458
remove list set low level
2022-02-27 15:07:09 -08:00
Brian Carroll
7ccc5ec768
Merge branch 'trunk' of github.com:rtfeldman/roc into wasm-runtime-error
2022-02-27 22:57:23 +00:00
Brendan Hansknecht
b802d681a3
Merge remote-tracking branch 'origin/trunk' into list-replace
2022-02-27 00:28:08 -08:00
Folkert
65b1b3fcce
just before Num
2022-02-26 23:11:40 +01:00
Brian Carroll
713241670a
repl_wasm: Fix bugs in wrapper function generation
2022-02-26 13:13:57 +00:00
Brendan Hansknecht
39d070e543
flip platform flag to be default
2022-02-25 20:10:36 -08: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
Tom Dohrmann
788c8a6af2
reimplement RocList
and RocStr
2022-02-23 16:02:13 +01:00
Brian Carroll
89b8926d27
gen_wasm: fix bug choosing the right proc specialization ( #2549 )
2022-02-21 22:52:45 +00: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
ayazhafiz
13067f2908
Implement Num.toNNNChecked
...
Closes #2411
2022-02-19 16:20:21 -05:00
Brian Carroll
4c7be277c2
wasm: Keep exported global variables from the preloaded object file
2022-02-14 08:45:46 +00:00
Brian Carroll
b46690ecf2
wasm: Custom Debug impl for NameSection
2022-02-13 12:42:50 +00:00
Brian Carroll
63c33d82e3
wasm: Improve dead code elimination to handle indirect calls
2022-02-12 00:09:35 +00:00
Brian Carroll
fcda6fabe2
wasm: replace a panic! with an internal_error!
2022-02-11 18:46:18 +00:00
Brian Carroll
54788b0357
wasm: Create a full model of the ElementSection
2022-02-11 18:44:47 +00:00
Brian Carroll
55465d15a0
wasm: include Name section in output binary, for debugging
2022-02-10 10:15:19 +00:00
Brian Carroll
8c5fe2ae22
wasm: implement Stmt::RuntimeError
2022-02-10 10:13:54 +00:00
Brian Carroll
4b585cc6c6
wasm: More explicit todo! statements
2022-02-09 17:23:36 +00:00
Brian Carroll
0af4361f2a
repl: continue fleshing out the Wasm repl code. Generate wrapper function.
2022-02-08 11:03:48 +00:00
Brian Carroll
85b418ebdf
wasm: get rid of Result from gen_wasm, rename a function, improve comments
2022-02-08 11:03:48 +00:00
Brian Carroll
c5ccc99e20
repl: rename Wasm32TestResult -> Wasm32Result
2022-02-08 11:03:48 +00:00
Brian Carroll
e9871947d3
repl: move wasm32_test_result to gen_wasm, and extract Wasm32Sized from FromWasm32Memory
2022-02-08 11:03:48 +00:00
Folkert
afd11e1cb1
move target -> roc_target
2022-01-26 23:33:29 +01:00
Folkert
c663a35e16
final phase
2022-01-26 15:44:24 +01:00
Mats Sigge
71f359fbdc
Move macros from roc_reporting to new roc_error_macros module
...
The `internal_error!` and `user_error!´ macros can't be used everywhere
when they live in `roc_reporting` due to circular dependencies.
2022-01-23 18:40:04 +01:00
Brian Carroll
992105930b
Merge pull request #2363 from rtfeldman/wasm-refactor-lowlevels
...
Wasm: refactor low-level ops
2022-01-21 07:16:45 +00:00
Anton-4
a6537683a1
Merge pull request #2355 from rtfeldman/fix-lint-error
...
Fix a lint error by simplifying an if/else block
2022-01-17 12:49:57 +01:00
Brian Carroll
f354b4842b
Wasm: Move Eq/NotEq into LowLevelCall
2022-01-17 09:35:08 +00:00
Brian Carroll
f635dd8776
Wasm: Refactor lowlevels to get more flexibility without increasing boilerplate.
2022-01-17 09:33:06 +00:00
Brian Carroll
88b779c3ff
Wasm: Create CodeGenNumber
2022-01-17 09:33:06 +00:00
Brian Carroll
05a6a9c7ce
Wasm: update comments on lowlevels
2022-01-17 09:33:06 +00:00
Jan Van Bruggen
c1dc0226f6
Fix a lint error by simplifying an if/else block
...
From `cargo clippy -- -D warnings`:
```
error: all if blocks contain the same code at the start
--> compiler/gen_wasm/src/wasm_module/sections.rs:478:9
|
478 | / if bytes[*cursor] == 0 {
479 | | u8::skip_bytes(bytes, cursor);
480 | | u32::skip_bytes(bytes, cursor);
| |___________________________________________^
|
= note: `-D clippy::branches-sharing-code` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#branches_sharing_code
help: consider moving the start statements out like this
|
478 ~ u8::skip_bytes(bytes, cursor);
479 + u32::skip_bytes(bytes, cursor);
480 + if bytes[*cursor] == 0 {
|
error: could not compile `roc_gen_wasm` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
```
2022-01-16 06:14:10 -07:00
Brian Carroll
5e68f298df
Wasm: Reorganise Stmt and Expr methods
2022-01-15 15:53:41 +00:00
Brian Carroll
6bdc27a49e
Wasm: Use Vec instead of MutSet for called preloads
2022-01-15 15:35:42 +00:00
Brian Carroll
94ea50f56a
Wasm: Clarify some more magic numbers
2022-01-15 15:35:42 +00:00
Brian Carroll
9290d3ad5c
Wasm: Clarify where magic constant 5 comes from
2022-01-15 15:35:42 +00:00
Brian Carroll
e37ca971bd
Wasm: Simplify CodeBuilder serialization, based on Richard's suggestion
2022-01-15 15:35:37 +00:00
Brian Carroll
8c4fd93b07
Wasm: Remove old debug code that's never used. We have the HTML debugger now.
2022-01-15 13:27:34 +00:00
Brian Carroll
8d5a1cb661
Wasm: Replace _ todo with RuntimeError todo
2022-01-15 13:27:34 +00:00
Brian Carroll
c38134bdc0
Wasm: remove legacy unused ret_layout
2022-01-15 13:27:34 +00:00
Brian Carroll
bafb6e54d0
Wasm: Change panic for literals todo -> internal_error
2022-01-15 13:27:34 +00:00
Brian Carroll
91a0b21e70
Wasm: Get rid of some Backend compatibility code
2022-01-15 13:27:34 +00:00
Brian Carroll
f4137013cb
Wasm: tweaks from self-review
2022-01-14 18:50:52 +00:00
Brian Carroll
c5134fa015
Wasm: rename DeadCodeMetadata to PreloadsCallGraph
2022-01-14 18:37:52 +00:00
Brian Carroll
4311b5a410
Wasm: Make dead functions unreachable
, and the same for all return types
2022-01-14 18:21:13 +00:00
Brian Carroll
e7dc442af0
Wasm: fix double-counting bug in dead function replacement
2022-01-14 18:20:52 +00:00
Brian Carroll
c7da7ca689
Wasm: Parse the Name section, export init_refcount_test, and don't DCE exports
2022-01-14 18:20:52 +00:00
Brian Carroll
3d00217b53
Wasm: rename build_module_help -> build_module_without_test_wrapper
2022-01-14 18:20:52 +00:00
Brian Carroll
22d7ccfbd7
Wasm: Comment explaining DCE
2022-01-14 18:20:52 +00:00
Brian Carroll
6b204d11a2
Wasm: sort and deduplicate on each round of live function tracing
2022-01-14 18:20:52 +00:00
Brian Carroll
9dabc2db15
Wasm: adjust dead code elimination to account for import function indices
2022-01-14 18:20:52 +00:00
Brian Carroll
ca2597973e
Wasm: store function_count on the ImportSection
2022-01-14 18:20:52 +00:00
Brian Carroll
7a4593170c
Wasm: reuse existing SkipBytes code for opcodes
2022-01-14 18:20:52 +00:00
Brian Carroll
8a01c3f98a
Wasm: implement dead code elimination
2022-01-14 18:20:52 +00:00
Brian Carroll
98400cae1b
Wasm: Move code around
2022-01-14 18:20:52 +00:00
Brian Carroll
61d46be923
Wasm: Parse the Code section to collect metadata for dead function elimination
2022-01-14 18:20:52 +00:00
Brian Carroll
48f14f9a83
Wasm: Implement SkipBytes for OpCode
2022-01-14 18:20:52 +00:00