Commit Graph

1044 Commits

Author SHA1 Message Date
Ivan Enderlin
2d20f44365 fix(c-api) Remove useless unsafe marker. 2021-03-04 23:39:43 +01:00
Ivan Enderlin
f233ca444e chore(api) The compiler feature enables wasmer-compiler/translator. 2021-03-04 23:17:14 +01:00
Ivan Enderlin
4f2ba728dd feat(c-api) Simplify the metering API.
This patch removes the following type and functions:

* `wasmer_metering_points_t`,
* `wasmer_metering_points_delete`,
* `wasmer_metering_points_is_exhausted`,
* `wasmer_metering_points_t`,
* `wasmer_metering_points_unwrap_or`.

Now, `wasmer_metering_get_remaining_points` returns the number of
points, with zero to represent `MeteringPoints::Exhausted`.

The API is greatly simplified as there is no longer need to allocate
and deallocate a `wasmer_metering_points_t` type.
2021-03-04 22:53:02 +01:00
Ivan Enderlin
f0024c5994 doc(c-api) Fix typos. 2021-03-04 22:34:04 +01:00
Ivan Enderlin
072066acaf Merge branch 'master' into feature/metering-c-api 2021-03-04 22:31:12 +01:00
Ivan Enderlin
e7c78e77ee test(c-api) Update tests for the metering API. 2021-03-04 21:49:39 +01:00
Ivan Enderlin
0163b33ff3 test(c-api) Update the test to use a custom user-defined cost function. 2021-03-04 17:29:39 +01:00
Ivan Enderlin
e2c4f1ee69 feat(c-api) Rename Operator to wasmer_parser_operator_t. 2021-03-04 17:15:28 +01:00
Ivan Enderlin
7780423c81 feat(c-api) wasmer_metering_t contains a closure to the cost function. 2021-03-04 17:07:47 +01:00
Syrus Akbary
4fb94aff7e Updated header files 2021-03-03 22:14:12 -08:00
Syrus Akbary
392f50a1af Update dependencies. Use Clap 3.0.0-beta2 instead of StructOpt 2021-03-03 21:47:49 -08:00
jubianchi
52901850a9 chore: Build Wasmer on musl
Closes #1482
Closes #1766
2021-03-03 17:07:47 +01:00
Ivan Enderlin
902f58e32d !tmp 2021-03-02 17:42:43 +01:00
Ivan Enderlin
0c4e0633f4 chore(c-api) Update headers. 2021-03-02 16:32:54 +01:00
Ivan Enderlin
19c04124b1 doc(c-api) Write more documentation and tests. 2021-03-02 16:32:02 +01:00
Ivan Enderlin
798dd888c4 feat(c-api) Simplify a compilation condition. 2021-03-02 15:24:48 +01:00
Ivan Enderlin
31669b8cdc feat(c-api) Rename wasmer_module_middleware_t to wasmer_middleware_t.
Also, move it into the `unstable::middleware` module.
2021-03-02 15:20:23 +01:00
Ivan Enderlin
fb973b2af1 fix(c-api) wasmer_module_middleware_t is an opaque type. 2021-03-02 14:58:18 +01:00
Ivan Enderlin
6e50e24643 test(c-api) Add the features example. 2021-03-02 14:48:02 +01:00
Ivan Enderlin
8f1a4f3406 feat(c-api) Add wasmer_metering_delete. 2021-03-01 17:31:04 +01:00
Ivan Enderlin
e67fd6acf6 feat(c-api) Update headers + add the MIDDLEWARES_FEATURE_AS_C_DEFINE constant. 2021-03-01 17:21:43 +01:00
Ivan Enderlin
cb02694abc test(c-api) Add tests for the wasmer_metering_* API. 2021-03-01 17:11:09 +01:00
Ivan Enderlin
8b30ae9d41 feat(c-api) Add _delete and rename _value to wasmer_metering_points_unwrap_or. 2021-03-01 17:10:27 +01:00
Ivan Enderlin
db4286d576 fix(c-api) Fix merge conflict. 2021-03-01 16:44:04 +01:00
Ivan Enderlin
0f43391b78 Merge branch 'master' into feature/metering-c-api 2021-03-01 16:43:16 +01:00
Ivan Enderlin
cbbdfdaefa temp 2021-03-01 16:41:44 +01:00
Ivan Enderlin
807bd2d1ee feat(c-api) Update headers. 2021-03-01 16:06:20 +01:00
Ivan Enderlin
d1fc49d9c2 feat(c-api) Introduce the wasmer_features_t unstable API.
This API is a wrapper around the `wasmer_types::Features` API. A new
function `wasm_config_set_features` allows to define features for the
engine and the compiler.
2021-03-01 16:02:43 +01:00
Ivan Enderlin
fd5a9b50d6 chore(c-api) Update headers. 2021-03-01 15:28:37 +01:00
Ivan Enderlin
2bc502bd47 fix(c-api) Move the middleware API into the unstable module. 2021-03-01 15:27:56 +01:00
Ivan Enderlin
d660943b45 feat(c-api) Simplify &Box<T> to &T. 2021-03-01 15:13:40 +01:00
Ivan Enderlin
527d5d97d9 chore(c-api) Fix merge conflicts. 2021-02-18 15:16:00 +01:00
Ivan Enderlin
bd25fafeb5 Merge branch 'master' into chore-c-api-formalization 2021-02-18 15:15:11 +01:00
Ivan Enderlin
830efaac17 fix(c-api) Use the name wasm_config_set_.
See the discussion here
https://github.com/wasmerio/wasmer/pull/2117#discussion_r575303872.
2021-02-18 15:04:21 +01:00
Ivan Enderlin
fbe4e07476 test(c-api) Remove no_run for 2 doctests. 2021-02-12 10:44:14 +01:00
Ivan Enderlin
bd412ea2e5 chore(c-api) Update headers. 2021-02-12 10:36:49 +01:00
Ivan Enderlin
93a427505e doc(c-api) Add documentation. 2021-02-12 10:35:54 +01:00
Ivan Enderlin
bdcc95925c test(c-api) Add tests for the wasmer_is_*_available API. 2021-02-12 10:29:58 +01:00
Ivan Enderlin
17dbb32e5a feat(c-api) Do not rename wat2wasm for the moment. 2021-02-12 00:26:53 +01:00
Ivan Enderlin
359873c1a1 feat(c-api) Add an unstable non-standard API to query available engines and compilers. 2021-02-12 00:20:23 +01:00
Ivan Enderlin
fd6689c580 chore(c-api) Formalize API prefixes.
The new rule is the following:

