Commit Graph

9 Commits

Author SHA1 Message Date
Liam Appelbe 89dbc35fca [wasm] Wasm function imports.
I switched from a WasmImports object to a builder pattern:
module.instantiate().addMemory(...).addFunction(...).build();

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I381aa0f7df1fa006ce8d051cd5b4a1bcc1835e46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167460
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-10-16 23:16:42 +00:00
Liam Appelbe cff78bed87 Reland "Switch wasmer FFI boilerplate to new API"
This reverts commit 0c3d3da6ce.

Un-deleting the LICENSE file, to fix the dart->flutter roller.

Change-Id: Iee44c24e7cdb5c03f4ae131d08451fae2e996f49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167201
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-10-13 19:30:58 +00:00
Alexander Aprelev 0c3d3da6ce Revert "Switch wasmer FFI boilerplate to new API"
This reverts commit 9d0ae7d017 as it broke dart->flutter roller's flutter license script.

Change-Id: If523b9b88631e1eca0fef3612387005921481222
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166981
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-10-10 05:56:29 +00:00
Liam Appelbe 9d0ae7d017 Switch wasmer FFI boilerplate to new API
Broadly speaking, the new API is very similar to the old one. The only
public facing change is that you can't make a memory by itself anymore.
You need to construct if from a store, which is owned by a module.

The new API no longer passes structs by value, so I was able to delete
the wasmer_wrapper.cc, and the files I had copied from the wasmer repo.

The new API is also a lot more verbose, so it made more sense to write
a script to generate the FFI boilerplate, rather that write it all
manually.

All the migrated tests that were passing before this refactor are still
passing.

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I52ca54b982a27f1d851c630d3e09833b8810060c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164081
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-10-09 19:43:57 +00:00
Liam Appelbe 56be9a7425 [wasm] Port about half of the old dart:wasm tests to package:wasm
The rest of the tests rely of features I haven't implemented yet. I'll
port them as I implement them.

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I3465f10055db8d82148004ea975c0ed3b2928178
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162780
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-09-15 20:48:31 +00:00
Liam Appelbe 26c49d5578 [vm] Wasm memory exports, and emscripten hello world
I got the hello world wasm file from the emscripten team and got it
running using a fake implementation of WASI's fd_write function. This
necessitated adding support for memory exports.

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I139a4e868d437e2232bf4260e5cc26d8c598ac2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119061
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-10-01 18:19:56 +00:00
Liam Appelbe 6da8c39c5a [vm] Small WasmImports API change, and more WASM error tests
Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I3044d588398ccb19e3ebcebe6cd506b047a37857
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118601
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-09-27 23:36:11 +00:00
Liam Appelbe f234830998 Cut dart:ffi dependency to fix simarm build
Change-Id: I4124163000e2990a6037d36a4f87ccfcddf5a933
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117210
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-09-13 23:23:34 +00:00
Liam Appelbe ed9e89ea38 Implement a basic WASM API using wasmer.
Currently this only supports functions that take and return numeric
types. Byte arrays, and callbacks will come later, in a separate
wrapper package.

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I7bb82be83cbbb6062736b3e958f89d021f1af4bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114586
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-09-13 18:25:16 +00:00