Commit graph

6629 commits

Author SHA1 Message Date
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
Jan Van Bruggen
a61b8e402c
Fix directory name typo 2022-01-15 18:37:07 -07:00
Jan Van Bruggen
d7e2be306f WIP: Add Num.minI128 builtin (TODOs remain) 2022-01-15 17:49:15 -07:00
Jan Van Bruggen
d2c2064782 Add missing Num.maxI128 docs 2022-01-15 17:49:02 -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
f4650654ca Wasm: cosmetic changes to fake WASI functions 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
54e820620a Wasm: Improve a todo in roc_build 2022-01-15 14:34:06 +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
Brian Carroll
2ade357ea9 Wasm: Specify the format of immediate operands for each opcode 2022-01-14 18:20:52 +00:00
Brian Carroll
7f5b8c7296 Merge branch 'trunk' of github.com:rtfeldman/roc into wasm-pre-linking 2022-01-14 18:20:24 +00:00
Folkert de Vries
e1d990896a
Merge branch 'trunk' into mono-display 2022-01-14 13:55:52 +01:00
Folkert de Vries
8bff36faeb
Merge pull request #2346 from rtfeldman/fix-expansion-assignments
Fix bug that caused extraneous assignment in IR generation
2022-01-14 13:44:52 +01:00
Joshua Warner
6e67b77fa1 Remove awkward split between header_sources and defs sources 2022-01-13 19:34:17 -08:00
ayazhafiz
6ea7d63380 Make sure line offsets are generated properly for external programs
Closes #2329
2022-01-13 20:59:03 -05:00
ayazhafiz
9f78eb2e01 Fix bug that caused extraneous assignment in IR generation
Previously we would expand optional record fields to assignments when
converting record patterns to "when" expressions. This resulted in
incorrect code being generated.
2022-01-13 18:34:25 -05:00
ayazhafiz
72ee2d6327 Mark pretty_print_ir_symbols public 2022-01-13 16:35:09 -05:00
hafiz
5f216122d6 Update dev.rs 2022-01-13 16:33:26 -05:00
ayazhafiz
c38ca2dfa4 Anything for you mr paperclippy 2022-01-13 16:33:26 -05:00
ayazhafiz
8d372edda1 Add config variables for printing IR during mono stages 2022-01-13 16:33:26 -05:00
ayazhafiz
e655ab7d3b Module comments for reset-reuse
Figuring out what this module was doing, and why, took me a bit less
than half an hour. We should document what's happening for others in the
future so they don't need to follow up on Zulip necessarily.
2022-01-13 16:33:23 -05:00
Brian Carroll
535927a85e Wasm: fix test_wrapper function index 2022-01-13 05:41:52 +00:00
Brian Carroll
b46124234f Wasm: Add mock functions to HTML debugger for the full set of WASI imports 2022-01-13 05:41:52 +00:00
Brian Carroll
dd79a9b35a Clippy fixes 2022-01-13 05:41:52 +00:00
Brian Carroll
4f15fb3967 Wasm: Adjust funciton index for test_wrapper export declaration 2022-01-13 05:41:52 +00:00
Brian Carroll
c8181c3a19 Wasm: use parsed data from object file in the backend 2022-01-13 05:41:52 +00:00
Brian Carroll
8a384ffa88 Wasm: parse just enough of the Import section to count functions 2022-01-13 05:41:52 +00:00
Brian Carroll
9f8f31b2b6 Wasm: adjust function indices for preloading 2022-01-13 05:41:52 +00:00