Commit Graph

205 Commits

Author SHA1 Message Date
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
8b38dd575e feat(c-api) Implement wasm_val_vec_t. 2020-10-12 11:22:54 +02:00
18729709bf feat(c-api) Update wasm-c-api repository.
This change is important because `wasm.h` contains new functions, like
`wasm_name_new_from_string_nt`, which are useful for the Go
implementation.
2020-10-09 14:37:07 +02:00
61c88be863 Prepare for 1.0.0-alpha4 release 2020-10-08 16:47:14 -07:00
d687dd5bd6 Add system-libffi feature to wasmer C API crate 2020-10-08 14:59:42 -07:00
02c0df5101 Update to cbindgen 0.15.0
Manually specify that items should be sorted by name in the header
file. We do this because cbindgen 0.15.0 removed sorting by default.
2020-10-08 14:42:00 -07:00
80459f3ae0 feat(c-api) Replace the max limit sentinel value by a constant.
In the `wasm.h` header file, it is defined by `wasm_limits_max_default`.
2020-10-08 17:24:12 +02:00
f6595cdd33 fix(c-api) Fix the sentinel value returned by wasm_memorytype_limits. 2020-10-08 17:23:59 +02:00
5d19813e63 fix(c-api) wasm_limits_t contains Pages, not Bytes.
When building a `wasm_memorytype_t` with `wasm_memorytype_new`, we
pass a `wasm_limits_t`, where `min` and `max` represent `Pages`. This
semantics is set by `wasm_memorytype_new` itself where `min` and `max`
from `wasm_limits_t` are used to compute `Pages`, which are then passed
to `MemoryType`.

Then, in `wasm_memorytype_limits`, we expect to get the same
`wasm_limits_t` given to `wasm_memorytype_new`. But it's not!

The same `MemoryType` is read, good. The `minimum` and `maximum`
fields are `Pages`, good. Then, we compute the `min` and `max` values
for the resulting `wasm_limits_t`, which receive `Page.bytes().0`, not
good! We don't want the number of bytes, but the number of pages.

This patch fixes that.
2020-10-08 17:14:45 +02:00
f7d5a11b39 Fix sentinel value in wasm_limits_t for memory in wasm_c_api 2020-10-07 16:38:23 -07:00
ea8bb1ee79 Merge branch 'master' into feature/engine-object-file 2020-10-06 17:50:55 -07:00
e6bc138b10 Remove ability to use object file engine with compiler from C API
Due to the way object file engine works, it only makes sense to use in
headless mode from the C API.
2020-10-06 17:39:51 -07:00
aa2e8f7b4d Address more feedback, clean up code 2020-10-06 12:13:59 -07:00
c3efc06e87 test(c-api) Add test case for wat2wasm. 2020-10-06 20:56:36 +02:00
264ed836ac feat(c-api) Use c_try! and From implementations to simplify wat2wasm. 2020-10-06 20:56:21 +02:00
78887c378e chore(c-api) Simplify code. 2020-10-06 11:14:46 +02:00
ded3132b44 feat(c-api) Implement wat2wasm. 2020-10-06 11:09:35 +02:00
ab153fc642 Improve error messages around memory creation 2020-10-05 15:45:52 -07:00
0f8d68652f Finish merge with C API refactor 2020-10-05 12:30:58 -07:00
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
ff4cb6d412 feat(c-api) Implement wasm_module_validate. 2020-10-05 14:49:23 +02:00
f0487763bf Readd functionality from object file engine 2020-10-02 17:31:18 -07:00
1572ae1d5c Merge branch 'master' into feature/engine-object-file 2020-10-02 17:31:06 -07:00
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
e6c61c74ff Update boxed_vec to deal with boxed values 2020-10-02 16:33:03 -07:00
34e6139570 Add conversion logic for boxed_vec, simplify vec creation code 2020-10-02 16:24:46 -07:00
3845e5fd67 Clean up binary files from C API refactor 2020-10-02 15:30:13 -07:00
92ca7899f5 chore(c-api) Use canonical path to wasm*.h headers. 2020-10-02 11:15:37 +02:00
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
7f4862117f doc(c-api) Write a quick introduction to the crate. 2020-10-02 10:40:26 +02:00
2fdd9ea692 feat(c-api) Simplify the build.rs script. 2020-10-02 10:10:24 +02:00
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
1a45756cad test(c-api) Use the REQUIRED option of find_library. 2020-10-02 09:45:34 +02:00
d5fa525612 test(c-api) Enable the test-early-exit test case. 2020-10-01 23:23:41 +02:00
ddbbd96f1c test(c-api) Run make clean before, in case of. 2020-10-01 23:23:23 +02:00
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
68d6292c35 test(c-api) Restore the test-wasi and disable the test-early-exit. 2020-10-01 21:40:02 +02:00
5d9fc86bb8 test(c-api) Enable the wasi-c-api-trap test case. 2020-10-01 21:27:18 +02:00
a117df1740 chore(c-api) Remove a warning about wasm_frame_t case. 2020-10-01 21:26:45 +02:00
3a81643ff0 chore(c-api) Update header files. 2020-10-01 21:23:06 +02:00
a2854ebfea fix(c-api) Adjust cbindgen metadata for header files. 2020-10-01 21:20:13 +02:00
ecb79e2af0 fix(c-api) Cherry-pick manually from https://github.com/wasmerio/wasmer/pull/1657. 2020-10-01 21:16:29 +02:00
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
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
916f50463f doc(c-api) Restore the README.md. 2020-10-01 14:22:30 +02:00