Commit Graph

171 Commits

Author SHA1 Message Date
Ivan Enderlin
5dbab5655e feat(c-api) Use Option<NonNull<wasm_valtype_t>> in wasm_valtype_kind.
A more Rust-FFI idiomatic way to handle null pointer.

Note: In `wasm_valtype_kind`, it's tricky to handle the error because
we _must_ return a `wasm_valtype_kind` value. For the moment, it
continues to panic, which is probably the best tradeoff.
2020-10-08 15:08:08 +02:00
Ivan Enderlin
c3efc06e87 test(c-api) Add test case for wat2wasm. 2020-10-06 20:56:36 +02:00
Ivan Enderlin
264ed836ac feat(c-api) Use c_try! and From implementations to simplify wat2wasm. 2020-10-06 20:56:21 +02:00
Ivan Enderlin
78887c378e chore(c-api) Simplify code. 2020-10-06 11:14:46 +02:00
Ivan Enderlin
ded3132b44 feat(c-api) Implement wat2wasm. 2020-10-06 11:09:35 +02:00
Mark McCaskey
ab153fc642 Improve error messages around memory creation 2020-10-05 15:45:52 -07:00
Ivan Enderlin
3edcc89698 feat(c-api) Redefine wasm_store_t.
`wasm_store_t` is now a proper struct (rather than an opaque type) of
kind:

```rs
struct wasm_store_t {
    inner: Store
}
```

The rest of the patch updates the code accordingly.
2020-10-05 21:16:43 +02:00
Ivan Enderlin
ff4cb6d412 feat(c-api) Implement wasm_module_validate. 2020-10-05 14:49:23 +02:00
bors[bot]
1de0606b4e Merge #1673
1673: Add conversion logic for boxed_vec, simplify vec creation code r=MarkMcCaskey a=MarkMcCaskey

Fixes the issue mentioned in https://github.com/wasmerio/wasmer/issues/1631#issuecomment-702350852 



Co-authored-by: Mark McCaskey <mark@wasmer.io>
2020-10-03 00:01:51 +00:00
Mark McCaskey
e6c61c74ff Update boxed_vec to deal with boxed values 2020-10-02 16:33:03 -07:00
Mark McCaskey
34e6139570 Add conversion logic for boxed_vec, simplify vec creation code 2020-10-02 16:24:46 -07:00
Mark McCaskey
3845e5fd67 Clean up binary files from C API refactor 2020-10-02 15:30:13 -07:00
Ivan Enderlin
92ca7899f5 chore(c-api) Use canonical path to wasm*.h headers. 2020-10-02 11:15:37 +02:00
Ivan Enderlin
e7d6af01e6 feat(c-api) Remove the deprecated feature.
This feature is no longer necessary. The `build.rs` no longer uses
it. The overhead of including the deprecated symbol inside the dylib
is acceptable. It simplifies the overall build system.
2020-10-02 11:09:20 +02:00
Ivan Enderlin
7f4862117f doc(c-api) Write a quick introduction to the crate. 2020-10-02 10:40:26 +02:00
Ivan Enderlin
2fdd9ea692 feat(c-api) Simplify the build.rs script. 2020-10-02 10:10:24 +02:00
Ivan Enderlin
ae1a50b5d7 chore(c-api) Move cbindgen:ignore from functions/types to modules.
This patch removes the amount of `cbindgen:ignore` instructions by
moving this instruction onto the parent module.
2020-10-02 09:51:48 +02:00
Ivan Enderlin
1a45756cad test(c-api) Use the REQUIRED option of find_library. 2020-10-02 09:45:34 +02:00
Ivan Enderlin
d5fa525612 test(c-api) Enable the test-early-exit test case. 2020-10-01 23:23:41 +02:00
Ivan Enderlin
ddbbd96f1c test(c-api) Run make clean before, in case of. 2020-10-01 23:23:23 +02:00
Ivan Enderlin
0095ec9538 fix(c-api) wasm_val_t is not an opaque type, let's use a C representation. 2020-10-01 23:07:43 +02:00
Ivan Enderlin
68d6292c35 test(c-api) Restore the test-wasi and disable the test-early-exit. 2020-10-01 21:40:02 +02:00
Ivan Enderlin
5d9fc86bb8 test(c-api) Enable the wasi-c-api-trap test case. 2020-10-01 21:27:18 +02:00
Ivan Enderlin
a117df1740 chore(c-api) Remove a warning about wasm_frame_t case. 2020-10-01 21:26:45 +02:00
Ivan Enderlin
3a81643ff0 chore(c-api) Update header files. 2020-10-01 21:23:06 +02:00
Ivan Enderlin
a2854ebfea fix(c-api) Adjust cbindgen metadata for header files. 2020-10-01 21:20:13 +02:00
Ivan Enderlin
ecb79e2af0 fix(c-api) Cherry-pick manually from https://github.com/wasmerio/wasmer/pull/1657. 2020-10-01 21:16:29 +02:00
Mark McCaskey
762a6acc85 Add rlib as a crate-type for wasmer-c-api
This is how `wasmer-runtime-c-api` was before and seems to fix a use
case that users relied on
2020-10-01 20:59:40 +02:00
Nick Lewycky
9a3c5cf389 Remove extern "C" from a non-pub function that returns non-FFI'able type.
Add `extern "C"` to two `#[no_mangle] pub` functions.
2020-10-01 20:58:09 +02:00
Ivan Enderlin
916f50463f doc(c-api) Restore the README.md. 2020-10-01 14:22:30 +02:00
Ivan Enderlin
bf7b50a8eb test(c-api) Restore the wasm-c-api test suite. 2020-10-01 14:13:02 +02:00
Ivan Enderlin
3f8d7f4f74 test(c-api) Update the CMake project name for the deprecated test suite. 2020-10-01 10:11:02 +02:00
Ivan Enderlin
c1fb4b2c29 test(c-api) Restore the deprecated test suite. 2020-10-01 10:07:35 +02:00
Ivan Enderlin
5ea1f1eb25 feat(c-api) Always generate _all_ C headers. Include the deprecated API per default. 2020-10-01 09:52:23 +02:00
Ivan Enderlin
a259ac6862 chore(c-api) Regenerate wasmer.h header files. 2020-09-29 16:21:48 +02:00
Ivan Enderlin
f5a57b84e9 fix(c-api) Exclude non-standard WASI API from wasmer.h. 2020-09-29 16:21:16 +02:00
Ivan Enderlin
8969756416 chore(c-api) Regenerate header files. 2020-09-29 16:08:54 +02:00
Ivan Enderlin
cab0854d99 feat(c-api) Rename the include-deprecated feature to deprecated, and change strategy.
When `deprecated` is enabled, the `deprecated` module is included in
the crate.

