Commit Graph

258 Commits

Author SHA1 Message Date
ce525e7e90 doc(c-api) Update documentation. 2020-10-27 13:53:47 +01:00
2452b9a604 chore(doc): Add the Wasmer logo to the generated API documentation 2020-10-26 22:37:30 +01:00
126819eda6 Don't assume the serialized data came from engine-jit. 2020-10-26 12:32:08 -07:00
c6978ea967 Merge #1751
1751: feat(c-api) Correctly implement “trap” in `wasm_func_new*` r=Hywan a=Hywan

The implementation of “trap” in `wasm_func_new` was “incorrect”. It's
more idiomatic to return a `RuntimeError` than raising it in this
case, so that we don't duplicate locations where runtime errors are
raised.

The implementation of “trap” in `wasm_func_new_with_env` was
missing. This patch implements a similar strategy than the sibling
function.

Fixes https://github.com/wasmerio/wasmer/issues/1744.

Co-authored-by: Ivan Enderlin <ivan@mnt.io>
2020-10-26 13:52:18 +00:00
1b3254cf6a Move the generated-by comment up to the first comment. 2020-10-23 11:16:30 -07:00
8ab49df7ab Ahem. 2020-10-23 11:15:31 -07:00
9085480ad0 Update the generated file too, of course. 2020-10-23 11:14:06 -07:00
e28fd7e755 Add a comment indicating what generates this file. 2020-10-23 11:10:21 -07:00
8d80befccd feat(c-api) Correctly implement “trap” in wasm_func_new*.
The implementation of “trap” in `wasm_func_new` was “incorrect”. It's
more idiomatic to return a `RuntimeError` than raising it in this
case, so that we don't duplicate locations where runtime errors are
raised.

The implementation of “trap” in `wasm_func_new_with_env` was
missing. This patch implements a similar strategy than the sibling
function.
2020-10-22 15:31:27 +02:00
7214b98165 feat(c-api) Implement wasm_memory_type. 2020-10-20 15:49:34 +02:00
6d326233f7 Merge branch 'master' into fix/create-exe-genearted-code-bugs 2020-10-19 10:03:05 -07:00
5c26a81598 feat(c-api): Implement wasm_global_type
This patch adds a `wasm_globaltype_t::new` constructor for use by the
new `wasm_global_type` function and the existing
`wasm_globaltype_new_inner` function.

Note: `wasm_global_type` is defined here:
193d7c8ce1/lib/c-api/tests/wasm_c_api/wasm-c-api/include/wasm.h (L436)
2020-10-19 16:02:21 +02:00
460d034379 chore(c-api) Remove outdated comment. 2020-10-19 09:23:08 +02:00
afa5ab5e52 Merge branch 'master' into fix-c-api-trampoline 2020-10-19 09:22:13 +02:00
a73e457976 Merge branch 'master' into feat-c-api-update-wasm-h 2020-10-19 08:01:00 +02:00
bb1b89f4f7 Removed all usages of wasm_instance_get_vmctx_ptr 2020-10-16 21:39:23 -07:00
1ee99d394c Address feedback and fix small issue with cfg logic 2020-10-16 17:38:59 -07:00
1d4bf9b7fa Merge #1725
1725: feat(c-api) Implement `wasm_func_type` r=MarkMcCaskey a=Hywan

This patch creates a `wasm_functype_t::new` constructor, that is used
by the new `wasm_func_type` function, and the existing
`wasm_functype_new_inner` function.

Note: `wasm_func_type` is defined in 193d7c8ce1/lib/c-api/tests/wasm_c_api/wasm-c-api/include/wasm.h (L421).

# Review

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


Co-authored-by: Ivan Enderlin <ivan@mnt.io>
2020-10-16 23:59:42 +00:00
d7d40e542f Merge branch 'master' into feat-c-api-update-wasm-h 2020-10-16 10:18:46 +02:00
e29ea25dcd feat(c-api) Simplify code with unwrap_or_default. 2020-10-16 10:17:23 +02:00
2f692a1e2c fix(c-api) Fix merge issue. 2020-10-16 09:42:12 +02:00
f3bcc36b59 Merge branch 'master' into fix/panic-in-memory-api 2020-10-15 10:11:43 -07:00
ffff0441bc feat(c-api) Implement wasm_func_type.
This patch creates a `wasm_functype_t::new` constructor, that is used
by the new `wasm_func_type` function, and the existing
`wasm_functype_new_inner` function.
2020-10-15 15:05:26 +02:00
193d7c8ce1 Merge #1715
1715: fix(c-api) Register errors from `wasm_module_serialize` r=Hywan a=Hywan

This patch updates `wasm_module_serialize` to register errors with`update_last_error` if any.

