Commit Graph

3132 Commits

Author SHA1 Message Date
3341528f71 Merge branch 'master' into fix/wasi-append 2019-11-08 14:21:24 -08:00
674a70fa05 Create function declarations before starting the body of the first function. 2019-11-08 13:13:58 -08:00
a94fabf56e Update supported Rust version to 1.38 2019-11-08 11:40:53 -08:00
64783423ea Fix WASI append bug, add test 2019-11-08 11:17:04 -08:00
dccaa3a285 Apply TBAA to the correct instruction.
Another instance of the bug in PR #933.
2019-11-07 12:42:29 -08:00
ba87af5b1a feat(runtime-core) Ability for an export function to get a func env. 2019-11-07 20:44:17 +01:00
2e05104d45 fix(runtime-core) Introduce Context::ExternalWithEnv.
Host functions use `Context::External` with a `*mut vm::FuncCtx`
pointer, casted to `*mut vm::Ctx`. It creates a conflict with exports
that also use `Context::External`.

This patch introduces `Context::ExternalWithEnv` to create a specific
path in the code for an external context with `*mut vm::FuncEnv`.

This patch fixes all the `linking.wast` tests in the spectests.
2019-11-07 14:32:19 +01:00
dfaad35f8d fix(spectests) Remove a warning. 2019-11-07 14:31:43 +01:00
203efd0c06 Apply TBAA to the correct instruction.
Caught by LLVM verifier complaining about !tbaa on a getelementptr.
2019-11-06 23:25:39 -08:00
50c30ab212 runtime-core: Support cross-compilation. 2019-11-07 01:30:45 +08:00
001213716e Add fneg. 2019-11-07 01:30:27 +08:00
6135a004a4 Add itruncf/fconverti fast path. 2019-11-07 01:11:25 +08:00
cf74b68c37 Merge branch 'master' into feat-runtime-core-clos-host-function 2019-11-06 14:48:47 +01:00
6f84a6f15b test(runtime-core) Remove a warning in tests. 2019-11-06 14:48:47 +01:00
5ccaf12b2a doc(runtime-core) Fix inline documentations. 2019-11-06 14:48:47 +01:00
c4c88f8af5 fix(runtime-core) Remove undefined behavior with mem::transmute.
In the `wrap` functions, we use `std::mem::transmute(&())` to get the
pointer to the value “around” `wrap` (`Fn` has a method `to_raw` which
declares a `wrap` function, which uses `transmute` to retrieve
`Fn`). This is an undefined behavior. It was working until the
`FuncCtx` is introduced. Since then, the undefined behavior was
causing an error with the Singlepass backend.

This patch stores the pointer to `Fn` in `func_env`, so that the
pointer to the user-defined host function is always predictable.
2019-11-06 14:48:46 +01:00
a4ba429ed0 feat(singlepass-backend) Inject FuncCtx to the function pointer of an host function. 2019-11-06 14:48:46 +01:00
215e4458f0 Merge branch 'master' into feat-runtime-core-clos-host-function 2019-11-06 14:48:46 +01:00
a9e0e9baeb test(runtime-core) Write more documentation. 2019-11-06 14:48:46 +01:00
293b71ac54 doc(runtime-core) Write more documentation. 2019-11-06 14:48:46 +01:00
0f82cd3c40 doc(runtime-core) Write more documentation. 2019-11-06 14:48:46 +01:00
81326cee13 doc(runtime-core) Write more documentation. 2019-11-06 14:48:46 +01:00
3435ce436b test(runtime-core) Extract assert as tests. 2019-11-06 14:48:46 +01:00
a52b4b2280 test(runtime-core) Test closures with a captured environment. 2019-11-06 14:48:46 +01:00
3b34a9187a chore(runtime-core) Remove dbg!. 2019-11-06 14:48:46 +01:00
2a041f898e !temp 2019-11-06 14:48:46 +01:00
0e27f2fa72 test(runtime-core) Test more host functions as closures. 2019-11-06 14:48:46 +01:00
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
e002c377ef feat(runtime-core) vm::ImportedFunc and vm::FuncCtx have NonNull pointers. 2019-11-06 14:48:46 +01:00
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
dc437bb4e7 Fix typo in comment. 2019-11-05 11:31:14 -08:00
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
015491ea77 Add floating point instructions. 2019-11-06 01:43:41 +08:00
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
1d8f2b767d Build Metadata using the current Context.
Fixes #927. Reverts #928.
2019-11-04 15:27:38 -08:00
ef5faccb76 Update __wasi_rights_t and __wasi_signal_t with published changes 2019-11-04 13:45:19 -08:00
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
aaa0160c95 Fix values of __wasi_advice_t 2019-11-04 10:48:42 -08:00
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
c0c7661c65 Merge branch 'master' of github.com:wasmerio/wasmer into feature/llvm-tbaa 2019-11-01 17:53:52 -07:00
132757ee9d Fix leak. Only create one NamedMDNode for each name. 2019-11-01 17:49:45 -07:00
8d95e637f2 Add probable fix of memory leak in trampoline code 2019-11-01 17:38:43 -07:00
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
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
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
0e665c4001 Merge branch 'master' into feature/llvm-tbaa 2019-10-31 11:55:31 -07:00
0ba686ffc6 Improve wording a little. 2019-10-31 11:50:33 -07:00
88427c9696 Add some comments. 2019-10-31 11:48:52 -07:00
2703d48098 Merge branch 'master' into feat-runtime-core-host-function-without-vmctx 2019-10-31 10:59:16 +01:00
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