* `wasm_` for the standard C API,
* `wasmer_` or `wasi_` for the Wasmer non-standard C API.

For all symbols inside the `unstable` module, the renaming `wasm_` to
`wasmer_` is done without deprecations. It was clear that those API
were unstable.

For all the other symbols, symbols have been renamed to `wasmer_` but
the old symbols have been kept with deprecation warnings.

Special note: The `wasm_named_extern_t` type (and associated
functions) was in `wasi` by mistake. Its place was in the `unstable`
module. This patch also fixes that.

The `wasm_declare_vec_*` macros have been updated to support a default
prefix, or a user-defined prefix. It's now possible to write
`wasm_declare_boxed_vec!(foo);` to get all the API prefixed by `wasm_`
(as previously), or `wasm_declare_boxed_vec!(foo, wasmer);` to prefix
with `wasmer_`.

A user not using symbols from the `unstable` module will continue to
get working code, modulo some deprecations, after this patch.
2021-02-11 23:56:36 +01:00
Nick Lewycky
197d0f7a49 Initial commit of C API for metering and middleware. 2021-02-09 01:20:34 -08:00
Ivan Enderlin
f85ebe1b21 fix(c-api) Fix how string's length is computed.
Obviously, it's just `feature.size`. Why did I do that…?
2021-02-05 10:09:43 +01:00
Nick Lewycky
fb429e0a6e Update the C API header files. 2021-02-04 19:53:41 -08:00
Nick Lewycky
9e1cec01be Prepare for 1.0.2 release 2021-02-04 19:44:49 -08:00
Syrus Akbary
e5fd42ebaf Merge pull request #2093 from Hywan/feat-c-api-env-instance
feat(api,vm) Improve the `vm::ImportInitializerFuncPtr` type.
2021-02-04 16:05:08 -08:00
Ivan Enderlin
f0f1915c86 chore(c-api) Rename or add variables for more clarity. 2021-02-04 14:00:00 +01:00
Ivan Enderlin
30095e1600 fix(c-api) Do not run build.rs if the scripts/publish.py script is running. 2021-02-02 14:26:58 +01:00
Ivan Enderlin
698a26c7fe fix(c-api) Restore a bug with wasi_get_imports.
We said that `wasi_get_imports` was taking ownership of
`wasi_env_t`. It wasn't. In 9e63ba9a25,
we have fixed this. But it creates another bug when `wasi_env_t` is
used _after_ for example when calling `wasi_env_read_stdout`.

So this patch reverts the bug fix. And we will discuss about how to
fix that later.
2021-02-02 13:42:29 +01:00
Ivan Enderlin
e5d5303b50 Merge branch 'master' into feat-c-api-wasi-unordered-imports 2021-02-02 12:17:01 +01:00