Co-authored-by: Ivan Enderlin <ivan@mnt.io>
2020-10-15 06:31:12 +00:00
c5d5ac7bfe Merge #1693
1693: Add `wasmer create-exe` r=MarkMcCaskey a=MarkMcCaskey

This adds the `wasmer create-exe` subcommand.  This subcommand is a combination of `wasmer compile --object-file` and linking that compiled Wasm with a main function and libwasmer.  Put more plainly: it lets us transform Wasm modules into native executables in one step.

In order for this to work we need:
- [x] Ship wasm.h with Wasmer or use different mechanism to find it
- [x] Ship wasmer_wasm.h with Wasmer
- [x] Requires up to date libwasmer... had to build one and copy it over, may fail in CI because of this... will be fixed with next release though
- [x] More gracefully handle wasmer installed without WASMER_DIR, etc (even if just error messages, should be tested)
- [x] Add tests

# Review

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


Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <5770194+MarkMcCaskey@users.noreply.github.com>
2020-10-13 21:46:16 +00:00
e3ec9f34c1 Prevent panic when min > static bound and max is less than it 2020-10-13 14:39:25 -07:00
599c473d34 Merge branch 'master' into fix-c-api-module-serialize 2020-10-13 11:24:35 +02:00
9c309ea3f3 Merge #1689
1689: feat(c-api) Use `Option<NonNull<wasm_valtype_t>>` in `wasm_valtype_kind` r=syrusakbary a=Hywan

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.

Co-authored-by: Ivan Enderlin <ivan@mnt.io>
2020-10-13 09:06:29 +00:00
7cc4d5adbe fix(c-api) Simplify NonNull<T> by &T. 2020-10-13 10:51:58 +02:00
954e5e8495 fix(c-api) Register errors from wasm_module_serialize. 2020-10-13 10:26:32 +02:00
fd63ddb101 Merge branch 'master' into feature/wasmer-create-exe 2020-10-12 15:54:54 -07:00
f866ea39fd fixup 2020-10-12 18:02:45 +02:00
fe70330772 fixup 2020-10-12 18:02:32 +02:00
b9f98ce1f6 feat(c-api) Update .h files. 2020-10-12 17:54:21 +02:00
750a1c3645 feat(c-api) Implement wasm_module_name and wasm_module_set_name.
I submited a proposal to the official `wasm.h` by the way,
https://github.com/WebAssembly/wasm-c-api/pull/157. For the moment,
let's keep that as a vendor specific implementation.
2020-10-12 17:52:40 +02:00
bf389f96b9 Merge branch 'master' into feat-c-api-update-wasm-h 2020-10-12 13:48:17 +02:00
122ba837a1 Merge branch 'master' into feat-c-api-update-wasm-h 2020-10-12 13:36:42 +02:00
437426d8b1 feat(c-api) Update wasmer_wasm.h. 2020-10-12 13:34:55 +02:00
0b4ef7add7 test(c-api) Don't pass NULL for zero args/results to wasm_func_call!
We must pass an empty array.
2020-10-12 13:34:20 +02:00
4186d1ce58 test(c-api) Use wasm_extern_vec_t for wasm_get_imports. 2020-10-12 13:33:46 +02:00
5bf90558c7 test(c-api) Fix the early-exit test. 2020-10-12 13:17:40 +02:00
bb9149bfe3 Merge #1685
1685: feat(c-api) Implement `wasm_exporttype_delete` r=Hywan a=Hywan

This PR implements the destructor for `wasm_exporttype_t`.

Co-authored-by: Ivan Enderlin <ivan@mnt.io>
2020-10-12 11:16:06 +00:00
4584a53840 fix(c-api) Remove rustc warnings. 2020-10-12 13:12:37 +02:00
202ffe7771 fix(c-api) Fix wasm_func_call when params are empty.
`wasm_$name_vec_t.into_slice` returns `None` if the vec is empty. So
an empty vec of `wasm_extern_t` given to `wasm_func_call` was raising
an error. This patch fixes this.
2020-10-12 12:20:29 +02:00
fea156defa feat(c-api) Update wasi_get_imports to use a wasm_extern_vec_t
… so that it matches the definition of `wasm_instance_new`, which is
much simpler and consistent.
2020-10-12 11:58:53 +02:00
fa7fe83bc0 feat(c-api) Update wasm_instance_new.
The `CArrayIter` type is no longer needed. This patch removes it.
2020-10-12 11:45:31 +02:00
e9cd710506 feat(c-api) Update wasm_func_call. 2020-10-12 11:25:17 +02:00
7f098387e8 faet(c-api) Update wasm_func_new_with_env. 2020-10-12 11:24:59 +02:00
5dffd976f5 feat(c-api) Update wasm_func_new. 2020-10-12 11:24:30 +02:00
d8dcb4133a feat(c-api) Update the definitions of wasm_func_callback*_t. 2020-10-12 11:23:52 +02:00