When `deprecated` is enabled, **only** the `wasmer.h*` header files
will be generated.

When `deprecated` is disabled, **only** the `wasmer_wasm.h` header
file will be generated.
2020-09-29 16:04:25 +02:00
Ivan Enderlin
d55b701e9d feat(c-api) Make wasi_config_t and wasi_env_t opaque structures.
Removing `repr(C)` make them opaque for cbindgen. Which is perfect for what we want.
2020-09-29 16:01:52 +02:00
Ivan Enderlin
4165e389dc feat(c-api) Use cbindgen@master.
Our PR to support `ManuallyDrop`, `MaybeUninit` and `Box` has been
merged, https://github.com/eqrion/cbindgen/pull/578.
2020-09-29 14:16:09 +02:00
Ivan Enderlin
ecfa22867e test(c-api) Improve test outputs. 2020-09-28 17:17:25 +02:00
Ivan Enderlin
ffd1e6eddf test(c-api) Split the test suites (deprecated and wasm-c-api). 2020-09-28 17:09:44 +02:00
Ivan Enderlin
570b174fb5 fix(c-api) Polish deprecated API. 2020-09-28 15:45:52 +02:00
Ivan Enderlin
579d00ffd7 chore(c-api) Fix a bad sed, woops. 2020-09-28 15:40:51 +02:00
Ivan Enderlin
1c0708df33 fix(c-api) Add missing JIT symbol. 2020-09-28 15:39:33 +02:00
Ivan Enderlin
f61a11526c chore(c-api) Use original cbindgen instead of our fork. 2020-09-28 15:33:42 +02:00
Ivan Enderlin
04ef295a1d chore(c-api) Regenerate wasmer_wasm.h. 2020-09-28 14:52:55 +02:00
Ivan Enderlin
b59db4cee2 feat(c-api) wasmer_wasm.h includes wasm.h. 2020-09-28 14:52:27 +02:00
Ivan Enderlin
8f627d9834 feat(c-api) Instruct cbindgen to ignore all functions and types defined in wasm.h. 2020-09-28 14:49:44 +02:00
Ivan Enderlin
40865799e6 feat(c-api) Don't create a module for byte and frame. 2020-09-28 14:02:02 +02:00