Commit Graph

136 Commits

Author SHA1 Message Date
bef9f1244a Return impl Compiler from default_compiler to fix compilation with features 2019-05-14 18:19:58 -05:00
19eba19603 Merge branch 'master' into doc-runtime-c-api
# Conflicts:
#	lib/runtime-c-api/src/lib.rs
2019-05-13 15:55:20 -07:00
b050144898 Merge branch 'master' into fix-runtime-c-api-error-length 2019-05-13 10:59:11 +02:00
8c8586faaa test(runtime-c-api) Assert returned value from wasmer_last_error_message. 2019-05-13 10:52:55 +02:00
bedd305b06 doc(runtime-c-api) Fix inline comment. 2019-05-13 10:52:43 +02:00
2aefa731a6 Add deny for unreachable patterns and unused unsafe 2019-05-12 00:33:02 -05:00
85158ac22a Add some initial deny for unused_imports and unused_variables
Additional unused variable fix on unix

Remove unused import on unix

Remove unused windows import
2019-05-11 09:23:25 -05:00
7d2721ef7a fix(runtime-c-api) wasmer_last_error_message returns the length + 1.
Returning the error message's length + 1 mimics the
`wasmer_last_error_length` function that counts the trailing null
byte.
2019-05-10 16:00:13 +02:00
1d555301f7 feat(runtime-c-api) Check buffer size before creating the slice.
It's safer to check the buffer size is large enough to hold the error
message before creating the slice from raw parts.

Also, this patch remove the need for `last_error`, simplifying the
code a little bit. The `length` variable is casted to `usize` once.
2019-05-10 15:55:02 +02:00
e5dc94c7d6 update version number to 0.4.1 2019-05-06 18:02:39 -07:00
d020ffd759 update version to 0.4.0 2019-04-29 13:26:51 -07:00
d507253372 update crate version numbers to 0.3.0 2019-04-12 12:19:46 -07:00
1c063090c5 doc(runtime-c-api) Add short module descriptions. 2019-03-29 16:35:35 +01:00
8ee0f16c8a fix(runtime-c-api) Remove last warnings. 2019-03-29 15:56:08 +01:00
849af62911 feat(runtime-c-api) Finish to extract last pieces of code. 2019-03-29 15:52:41 +01:00
361ff81db7 feat(runtime-c-api) Extract the import module. 2019-03-29 15:50:16 +01:00
9c4696eb5b feat(runtime-c-api) Extract the export module. 2019-03-29 15:38:12 +01:00
f46be814da feat(runtime-c-api) Extract the instance module. 2019-03-29 15:14:05 +01:00
d06d6b7ac8 feat(runtime-c-api) Extract the global module. 2019-03-29 15:05:17 +01:00
8bdb458ea7 feat(runtime-c-api) Extract the table module. 2019-03-29 15:02:50 +01:00
4239975240 feat(runtime-c-api) Move wasmer_validate into the module module. 2019-03-29 14:59:02 +01:00
55c010688c feat(runtime-c-api) Extract the memory module. 2019-03-29 14:57:08 +01:00
168aa8031f feat(runtime-c-api) Extract the module module. 2019-03-29 14:51:35 +01:00
96324977b5 feat(runtime-c-api) Extract the error module. 2019-03-29 14:41:39 +01:00
49c01f6093 feat(runtime-c-api) Extract the value module. 2019-03-29 14:40:26 +01:00
a59ce13810 chore(runtime-c-api) Build the C and C++ headers. 2019-03-27 10:50:40 +01:00
4d0312f0ed test(runtime-c-api) New test suite for wasmer_export_to_memory. 2019-03-27 10:49:28 +01:00
6fca475564 feat(runtime-c-api) Implement the wasmer_export_to_memory function.
This new function returns a `wasmer_memory_t` from a
`wasmer_export_t`.
2019-03-27 10:44:47 +01:00
5661540097 chore(runtime-c-api) Move .wasm files into the assets directory. 2019-03-27 09:42:56 +01:00
c0f4b6a87c Merge branch 'master' into feat-runtime-c-api-cache 2019-03-19 16:35:32 +01:00
57a82fa5cf fix(runtime-c-api) wasmer_serialized_module_from_bytes accepts bytes + length instead of wasmer_byte_array. 2019-03-19 16:24:59 +01:00
44373aae94 feat(runtime-c-api) Mirrors the debug and llvm features.
`wasmer-runtime` has a `debug` and a `llvm` features. Let's mirror
them in `wasmer-runtime-c-api` so that the user can, for instance,
compile with the LLVM backend.
2019-03-19 11:12:19 +01:00
46edd20725 feat(runtime-c-api) Add the wasmer_serialized_module_from_bytes function.
This function is required to transform a `wasmer_byte_array` into a
`wasmer_serialized_module_t`. This is the complementary function of
`wasmer_serialized_module_bytes`.
2019-03-19 10:51:43 +01:00
5e31a1b6d1 feat(runtime-c-api) Introduce the wasmer_serialized_module_t struct type.
The `wasmer_module_serialize` function now computes a
`wasmer_serialized_module_t` value. The `wasmer_module_deserialize`
function takes this value as an input. Same for
`wasmer_serialized_module_destroy`.

