Commit Graph

22 Commits

Author SHA1 Message Date
Ivan Enderlin
7a30c31a6f test+doc(c-api) Add test for wasm_instance_exports. 2020-12-15 15:59:57 +01:00
Ivan Enderlin
6d74163462 doc(c-api) Specify that the code does not panic. 2020-12-10 16:18:32 +01:00
Ivan Enderlin
4740202e90 test(c-api) Fix tests. 2020-12-10 16:14:13 +01:00
Ivan Enderlin
f2a2cf4265 Merge branch 'master' into test-c-api 2020-12-01 11:37:41 +01:00
Ivan Enderlin
37240bdc10 test(c-api) Start testing the instance module. 2020-11-30 16:56:56 +01:00
Ivan Enderlin
eb01733839 doc(c-api) Document the instance module. 2020-11-30 16:56:45 +01:00
Mark McCaskey
a19705ae11 Remove free method, call finalizers in C API 2020-11-16 16:36:58 -08:00
Ivan Enderlin
69c23fd78f doc(c-api) Add the own annotation when necessary. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
ce10285be2 fix(c-api) Remove done TODO. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
152f1d980c feat(c-api) wasm_instance_new handles null pointers. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
9583a91678 fix(c-api) wasm_trap_t** in wasm_instance_new does not represent an array.
The `wasm_trap_t**` argument of `wasm_instance_new` represents an
output pointer to a `wasm_trap_t*`, not an array of
`wasm_trap_t*`. This patch updates the code accordingly.
2020-10-30 09:37:05 +01:00
Ivan Enderlin
4102dcb9ac feat(c-api) Shrink vector of traps.
Ensure that the size of the vector of the instance's traps equals its
capacity by shrinking it.
2020-10-27 11:49:01 +01:00
Ivan Enderlin
452181326a fix(c-api) Remove a debug_assert macro. 2020-10-27 11:44:38 +01:00
Ivan Enderlin
a2d96d9ba7 feat(c-api) Implement the traps argument of wasm_instance_new.
When running `Instance::new`, it can error with an
`InstantiationError`. There is 2 scenarii:

1. Either it's a `InstantiationError::Link`. In this case, the
   `wasm_instance_new` function must return `NULL` and register the
   error in the Wasmer error registry.

2. Either it's a `InstantiationError::Start`. In this case, the
   `wasm_instance_new` function must return `NULL` and the error must be
   converted into a `wasm_trap_t`, which is stored in the `wasm_trap_t**`
   array. This array is initialized by `wasm_instance_new` itself.
2020-10-26 15:27:20 +01:00
Ivan Enderlin
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
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
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
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
174b03f4e9 feat(c-api) Use our fork of cbindgen.
Our fork contains incoming PR. It helps for example to skip struct
fields.
2020-09-24 16:15:04 +02:00
Ivan Enderlin
1a0527af78 feat(c-api) Move all types into their own modules. 2020-09-24 11:41:04 +02:00
Ivan Enderlin
44559a9f04 feat(c-api) Move as_extern APIs into the externals module. 2020-09-24 09:48:56 +02:00
Ivan Enderlin
50fbb9766d feat(c-api) Move instance into its own module. 2020-09-24 09:19:53 +02:00