Commit Graph

53 Commits

Author SHA1 Message Date
Mark McCaskey
eb8b486388 Fix use-after free with NativeFunc 2020-12-08 12:13:17 -08:00
Ivan Enderlin
7973a965fb Merge branch 'master' into fix-vm-leak 2020-12-01 10:08:21 +01:00
Mark McCaskey
03410c15a1 Rename EngineExport to Export 2020-11-30 12:32:53 -08:00
Mark McCaskey
9e0cfcebbb Rename vm::Export to vm::VMExport 2020-11-30 11:38:14 -08:00
Mark McCaskey
8669e92ed4 Move EngineExport to engine 2020-11-25 16:44:21 -08:00
Mark McCaskey
7013163829 WIP attempt to make an Export wrapper type
I can't figure out how we can ever use the non-wrapped type though
2020-11-25 10:59:04 -08:00
Ivan Enderlin
e77afea383 big patch: Start injecting InstanceAllocator everywhere. 2020-11-23 17:25:09 +01:00
Mark McCaskey
2690e5e8f6 Merge branch 'master' into feature/host-env-prototype 2020-11-16 15:13:29 -08:00
bors[bot]
a5281eaab8 Merge #1753
1753: Use a union for VMContext for functions r=MarkMcCaskey a=MarkMcCaskey

This makes the code more self documenting and correctly uses `unsafe`
to communicate that it's the caller's responsibility to ensure that the
code paths that can lead to the access can only write the value they
expect to be there.

spun off of #1739


- [x] There's still some inconsistent use of `vmctx` and `extra_data` might be good to unify this more.
- [x] Improve docs on the new type


Co-authored-by: Mark McCaskey <mark@wasmer.io>
2020-10-31 00:48:30 +00:00
Mark McCaskey
e3dfcf8b6f Rename VMFunctionExtraData to VMFunctionEnvironment 2020-10-30 17:31:52 -07:00
Mark McCaskey
be3ab95688 Add error handling to host init logic 2020-10-28 17:39:37 -07:00
Mark McCaskey
8b87526d9d Create single interface to get exports from Instance.exports
This adds a method that takes generic arguments as well so that
NativeFunc<Args, Rets> can also be `got` even though it has generic
parameters
2020-10-28 13:32:27 -07:00
Mark McCaskey
5b67b2f3dc Merge branch 'master' into feature/host-env-prototype 2020-10-27 16:24:00 -07:00
Mark McCaskey
608fbdca2a Remove lifetime parameter from NativeFunc
It wasn't doing anything anyways.
2020-10-27 14:37:24 -07:00
Mark McCaskey
1b7188769c Remove VMContext port to union, split into #1753 2020-10-22 12:00:44 -07:00
Mark McCaskey
b124ea2032 Use a union for VMContext for functions
This makes the code more self documenting and correctly uses `unsafe`
to communicate that it's the user's responsibility to ensure that the
code paths that can lead to the access can only write the value they
expect to be there.
2020-10-22 11:46:42 -07:00
Mark McCaskey
011ec22d43 Merge branch 'master' into feature/host-env-prototype 2020-10-20 15:46:50 -07:00
Mark McCaskey
ed1202181e Clean up code a bit 2020-10-20 12:21:16 -07:00
Nick Lewycky
29c9cb1471 Rename trampoline to call_trampoline, part 2. 2020-10-20 11:11:32 -07:00
Mark McCaskey
3c7dfe29f3 Add hacked together vertical slice of host env updating idea 2020-10-19 17:19:46 -07:00
Nick Lewycky
5d147f8236 WIP checkpoint. Code that builds.
Use Option<VMTrampoline> which should be ffi-compatible.