The new function `wasmer_serialized_module_bytes` allows to read the
bytes inside the `wasmer_serialized_mdule_t` structure.
2019-03-19 10:04:31 +01:00
f049e9b0b3 fix(runtime-c-api) Remove explicity drop.
When the value goes out-of-scope, `drop` is called utomatically.
2019-03-18 16:09:02 +01:00
6605a02316 feat(runtime-c-api) Add the wasmer_module_serialization_destroy function. 2019-03-18 16:05:04 +01:00
aac5c88b58 doc(runtime-c-api) Update the documentation of wasmer_module_deserialize. 2019-03-15 12:18:52 +01:00
082c93ceba chore(runtime-c-api) Fix a merging error. 2019-03-15 12:04:23 +01:00
2368ce3a20 chore(runtime-c-api) Regenerate the wasmer.hh? files. 2019-03-15 12:04:23 +01:00
c8872f1a6f test(runtime-c-api) Test the new wasmer_module_(de)?serialize functions.
This test suite compiles a module, then serializes it, deserializes
it, and continues by creating an instance and calling a function on
it. It allows to test the entire roundtrip.
2019-03-15 12:04:23 +01:00
f2760249b6 fix(runtime-c-api) Reorganize the tests by alphabetic order. 2019-03-15 12:04:23 +01:00
c142e16d12 feat(runtime-c-api) Implement the wasmer_module_(de)?serialize functions.
This patch implements 2 functions:

  1. `wasmer_module_serialize`, and
  2. `wasmer_module_deserialize`.
2019-03-15 12:04:23 +01:00
f57f8bc0cb fix(runtime-c-api) Use imported symbols.
`std::slice` is already imported. This patch then rewrites `::std::slice::` into `slice::`.
2019-03-15 12:04:23 +01:00
5b98ee732c feat(runtime-c-api) wasmer_validate expects a *const uint8_t.
This patch updates the first argument of `wasmer_validate` from `*mut
uint8_t` to `*const uint8_t`. Indeed, the
`wasmer-runtime-core::validate` function doesn't expect a mutable
slice, so it's not required to expect a mutable array from C.

Also, it's likely for the Wasm bytes to be stored in the
`wasmer_byte_array` structure. The first field `bytes` is defined as
`*const uint8_t`. So this patch avoids a cast when writing a C++
program.
2019-03-14 12:33:40 +01:00
5db05fd609 Merge branch 'master' into feat-runtime-c-api-instance-context-data 2019-03-12 09:02:05 +01:00
a390a28384 fix(runtime-c-api) Fix Clippy errors. 2019-03-12 08:58:22 +01:00
675f6817ba test(runtime-c-api) Free allocations.
Don't forget to free `context_data` :-).
2019-03-11 17:41:17 +01:00
170de02dd3 test(runtime-c-api) Test the wasmer_instance_context_data_* functions. 2019-03-11 17:34:13 +01:00
a11d454130 feat(runtime-c-api) Add an API to update vm::Ctx.data.
This patch adds 2 functions for the runtime C API, respectively
`wasmer_instance_context_data_set` and
`wasmer_instance_context_data_get`. The goal is to modify the
`vm::Ctx.data` field in the `runtime-core` library.

This is required to pass dynamic data to imported functions for
instance.
2019-03-11 16:50:18 +01:00
3fea07dc8a fix(runtime-c-api) Fix the imports length.
`imports` contains `func_import`, `global_import`, `memory_import` and
`table_import`, so 4 items. This patch updates the length of `imports`
when calling the `wasmer_instantiate` function.
2019-03-11 14:35:51 +01:00