Commit Graph

351 Commits

Author SHA1 Message Date
Ivan Enderlin
cf0098ffd0 feat(c-api) wasm_module_new handles null pointers + use into_slice() for bytes. 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
35c4329150 feat(c-api) Generate errors when wasm_engine_new fails. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
ba6115f348 feat(c-api) More functions handle null pointers + rename variables. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
6f2957b4b3 feat(c-api) More functions handle null pointers. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
5db1ab7c37 feat(c-api) More functions handle null pointers. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
0ce3b27da1 feat(c-api) wasm_global_new handles null pointers. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
e27ce51303 feat(c-api) wasm_func_call handles null pointers. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
b42c699be0 feat(c-api) Support null pointers in wasm_func_new_with_env. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
2735461caf feat(c-api) wasm_func_new supports null pointers for its arguments. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
19cc55fb0d doc(c-api) Add another possible Rust pattern 2020-11-16 10:49:37 +01:00
Ivan Enderlin
ee71166f65 doc(c-api) Remove the // own inline doc. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
3df35e1aff fix(c-api) Fix memory leak in wasm_functype_new.
`wasm_functype_new` takes the ownership of `params` and `results`. By
using `Box`, we are sure they are dropped correctly inside the
function.
2020-11-16 10:49:37 +01:00
Ivan Enderlin
84d807716e doc(c-api) Add Dvelopment Notes. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
8ef36491d4 fix(c-api) wasm_exporttype_t owns its data. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
f3a542eb8c doc(c-api) Remove an outdated comment. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
d7bcf0442a fix(c-api) Correctly drop wasm_importtype_vec_t from wasm_module_imports. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
cc04d67263 fix(c-api) Fix a segfault and detect a new memory leak. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
4ab83ed545 fix(c-api) Remove TODO for From<&ImportType> for wasm_importtype_t.
A `String` is a `Vec<u8>` by definition, nothing more. Freeing one is
like freeing another.
2020-11-16 10:49:37 +01:00
Ivan Enderlin
8bdfad18d1 fix(c-api) wasm_importtype_t _owns_ its fields.
The `wasm.h` file defines `wasm_importtype_new` to take ownership of
the module, the name, and the extern type. This patch thus changes
`NonNull` to `Box` for those types.

`wasm_importtype_new` also handles null pointer with `Option<Box<T>>`
and returns an `Option<Box<T>>`.

The rest of the code is simplified. The patch fixes also some typos in
variable namings.
2020-11-16 10:49:37 +01:00
Ivan Enderlin
9635e43c08 fix(c-api) Remove the memory leak in wasm_tabletype_element. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
7212ab45fd fix(c-api) Remove memory leaks with wasm_tabletype_limits. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
1604999595 fix(c-api) Remove memory leak with wasm_globaltype_content. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
598c4cc276 fix(c-api) Remove memory leak with wasm_memorytype_limits. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
f49a10411e chore(c-api) Return references instead of pointers. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
7b727ccffe chore(c-api) Remove a warning by commenting an unreachable code. 2020-11-16 10:49:37 +01:00
Ivan Enderlin
cf9b1018c1 fix(c-api) Use the newly release of inline-c-rs. 2020-11-16 10:11:01 +01:00
jubianchi
96a0d73ef8 fix(c-api): Remove the use of to link to Wasmer C API. 2020-11-13 21:09:04 +01:00
Ivan Enderlin
458daebe8c fix(c-api) Add -rpath to the linker only on Linux. 2020-11-13 17:04:10 +01:00
Ivan Enderlin
7cfd2ad161 fix(c-api) Use latest version of inline-c-rs and fix rpath on Linux. 2020-11-13 15:23:21 +01:00
Ivan Enderlin
7c363ea451 test(c-api) Fix segfault. 2020-11-10 10:57:47 +01:00
Ivan Enderlin
5bbfc54757 chore(c-api) Run clang-format. 2020-11-10 10:53:20 +01:00
Ivan Enderlin
3c3c033cbd chore(c-api) Fix CS. 2020-11-10 10:51:18 +01:00
Ivan Enderlin
3b9e045259 test(c-api) Free wat and prevent failure in assert. 2020-11-10 10:49:20 +01:00
Ivan Enderlin
d6cd8c6d94 test(c-api) Use wasm_externtype_as_*_const. 2020-11-10 10:42:44 +01:00
Ivan Enderlin
4d81f9a27e chore(c-api) Fix CS. 2020-11-10 10:42:24 +01:00
Ivan Enderlin
6459f02154 Merge branch 'test-c-api-inline-c-rs' of github.com:Hywan/wasmer into test-c-api-inline-c-rs 2020-11-10 10:32:35 +01:00
Ivan Enderlin
f63dc943cc doc(c-api) Update and fix Doxygen. 2020-11-10 10:31:54 +01:00
Ivan Enderlin
75fba28702 Update lib/c-api/tests/wasmer_wasm.h
Co-authored-by: nlewycky <nicholas@mxc.ca>
2020-11-09 20:05:57 +01:00
Ivan Enderlin
c88886f09c Merge branch 'master' into test-c-api-inline-c-rs 2020-11-09 17:19:14 +01:00
Ivan Enderlin
a34600a3ad doc(c-api) Build the new Wasm C API. 2020-11-09 17:12:42 +01:00
Ivan Enderlin
d4809527f9 fix(c-api) Fix memory leaks with extern types. 2020-11-09 17:12:09 +01:00
Ivan Enderlin
47b8d289b4 test(c-api) Assert wasm_name_t has the expected size. 2020-11-09 16:24:46 +01:00
Ivan Enderlin
69e1b7ccc0 test(c-api) Rollback: Use assert intead of wasmer_assert. 2020-11-09 15:55:31 +01:00
Ivan Enderlin
637862dcdc test(c-api) Enable debug mode for C tests. 2020-11-09 15:45:17 +01:00
Ivan Enderlin
8e4ca4ee34 chore(c-api) Rename a parameter. 2020-11-09 15:28:45 +01:00
Ivan Enderlin
adb84e2bf6 feat(c-api) Allow extern types to own data.
We have known memory leaks with extern types. The idea is to change
the code so that extern types can hold/own data. This patch does that.

A `wasm_externtype_t` holds a `WasmExternType` enum. This enum owns
sibling types such as `WasmFunctionType`, `WasmGlobalType`,
`WasmTableType` and `WasmMemoryType`. It is those structures that ows
the extern types data, like `params` and `results` as
`wasm_valtype_vec_t` for `WasmFunctionType`. That way, for example,
`wasm_functype_t` can return a pointer to these vec which it owns.

A `wasm_externtype_t` continues to be transmuted to `wasm_functype_t`
etc. Nothing changes on that side.
2020-11-09 15:04:22 +01:00
Nick Lewycky
49b0a4a16a Prepare for 1.0.0-alpha5 release. 2020-11-06 11:50:07 -08:00
Ivan Enderlin
19fe6e482c test(c-api) _wasmer_assert_fail must exit the program. 2020-11-06 15:09:20 +01:00