Commit Graph

4321 Commits

Author SHA1 Message Date
Ivan Enderlin
81326cee13 doc(runtime-core) Write more documentation. 2019-11-06 14:48:46 +01:00
Ivan Enderlin
3435ce436b test(runtime-core) Extract assert as tests. 2019-11-06 14:48:46 +01:00
Ivan Enderlin
a52b4b2280 test(runtime-core) Test closures with a captured environment. 2019-11-06 14:48:46 +01:00
Ivan Enderlin
3b34a9187a chore(runtime-core) Remove dbg!. 2019-11-06 14:48:46 +01:00
Ivan Enderlin
2a041f898e !temp 2019-11-06 14:48:46 +01:00
Ivan Enderlin
0e27f2fa72 test(runtime-core) Test more host functions as closures. 2019-11-06 14:48:46 +01:00
Ivan Enderlin
6035bd2d9b feat(runtime-core,clif-backend,llvm-backend) Rename an ImportFunc offset.
`ImportedFunc::offset_vmctx` becomes `ImportedFunc::offset_func_ctx`.
2019-11-06 14:48:46 +01:00
Ivan Enderlin
e002c377ef feat(runtime-core) vm::ImportedFunc and vm::FuncCtx have NonNull pointers. 2019-11-06 14:48:46 +01:00
Ivan Enderlin
177c507a4e feat(runtime-core) Introduce vm::FuncCtx.
`vm::FuncCtx` replaces `vm::Ctx` as first argument passed to host
functions (aka imported functions).
2019-11-06 14:48:46 +01:00
bors[bot]
07a6fde420
Merge #932
932: Fix typo in comment. r=nlewycky a=nlewycky



Co-authored-by: nlewycky <nick@wasmer.io>
2019-11-05 19:32:26 +00:00
nlewycky
dc437bb4e7
Fix typo in comment. 2019-11-05 11:31:14 -08:00
bors[bot]
c07e6058f9
Merge #929
929: Update __wasi_rights_t and __wasi_signal_t with published changes r=MarkMcCaskey a=MarkMcCaskey

Follow up to #926 ; fixes everything else listed at https://github.com/WebAssembly/WASI/pull/135

Co-authored-by: Mark McCaskey <mark@wasmer.io>
2019-11-05 18:24:43 +00:00
losfair
015491ea77 Add floating point instructions. 2019-11-06 01:43:41 +08:00
bors[bot]
5f9670fc19
Merge #931
931: Build Metadata using the current Context. r=nlewycky a=nlewycky

Fixes #927. Reverts #928.


Co-authored-by: Nick Lewycky <nick@wasmer.io>
2019-11-05 00:27:52 +00:00
Nick Lewycky
1d8f2b767d Build Metadata using the current Context.
Fixes #927. Reverts #928.
2019-11-04 15:27:38 -08:00
Mark McCaskey
ef5faccb76 Update __wasi_rights_t and __wasi_signal_t with published changes 2019-11-04 13:45:19 -08:00
bors[bot]
bbcccafc54
Merge #926 #928
926: Fix values of __wasi_advice_t r=nlewycky a=MarkMcCaskey

Issue identified in https://github.com/WebAssembly/WASI/issues/132 ; 

928: Add workaround for #927. r=MarkMcCaskey a=nlewycky

# Description

Add `--test-threads 1` to workaround #927.

Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Nick Lewycky <nick@wasmer.io>
2019-11-04 19:20:34 +00:00
Nick Lewycky
efbb53a91e Add workaround for #927. 2019-11-04 11:04:50 -08:00
Mark McCaskey
aaa0160c95 Fix values of __wasi_advice_t 2019-11-04 10:48:42 -08:00
bors[bot]
69cc2f60bb
Merge #920
920: Export WasmPtr from wasmer_runtime r=MarkMcCaskey a=MarkMcCaskey



Co-authored-by: Mark McCaskey <mark@wasmer.io>
2019-11-04 18:46:13 +00:00
bors[bot]
b9a9949281
Merge #921
921: Apply TBAA metadata in the LLVM backend. r=nlewycky a=nlewycky

# Description
Inform LLVM that the pointers to memory, globals, locals, etc., are distinct.

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
2019-11-02 01:05:20 +00:00
Nick Lewycky
c0c7661c65 Merge branch 'master' of github.com:wasmerio/wasmer into feature/llvm-tbaa 2019-11-01 17:53:52 -07:00
Nick Lewycky
132757ee9d Fix leak. Only create one NamedMDNode for each name. 2019-11-01 17:49:45 -07:00
Mark McCaskey
8d95e637f2 Add probable fix of memory leak in trampoline code 2019-11-01 17:38:43 -07:00
bors[bot]
d8888c9459
Merge #911
911: Don't emit bounds checks when the offset is known at compile time to be less than the minimum memory size. r=nlewycky a=nlewycky



Co-authored-by: Nick Lewycky <nick@wasmer.io>
2019-11-01 19:53:17 +00:00
Nick Lewycky
20270411d9 When the const memory access is not larger than the minimum, use a runtime check.
The memory may have grown.
2019-11-01 12:49:54 -07:00
Nick Lewycky
bc521a2837 Add changelog entry. 2019-10-31 12:43:38 -07:00
Nick Lewycky
ef4b3c3428 Improve some TBAA label names, particular for memory.
Memory can't change between static and dynamic, so use that in the TBAA label
name.

