Commit Graph

22592 Commits

Author SHA1 Message Date
Brian Carroll
b0d2e7a409
wasm_interp: store return type in frame & create SignatureParamsIter 2022-12-17 20:52:19 +00:00
Brian Carroll
d51beb073f
wasm_interp: create a block for each function and get tests working again 2022-12-17 20:52:19 +00:00
Brian Carroll
caedb9060b
wasm_interp: remove CallStack, create Frame, & share value storage for stack and locals
This allows us to do calls without moving arguments from one place to another
2022-12-17 20:52:19 +00:00
Brian Carroll
8b8e385cde
Merge branch 'main' of github.com:roc-lang/roc into wasm_interp_repl_test 2022-12-17 20:52:00 +00:00
Brian Carroll
ef69170b88
wasm_interp: fix typo bug in WASI random_get 2022-12-17 20:49:25 +00:00
Folkert de Vries
fd2c6adc6f
Merge pull request #4761 from roc-lang/wasm_interp_test_gen
Replace Wasm3 with roc_wasm_interp
2022-12-17 21:19:01 +01: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
Joshua Warner
a046428ce6
Add fuzzing for the formatter and fix bugs
This commit adds fuzzing for the (expr) formatter, with the same invariants that we use for fmt tests:
  * We start with text, which we parse
  * We format the AST, which must succeed
  * We parse back the AST and make sure it's identical igoring whitespace+comments
  * We format the new AST and assert it's equal to the first formatted version ("idempotency")

Interestingly, while a lot of bugs this found were in the formatter, it also found some parsing bugs.

It then fixes a bunch of bugs that fell out:
* Some small oversights in RemoveSpaces
* Make sure `_a` doesn't parse as an inferred type (`_`) followed by an identifier (parsing bug!)
* Call `extract_spaces` on a parsed expr before matching on it, lest it be Expr::SpaceBefore - when parsing aliases
* A few cases where the formatter generated invalid/different code
* Numerous formatting bugs that caused the formatting to not be idempotent

The last point there is worth talking further about. There were several cases where the old code was trying to enforce strong
opinions about how to insert newlines in function types and defs. In both of those cases, it looked like the goals of
(1) idempotency, (2) giving the user some say in the output, and (3) these strong opinions - were often in conflict.

For these cases, I erred on the side of following the user's existing choices about where to put newlines.

