Ivan Enderlin
3f924dbb45
feat(api,emscritpen,wasi) Update WasmExternType to FromToNativeWasmType.
2020-06-30 12:10:27 +02:00
Ivan Enderlin
12c04fbd94
test(api) Add tests for the FromToNativeWasmType trait.
2020-06-30 12:09:55 +02:00
Ivan Enderlin
26603a7e0c
feat(api) Reimplement WasmExternType as FromToNativeWasmType.
...
In addition to a more self-explanatory renaming from `WasmExternType`
to `FromToNativeWasmType`, this patch updates the `to_native` and the
`from_native` methods to panic when the values cannot be converted
from one type to another by using their respective `TryInto`
implementations.
For instance, `7i8.to_native()` equals to `7i32`, but
`u32::MAX.to_native()` cannot be converted to `i32`, and so it will
panic with the message:
> cannot convert 4294967295u32 to i32.
The old implementation was returning `-1i32`, which was incorrect.
2020-06-30 12:08:45 +02:00
Ivan Enderlin
3c2e191d6a
feat(api) Add the WasmTypeList::from_slice method.
...
This method creates a `WasmTypeList` from a slice of `i128`, similarly
to what `from_array` does, but without knowing the size ahead of time.
2020-06-26 14:54:32 +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
Syrus Akbary
308544a41d
Merge branch 'master' into feat-wasm-common-host-function-trap-early
2020-06-22 12:09:34 -07:00
Ivan Enderlin
f7493ff358
doc(api) Update.
2020-06-22 15:26:45 +02:00
Ivan Enderlin
1cd6eb8a21
test(api) Write more test cases for WasmTypeList.
2020-06-22 15:25:10 +02:00
Ivan Enderlin
3b03d7071b
doc(api) Improve documentation.
2020-06-22 15:09:18 +02:00
Ivan Enderlin
d1e4f7c5ce
feat(api) Improve the impl_traits macro + improve documentation.
...
The macro has been renamed `impl_host_function`, because it's
basically what it does. It implements other types and traits, but it's
all related to host functions.
The documentation has been improved. The generic parameters have been
renamed to be more self-explanatory. The code has been rewritten a little
bit to be easier to read. etc.
2020-06-22 15:05:55 +02:00
Ivan Enderlin
818706b318
doc(api) Improve documentation of HostFunctionKind and impls.
2020-06-22 14:05:19 +02:00
Ivan Enderlin
f8dfdae520
feat(api) Remove FunctionBody and use VMFunctionBody instead.
...
Avoid having multiple types for the same purpose.
2020-06-22 14:04:29 +02:00
Ivan Enderlin
a3f22afddc
feat(api) Improve doc' + rename HostFunction.to_raw to ….function_body_ptr.
2020-06-22 13:40:22 +02:00
Ivan Enderlin
8479f53329
feat(api) Rename TrapEarly to IntoResult. And improve its doc.
2020-06-22 13:20:02 +02:00
Ivan Enderlin
996135ae31
doc(api) Improve documentation of WasmTypeList.
2020-06-22 13:05:04 +02:00
Ivan Enderlin
ef3e43dcff
feat(api) Rewrite the wasm_extern_type macro to avoid repetition.
2020-06-22 11:46:30 +02:00
Ivan Enderlin
58c83734f2
test(api) Remove the function_call test.
...
This test does nothing. It's not using the `Function` API.
2020-06-22 11:42:42 +02:00
Ivan Enderlin
32e02f32dc
test(api) Clean up tests.
2020-06-22 11:42:12 +02:00
Ivan Enderlin
a623b9531e
chore(api) Rename inner::Func to inner::Function and improve documentation.
2020-06-22 11:33:49 +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
63ec941dac
Revert "!temp Remove impl of WasmTypeList for Infallible."
...
This reverts commit ad7c618193 .
2020-06-22 11:05:48 +02:00
Ivan Enderlin
ad7c618193
!temp Remove impl of WasmTypeList for Infallible.
...
I don't think it is necessary anymore.
2020-06-22 10:48:15 +02:00
Nick Lewycky
2017acf99e
Some clippy cleanup.
2020-06-20 13:43:46 -07: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 Akbary
338e93322f
Merge pull request #118 from wasmerio/config-refactor
...
Config refactor
2020-06-18 14:11:30 -07:00
Syrus
e604d6db49
Fixed linting
2020-06-18 13:08:52 -07:00
Syrus
5273fa0cae
Moved tunables into Store
2020-06-18 12:56:38 -07:00
Syrus
83203a849b
Improved tunables story
2020-06-18 12:08:55 -07:00
Ivan Enderlin
4a5ce43787
feat(api) Function::native returns a Result.
...
This patch updates `Function::native` to return a `Result` rather than
an `Option`.
2020-06-18 15:28:08 +02:00
Syrus
422051ebe5
Simplified compiler config names
2020-06-18 01:36:25 -07:00
Syrus
1002a2765c
Improved default store
2020-06-18 01:34:11 -07:00
Syrus
f2fa2a9100
Created builders for JIT and Native engines
2020-06-18 00:57:32 -07:00
Syrus
99bd98458a
Improved compiler configurations
2020-06-17 22:47:32 -07:00
Syrus
8649f2eb79
Remove target from CompilerConfig
2020-06-17 20:26:50 -07:00
Syrus
e062e87d8b
Refactored Compilers
2020-06-17 19:17:06 -07:00
Mark McCaskey
3d46711cb3
Add Table as a trait
2020-06-17 12:18:22 -07:00
Syrus Akbary
67044eb9bb
Merge pull request #114 from wasmerio/feature/memory-is-a-trait
...
Implement the `Memory` API as a trait
2020-06-17 11:35:09 -07:00
Mark McCaskey
f85f4636f3
Clean up and address feedback
2020-06-17 10:59:29 -07:00
losfair
9d27bd2318
Merge remote-tracking branch 'origin/master' into middleware
2020-06-18 00:41:42 +08:00
Mark McCaskey
bfb09543d9
Implement the Memory API as a trait
2020-06-16 16:30:15 -07:00
Mark McCaskey
ef285aae6c
Merge pull request #110 from wasmerio/feature/functions-own-their-envs
...
Change functions to own their `env`s
2020-06-16 13:36:05 -07:00
Mark McCaskey
cf3a391422
Add comment about derefing typecasted pointer
2020-06-16 13:01:51 -07:00
Mark McCaskey
3cebca05d2
Require Env to be 'static in Function
2020-06-16 12:18:24 -07:00
losfair
0ecaac5f70
Export required types.
2020-06-17 01:43:24 +08:00
Syrus
74a1463188
Fixed linting
2020-06-15 19:57:08 -07:00
Syrus
cdb7874bce
Make tests pass
2020-06-15 19:48:38 -07:00
Mark McCaskey
0191ffe598
Add wip
2020-06-15 18:05:59 -07:00
Syrus
b00f899913
Update to Cranelift 0.65, wasmparser 0.57
2020-06-15 18:00:48 -07:00
Mark McCaskey
0f0a8dde34
Merge branch 'master' into feature/functions-own-their-envs
2020-06-15 16:17:24 -07:00
Syrus
93024cccc8
Last round of feedback
2020-06-15 15:16:23 -07:00