Distinguish between local and imported memory, table and globals.
2019-10-31 12:40:32 -07:00
Syrus Akbary
e115d356a7
Update feature_matrix.md 2019-10-31 12:14:16 -07:00
Syrus Akbary
efc7385855
Merge pull request #922 from wasmerio/add-os-section-to-fetaure-matrix
Add OS compatibility section to feature matrix
2019-10-31 12:13:11 -07:00
Syrus Akbary
2b236be941
Update docs/feature_matrix.md 2019-10-31 12:12:56 -07:00
nlewycky
0e665c4001
Merge branch 'master' into feature/llvm-tbaa 2019-10-31 11:55:31 -07:00
Nick Lewycky
0ba686ffc6 Improve wording a little. 2019-10-31 11:50:33 -07:00
Nick Lewycky
88427c9696 Add some comments. 2019-10-31 11:48:52 -07:00
Mark McCaskey
16124672a3 Add OS compatibility section to feature matrix 2019-10-31 09:55:55 -07:00
bors[bot]
656491a337
Merge #917
917: feat(runtime-core) Host function without a `vm::Ctx` argument r=Hywan a=Hywan

Extracted from https://github.com/wasmerio/wasmer/pull/882.
~Includes https://github.com/wasmerio/wasmer/pull/916. Must not be merged until #916 lands in `master`.~
~If you want to compare only the different commits, see https://github.com/Hywan/wasmer/compare/feat-runtime-core-tests...Hywan:feat-runtime-core-host-function-without-vmctx?expand=1.~

This patch updates the `ExternalFunction` implementation to support host functions (aka imported functions) without having an explicit `vm::Ctx` argument.

It is thus possible to write:

```rust
fn add_one(x: i32) -> i32 {
    x + 1
}

let import_object = imports! {
    "env" => {
        "add_one" => func!(add_one);
    },
};
```

The previous form is still working though:

```rust
fn add_one(_: &mut vm::Ctx, x: i32) -> i32 {
    x + 1
}
```

The backends aren't modified. It means that the pointer to `vm::Ctx` is still inserted in the stack, but it is not used when the function doesn't need it.

We thought this is an acceptable trade-off.

About the C API. It has not check to ensure the type signature. Since the pointer to `vm::Ctx` is always inserted, the C API can digest host functions with or without a `vm::Ctx` argument. The C API uses [the `Export` + `FuncPointer` API](cf5b3cc09e/lib/runtime-c-api/src/import/mod.rs (L630-L653)) instead of going through the `Func` API (which is modified by this API), which is only possible since the C API only receives an opaque function pointer. Conclusion is: We can't ensure anything on the C side, but it will work with or without the `vm::Ctx` argument in theory.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2019-10-31 10:00:48 +00:00
Ivan Enderlin
912eb32be8 chore(cargo) Update Cargo.lock. 2019-10-31 11:00:07 +01:00
Ivan Enderlin
2703d48098 Merge branch 'master' into feat-runtime-core-host-function-without-vmctx 2019-10-31 10:59:16 +01:00
bors[bot]
fb0615dc02
Merge #915
915: fix(runtime-core) Share the definition of `Trampoline` across all the backends r=Hywan a=Hywan

Extracted from https://github.com/wasmerio/wasmer/pull/882.

This patch updates all the backends to use the definition of
`Trampoline` as defined in the `wasmer_runtime_core::typed_func`
module. That way, there is no copy of that type, and as such, it is
easier to avoid regression (a simple `cargo check` does the job).

This patch also formats the `use` statements in the updated files.


Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2019-10-31 09:13:42 +00:00
Nick Lewycky
d10d54a416 Add TBAA to atomic ops. 2019-10-30 16:39:39 -07:00
Nick Lewycky
15ce8bfda7 Label the loads in intrinsics.rs, most of which are the initial accesses off the context.
Move tbaa_label to intrinsics.rs. Move TBAA pass to first in the list, it doesn't get invalidated. Add TBAA labels for internal fields.
2019-10-30 16:18:36 -07:00
Mark McCaskey
25bcadbf74 Export WasmPtr from wasmer_runtime 2019-10-30 16:09:48 -07:00
bors[bot]
36d1c6a638
Merge #919
919: Add start of language intergrations table to feature matrix r=MarkMcCaskey a=MarkMcCaskey



Co-authored-by: Mark McCaskey <mark@wasmer.io>
2019-10-30 22:00:37 +00:00
Nick Lewycky
74eaec968e Remove all *_tbaa fields from LLVMModuleCodeGenerator and LLVMFunctionCodeGenerator. 2019-10-30 14:05:11 -07:00
Mark McCaskey
ea08431ab8 Add start of language intergrations table to feature matrix 2019-10-30 13:51:05 -07:00
Nick Lewycky
e7d1742c63 Update module to be held by Rc<RefCell<>> so that we can pass it to LLVMFunctionCodeGenerator.
Use that to generate distinct TBAA labels for distinct local variables.
2019-10-30 13:11:29 -07:00
Ivan Enderlin
6a1d490a30 doc(runtimecore) Explain ExternalFunctionKind with more details. 2019-10-30 19:34:04 +01:00
Ivan Enderlin
7eef49be12 test(runtime-core) Test host functions without a vm::Ctx argument. 2019-10-30 19:34:04 +01:00
Ivan Enderlin
95e1b85c56 feat(runtime-core) Allow host functions without an explicit vm::Ctx argument.
This patch allows host functions to get a signature without an
explicit `vm::Ctx` argument.

It is for Rust only. The C API receives a function pointer and has no
clue whether a `vm::Ctx` argument is present or not, so it assumes it
is always declared.

From the backend point of view, the pointer to `vm::Ctx` is always
inserted in the stack, but it is not used by the function when the
argument is absent.
2019-10-30 19:34:04 +01:00
Ivan Enderlin
bd9d4d9cc8 test(runtime-core) Add tests for the Func structure. 2019-10-30 19:34:04 +01:00