Put the register_signature and lookup_signature functions back on the Engine.
2020-10-08 15:09:37 -07:00
Mark McCaskey
5049c543dc Rename wasm-common crate to wasmer-types 2020-08-13 17:59:26 -07:00
Syrus
a732159514 Use better naming for module functions 2020-07-26 12:02:45 -07:00
Syrus
7bf6b9efc9 Added spec docs to app API public objects 2020-07-15 17:40:35 -07:00
Syrus
6816bb5a4b Remove unused owned_by_store 2020-07-08 01:00:18 -07:00
Syrus
92f8651312 Renamed wasmer_runtime to wasmer_vm 2020-07-07 21:26:06 -07:00
Ivan Enderlin
3f924dbb45 feat(api,emscritpen,wasi) Update WasmExternType to FromToNativeWasmType. 2020-06-30 12:10:27 +02:00
Ivan Enderlin
2d025c24ea feat(api) Remove the WasmExternTypeInner trait.
I believe this trait is no longer necessary since `WasmExternType` has
been moved inside the `wasmer` crate itself (this crate).

See https://github.com/wasmerio/wasmer-reborn/pull/121.

`cargo check` and `cargo test` agrees.

Also, this trait is annoying to implement abstraction over
`NativeFunc` since it is not re-exported outside of the crate.
2020-06-25 16:55:36 +02:00
Ivan Enderlin
07aff22c30 feat(api/wasm-common) Move WasmExternType from wasm-common to wasmer.
Because there is a trait implementation conflicts for the
implementations `WasmTypeList` for `$x*` where `$x: WasmExternType`.
2020-06-22 11:10:18 +02:00
Ivan Enderlin
5e26d9a74b !temp Move HostFunction, Func & co. into wasmer.
Because `Func` needs an access to the runtime API (`wasmer-runtime`)
to trap properly, either we move parts of `wasmer-runtime` to
`wasm-common`, or we move parts of `wasm-common` into `wasmer`. I
decided to go with the second approach since `wasmer` is the only
crate to use `HostFunction` & co. It's not “common” by definition, and
it's way easier (for the moment).
2020-06-19 15:20:28 +02:00
Syrus
93024cccc8 Last round of feedback 2020-06-15 15:16:23 -07:00
Syrus
0ae7982931 Re-enabled non-optimized function trampolines approach 2020-06-15 14:53:34 -07:00
Syrus
050493e354 Fixed lint issue 2020-06-15 13:58:57 -07:00
Syrus
58cc08e37a Inline further to optimize native calls 2020-06-15 13:48:07 -07:00
Syrus
24077fb919 Added tests for host functions calls 2020-06-15 13:33:46 -07:00
Syrus
99ed3e889e Simplified has_env structure 2020-06-15 13:22:20 -07:00
Syrus
fca0d0c9fe Fixed feedback 2020-06-15 12:59:07 -07:00
Syrus
e5838d8ccb Added full support for dynamic functions with env 2020-06-13 15:52:42 -07:00
Syrus
b7dc092256 Fixed native compilation 2020-06-13 01:21:10 -07:00
Syrus
cd1138d520 Added support for native calls to dynamic functions 2020-06-12 20:50:24 -07:00
Syrus
21389f34ce Improved docs 2020-06-12 19:01:58 -07:00
Mark McCaskey
70e25a7396 Emscripten compiles with no errors! 2020-06-10 17:03:44 -07:00
Mark McCaskey
f9d8249a2f Update Emscripten to use new env and new types 2020-06-10 11:52:17 -07:00
Mark McCaskey
d492084f63 Fix tests 2020-06-09 14:35:42 -07:00
Mark McCaskey
7eb54950f1 Revert changes to Exportable 2020-06-09 13:26:12 -07:00
Mark McCaskey
a8faa2eb9c Add benchmark with many parameters 2020-06-09 13:14:12 -07:00
Mark McCaskey
5f5c7d6725 Clean up and comment out some NativeFunc tests for now 2020-06-09 12:36:07 -07:00
Mark McCaskey
eb928e739c Implement host functions in 1 case, optimize NativeFunc::call
`NativeFunc::call` is about 8% faster in the case we're benchmarking
by avoiding allocating a vector for the params / returns, instead we
do logic to determine which is larger and use that, conditionally
copying it back to the rets array if needed.
2020-06-09 11:35:58 -07:00
Mark McCaskey
8530e5eb55 Implement Exportable for NativeFunc 2020-06-08 16:07:22 -07:00
Mark McCaskey
e2b6041a65 Add benchmark 2020-06-08 13:58:21 -07:00