We can go back and re-add this strong opinionation later - but this seemed the right approach for now.
2022-12-17 09:52:09 -08:00
Brian Carroll
2eea0b1adf
repl_test: fix path for compiler include_bytes 2022-12-17 16:32:17 +00:00
Richard Feldman
10c8523888
Handle FileProblem explicitly 2022-12-17 03:57:11 -05:00
Richard Feldman
ed0b07a62f
clippy 2022-12-17 03:35:39 -05:00
Richard Feldman
3e448fd2b4
Merge remote-tracking branch 'origin/main' into packages 2022-12-17 03:32:52 -05:00
Richard Feldman
b21a3a4fdb
Handle loading errors more consistently 2022-12-17 03:31:10 -05:00
Folkert
d97fd98a33
parse error for dbg/expect final expressions 2022-12-16 22:47:53 +01:00
Richard Feldman
7b85775ee6
Drop a dbg! 2022-12-16 12:30:38 -05:00
Richard Feldman
fefb3b9908
gitignore cli_testing_example's compiled app 2022-12-16 12:29:47 -05:00
Richard Feldman
319fdbfaf7
Add packages-test to fixtures gitignore 2022-12-16 12:28:15 -05:00
Richard Feldman
27fc823795
Drop a redundant Instant::now() 2022-12-16 12:27:22 -05:00
Richard Feldman
c4da82cdae
Fix CLI test for packages 2022-12-16 12:27:22 -05:00
Richard Feldman
1d670cd0cf
Add CLI test for packages 2022-12-16 12:22:50 -05:00
Brian Carroll
3588e57c6a
clippy 2022-12-16 16:22:52 +00:00
Brian Carroll
62269bf6c9
builtins: build the Wasm interpreter from inside run-wasm-tests.sh 2022-12-16 16:05:00 +00:00
Brian Carroll
66aaa7c73c
wasm_interp: Use String for CLI args. It was crashing with OsString. 2022-12-16 16:04:22 +00:00
Brian Carroll
b938648dad
repl_test: get rid of nested Cargo build script, as it needs an extra target dir 2022-12-16 15:08:24 +00:00
Brian Carroll
405387afd5
repl_test: remove dependency on roc_wasm_module 2022-12-16 15:01:36 +00:00
Brian Carroll
27f2050d10
wasm_interp: implement WASI fd_read 2022-12-16 14:52:11 +00:00
Brian Carroll
eaf0211808
cli: update run_wasm to use roc_wasm_interp 2022-12-16 14:52:11 +00:00
Brian Carroll
3ef171e620
wasm_interp: support fake files in WASI 2022-12-16 14:52:11 +00:00
Brian Carroll
09fee71084
cli: Convert run_wasm to work with roc_wasm_interp 2022-12-16 14:52:11 +00:00
Brian Carroll
ca0f159386
wasm_interp: allow WASI to take bytes rather than strings for argv 2022-12-16 14:52:10 +00:00
Brian Carroll
4501f2af0e
wasm_interp: create Instance::from_bytes 2022-12-16 14:52:10 +00:00
Brian Carroll
4d5b7f8b73
wasm_interp: add a WasmModule to Instance so we don't have to pass it to call_export 2022-12-16 14:52:10 +00:00
Brian Carroll
fec64f0766
cli: remove wasmer dependency and rename run_with_wasmer->run_wasm 2022-12-16 14:52:10 +00:00
Brian Carroll
8798fa38d4
repl_test: delete shell script since we can now use Cargo 2022-12-16 14:52:10 +00:00
Brian Carroll
cdf7882054
repl_test: rename module wasm_interp->wasm 2022-12-16 14:52:10 +00:00
Brian Carroll
d63715d05f
repl_test: remove dependency on wasmer 2022-12-16 14:52:10 +00:00
Brian Carroll
490ea1cad2
wasm_interp: shard the branch cache by function, for 3x speedup on REPL! 2022-12-16 14:52:10 +00:00
Brian Carroll
86a82f8576
test_gen: disable roc_wasm_interp logging 2022-12-16 14:52:10 +00:00
Brian Carroll
b73e022336
test_gen: update WasiDispatcher 2022-12-16 14:52:10 +00:00
Brian Carroll
4164128f9e
repl_test: get rid of a debug println 2022-12-16 14:52:10 +00:00
Brian Carroll
d6af9a84fd
wasm_interp: fix a bug in WASI 2022-12-16 14:52:10 +00:00
Brian Carroll
b7fef386ee
wasm_interp: implement WASI random_get & refactor default imports 2022-12-16 14:52:05 +00:00
Brian Carroll
eaa3f14fb0
repl_test: start re-writing the Wasm tests to use roc_wasm_interp 2022-12-16 14:52:05 +00:00
Brian Carroll
e6325fa78f
repl_wasm: rename Cargo feature wasmer->wasi_test 2022-12-16 14:52:05 +00:00
Brian Carroll
d389601035
Merge branch 'main' of github.com:roc-lang/roc into wasm_interp_test_gen 2022-12-16 14:50:09 +00:00
Brendan Hansknecht
faaa466c70
Merge pull request #4774 from roc-lang/enable-fuzzing
[simple PR] Enable fuzzing and sanitizers
2022-12-16 00:22:00 +00:00
Folkert de Vries
f550f049db
Merge pull request #4768 from roc-lang/expects-store-specialized-variable
Support using dbg/expect in polymorphic functions
2022-12-16 00:10:40 +01:00
Richard Feldman
e9e82ddc08
Merge pull request #4766 from roc-lang/remove-f128
remove F128
2022-12-15 17:59:48 -05:00
Richard Feldman
94818fc6cc
Create header messages for packages 2022-12-15 17:45:32 -05:00
Brendan Hansknecht
d33e0a9f19
add links to docs 2022-12-15 14:45:25 -08:00