Commit Graph

1654 Commits

Author SHA1 Message Date
Ivan Enderlin
a1ca7069af fix(llvm-backend) Remove unused imports. 2019-03-29 10:03:40 +01:00
bors[bot]
bf823d2826 Merge #268
268: add experimental virtual filesystem r=lachlansneff a=xmclark

This PR introduces some changes to the runtime and adds a new feature: virtual file system.

In the future, we may want to bundle data with our wasm apps. That data can be made available to apps in a virtual filesystem by the wasmer runtime. To do this:

- wasmer must understand custom section data
- wasmer must re-wire emscripten calls to access a virtual file system
- these features are experimental and should be guarded by a feature flag (`--features vfs`)

~This PR adds support for the `read` syscall. ~
Just kidding, this PR does a lot more. Enough syscalls were re-implemented that a code reorg was warranted. 

Additions below ⬇️ 

Several new modules live under and around the `syscalls` module. These features are only supported on linux, but can be expanded to windows.

There are effectively two implementations: one for VFS and one for the host FS. In the future, we will have more tight control over access to the host, but this will do for now. The `select` function was also extracted into a new module as the complexity increased significantly. 

`select`should be refactored in the future to use a runtime like tokio, but that will need to wait.

The introduction of the libsodium dependency introduced some stumbling blocks, so I forked the zbox project and added a new build step. See it [here](https://github.com/wasmerio/zbox/blob/bundle-libsodium/build.rs). This will build libsodium at `cargo build` time and will automatically configure the environment. This will help with adoption and it is something we may be able to give back to zbox.


Additional changes:

After review, this PR is just a bit too large. We will implement the emscripten changes in another PR. This will help accelerate the work on WASI.

Co-authored-by: Mackenzie Clark <mackenzie.a.z.c@gmail.com>
2019-03-28 20:08:08 +00:00
Mackenzie Clark
a203675469 lint 2019-03-28 13:01:02 -07:00
Mackenzie Clark
d9c693a31c make file like implement the std::io traits instead and wrap zbox file 2019-03-28 12:50:37 -07:00
Mackenzie Clark
09642c92db revert changes to emscripten 2019-03-28 11:55:01 -07:00
Mackenzie Clark
c684ea46f0 lint 2019-03-28 11:42:59 -07:00
Mackenzie Clark
5294eb6b0d merge and respond to feedback 2019-03-28 11:41:45 -07:00
bors[bot]
4bbf9903f3 Merge #294
294: add support for symbol maps r=MarkMcCaskey a=MarkMcCaskey

resolves #293 

Co-authored-by: Mark McCaskey <mark@wasmer.io>
2019-03-28 17:09:44 +00:00
Mark McCaskey
a0e20667b5 add small fix 2019-03-28 10:08:41 -07:00
Mark McCaskey
764ec96ad1 fix compilation error 2019-03-28 09:20:54 -07:00
Mackenzie Clark
d8347a3d40 Merge branch 'master' into feature/vfs 2019-03-27 17:31:56 -07:00
Mackenzie Clark
9619019baf fix compiler errors for debug build 2019-03-27 17:23:07 -07:00
Mackenzie Clark
423f154177 fix typo 2019-03-27 16:55:21 -07:00
Mackenzie Clark
c9613bdcea add compiler error instead 2019-03-27 16:55:12 -07:00
Mackenzie Clark
b6eb830bf4 Revert "impl From for EmscriptenVfsError"
This reverts commit 18eae44577.
2019-03-27 16:55:00 -07:00
Mackenzie Clark
18eae44577 impl From for EmscriptenVfsError 2019-03-27 16:14:29 -07:00
Mackenzie Clark
074013648e build on windows 2019-03-27 16:07:59 -07:00
Syrus Akbary
2fd430e335
Added WASI 2019-03-27 15:23:43 -07:00
bors[bot]
ba4b309d56 Merge #295
295: generate null funcs r=syrusakbary a=xmclark

This PR automates adding the `nullfunc` imports. A new macro is added to help working with namespaces. All functions in the env namespace that start with `nullFunc_` will be added to the import object. This is easy because *all* null funcs have the same expected signature. 

Co-authored-by: Mackenzie Clark <mackenzie.a.z.c@gmail.com>
2019-03-27 21:56:57 +00:00
Mark McCaskey
580a153821 fix lint errors 2019-03-27 14:30:57 -07:00
Mark McCaskey
c51d44578d simplify borrowing inference of compiler config in llvm backend 2019-03-27 14:25:29 -07:00
Mark McCaskey
51c2111d53 pass compiler_config along to other backends 2019-03-27 14:18:34 -07:00
Mark McCaskey
315d8286c4 clean up (second pass) 2019-03-27 14:08:17 -07:00
Mark McCaskey
09068c1a74 clean up implementation 2019-03-27 14:01:27 -07:00
Mackenzie Clark
931008b5bd
Merge branch 'master' into feature/vfs 2019-03-27 09:21:42 -07:00
Mackenzie Clark
cd119fc861 make string multi-line 2019-03-27 08:36:53 -07:00
Mackenzie Clark
8b861d01db rename null func 2019-03-27 08:36:41 -07:00
bors[bot]
f249d3af77 Merge #296
296: feat(runtime-c-api) Implement the `wasmer_export_to_memory` function r=Hywan a=Hywan

This new function returns a `wasmer_memory_t` from a `wasmer_export_t`. It allows to use the `wasmer_memory_*` API over the exported memories from a Wasm instance.

See `tests/assets/return_hello.rs` and `tests/test-exported-memory.c` for an end-to-end example.

This PR also moves all `tests/.wasm` files into `tests/assets/`. I've added the source of `return_hello.wasm` to be exhaustive and to serve as a documentation.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2019-03-27 15:09:17 +00:00
Ivan Enderlin
a59ce13810 chore(runtime-c-api) Build the C and C++ headers. 2019-03-27 10:50:40 +01:00
Ivan Enderlin
4d0312f0ed test(runtime-c-api) New test suite for wasmer_export_to_memory. 2019-03-27 10:49:28 +01:00
Ivan Enderlin
6fca475564 feat(runtime-c-api) Implement the wasmer_export_to_memory function.
This new function returns a `wasmer_memory_t` from a
`wasmer_export_t`.
2019-03-27 10:44:47 +01:00
Ivan Enderlin
5661540097 chore(runtime-c-api) Move .wasm files into the assets directory. 2019-03-27 09:42:56 +01:00
Mackenzie Clark
d65a5dfe57 fix typo 2019-03-26 20:07:00 -07:00
Mackenzie Clark
8dd158d3fb fix more warnings 2019-03-26 19:05:53 -07:00
Mackenzie Clark
0435d6149a Merge branch 'master' into feature/generate-nullfuncs 2019-03-26 19:04:41 -07:00
Mackenzie Clark
3d3ce27cdb cargo fmt 2019-03-26 19:00:39 -07:00
Mackenzie Clark
ead5600abb fix warnings 2019-03-26 19:00:09 -07:00
Mackenzie Clark
e701bdb811 remove the nullfunc functions 2019-03-26 19:00:03 -07:00
Mackenzie Clark
0533a4eef6 dynamically import null funcs (all with the same signature) 2019-03-26 18:59:39 -07:00
Mark McCaskey
f9a29445ca fix instatiate calli n c-api 2019-03-26 17:00:51 -07:00
Mackenzie Clark
9c599f1226
Merge branch 'master' into feature/vfs 2019-03-26 17:00:40 -07:00
Mark McCaskey
a0809dedbf change formatting to match syscalls 2019-03-26 16:57:58 -07:00
Mark McCaskey
c7407ca7ab Merge branch 'master' into feature/add-support-for-symbol-maps 2019-03-26 16:42:56 -07:00
Mark McCaskey
9c58bed344 add support for symbol maps 2019-03-26 16:41:40 -07:00
bors[bot]
cb350577e4 Merge #292
292: fix arg passing to getcwd syscall r=MarkMcCaskey a=MarkMcCaskey



Co-authored-by: Mark McCaskey <mark@wasmer.io>
2019-03-26 23:17:57 +00:00
Mark McCaskey
49db149224 fix arg passing to getcwd syscall 2019-03-26 14:37:47 -07:00
bors[bot]
ad897b2076 Merge #291
291: fix alignment check on pointer r=MarkMcCaskey a=MarkMcCaskey



Co-authored-by: Mark McCaskey <mark@wasmer.io>
2019-03-26 17:33:37 +00:00
Mark McCaskey
18d2df8a88 try pinning nightly version 2019-03-26 10:27:07 -07:00
Mark McCaskey
d2818b1ffa fix alignment check on pointer 2019-03-26 09:56:23 -07:00
Mackenzie Clark
5bb82379ba add windows functions that were missed 2019-03-25 20:42:48 -07:00