Commit Graph

934 Commits

Author SHA1 Message Date
jubianchi
6a99268895 feat(llvm): Make NaN canonicalization configurable
compiler-llvm now uses the experimental.constrained intrinsics to ensure
correct behavior on FP operations when full-canonicalization is
disabled.

This patch requires TheDan64/inkwell#247
2021-05-28 11:40:10 +02:00
Ivan Enderlin
39842c67e7 Update lib/c-api/src/wasm_c_api/engine.rs
Co-authored-by: Julien BIANCHI <contact@jubianchi.Fr>
2021-05-27 13:07:04 +02:00
Ivan Enderlin
23e52b7c1d !fixup 2021-05-27 13:05:21 +02:00
Ivan Enderlin
14f469f718 Merge branch 'master' into feat-rename-jit-engine 2021-05-27 13:01:02 +02:00
Mark McCaskey
3151cc945e Update changelog 2021-05-26 08:57:11 -07:00
Mark McCaskey
810cb5d96a Implement missing C API function wasm_func_copy 2021-05-26 08:47:01 -07:00
Ivan Enderlin
e5a784a006 feat: Rename wasmer-engine-jit to wasmer-engine-universal.
This (small) patch renames the `wasmer-engine-jit` crate into
`wasmer-engine-universal`.
2021-05-25 16:12:06 +02:00
Syrus Akbary
2e90db6967 Addressed comments 2021-05-18 14:32:21 -07:00
Syrus Akbary
71176cca7a Unified C API tests 2021-05-15 09:15:50 -07:00
Mark McCaskey
9a0d0b3dac Update wasmparser in the c-api too 2021-04-29 09:42:54 -07:00
k-nasa
40ee361586 fix favicon 2021-04-24 15:34:44 +09:00
bors[bot]
caf98ef450 Merge #2092
2092: Add reference types r=MarkMcCaskey a=MarkMcCaskey

This PR adds support for reference types in the API and in our compilers.

Wasm C API support should probably be a separate PR after this one lands.

# Status
- [x] spectests passing
  - [x] compiler-cranelift
  - [x] compiler-singlepass
  - [x] compiler-llvm
- [x] Tables work with references
- [x] Globals work with references
- [x] FuncRefs for local functions
- [x] FuncRefs for imported functions
- [ ] ExternRefs
  - [x] Work as values in Wasm
  - [x] Tests showing it being passed to/from host functions
  - [x] Top level API for interacting with ExternRefs
  - [ ] Reference counting works as expected, fully tested
- [ ] ~~Wasm C API support (should be done on a PR branched off of this branch)~~ (not going to do this in this PR)
- [x] ~Host info (see Wasm C API and wasmer Rust API)~ (not going to do this in this PR. The value of this feature seems low and the cost seems high; unclear if we even want it at the Rust API level)

# Review
<!--
## High priority things to review

- [ ] ExternRef reference counting behavior (blocked on implementation, but feedback of what's there is welcome)
  - [ ] That we're counting in all the places that matter (we're not yet)
  - [ ] The manual `ref_clone` and `ref_drop` in order to make putting `VMExternRef` in a `union` work.
- [ ] FuncRef storage
  - [ ] Distinction between imported and local FuncRef
  - [x] Duplicating data rather than storing it inline in the dynamic part of the `Instance`
- [ ] Changes to `wasmer_types::Value`
  - [ ] ExternRef
  - [ ] FuncRef / ValueEnumType
  - [ ] Passing a store via `&dyn Any` to some methods and the garbage placeholder values we pass when we don't have a store.
  - [ ] The location of the `Option` for `FuncRef` 
- [x] Implementation of new instructions (bug check)
- [ ] API changes
  - [ ] Changes in the wasmer crate
  - [ ] Changes in the core traits for example `vm::Table`
- [ ] Use of `repr(C)` union `vm::table::TableElement` in `extern "C"` / FFI contexts. I just assumed `repr(C)` on a union of all usize sized things would just be passed like a usize.
- [ ] WAST test runner updates

## Lower priority things to review

These are things that I think we can fix with follow-up PRs. Let me know if you think anything on this list is too important to fix later.

- [ ] Implementation of new instructions (calling functions rather than doing it inline)
- [ ] Use of libcalls distinguishing between imported vs local in cases where it probably doesn't matter
-->
# misc

- [ ] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Nick Lewycky <nick@wasmer.io>
2021-04-06 19:27:20 +00:00
Mark McCaskey
269df82043 Merge branch 'master' into fix/c-api-allocation 2021-04-06 10:16:02 -04:00
Mark McCaskey
12406d64b3 Add a new CHANGELOG.md for the C API 2021-04-06 07:15:21 -07:00
Mark McCaskey
0fad04f63f Add test for tag offset 2021-04-06 07:04:47 -07:00
Mark McCaskey
8149453ff5 Merge branch 'master' into feature/reference-types 2021-03-31 08:42:26 -07:00
Mark McCaskey
bc8cb68d84 Update examples to not free things cast from extern 2021-03-30 08:47:18 -07:00
Mark McCaskey
f266f830f2 Implement wasm_extern_t with type casting 2021-03-26 13:55:24 -07:00
bors[bot]
2948bc79b6 Merge #2210
2210: Fix memory leak in C API in some uses of `wasm_name_t` r=MarkMcCaskey a=MarkMcCaskey

This PR fixes a bug relating to `wasm_importtype_t` leaking memory, particularly on the path where `String` is converted into `wasm_name_t`. It fixes this by introducing a new type, `owned_wasm_name_t`, which is identical to `wasm_name_t` but has RAII and calls the destructor if it goes out of scope.

I'm not confident that the use of `owned_wasm_name_t` on the FFI boundary is correct though, we'll have to thoroughly review that before shipping this PR.

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Mark McCaskey <mark@wasmer.io>
2021-03-26 15:39:09 +00:00
Mark McCaskey
7ef7bf0c48 Simplify as_ref() code due to lack of Box 2021-03-25 12:55:45 -07:00
Mark McCaskey
e3eb1b6ad1 Explicitly convert to owned_wasm_name_t in export and wasi too 2021-03-25 12:46:43 -07:00
Mark McCaskey
769707a51d Explicitly convert to owned_wasm_name_t 2021-03-25 10:55:26 -07:00
François Garillot
b832de05df Simplifies a few pattern-matches
... which have a direct combinator equivalent on Option / Result.

Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust).
2021-03-24 07:18:26 -07:00
Mark McCaskey
8516d07c62 Fix memory leak in C API in some uses of wasm_name_t
Converting from `String` means that the type should auto-destruct to make sure
we free that memory. The memory can still be freed manually though. We need
thorough review for the changes were the `owned_wasm_name_t` is coming from user
code. Is it guaranteed that `wasm_name_t` coming from the user always uses a
host allocation? I don't think so, in which case, we have to find some way to
handle transfer of ownership where it's unclear who owns it...
2021-03-23 13:28:59 -07:00
Ivan Enderlin
e1e2f03c7c fix: Rename lib/wasmer-types/ to lib/types/. 2021-03-23 17:36:58 +01:00
Mark McCaskey
9868c0f297 Add wip solution to wasm_extern_as_ no allocation 2021-03-23 09:01:01 -07:00
Mark McCaskey
979b9da566 Merge branch 'master' into feature/reference-types 2021-03-22 11:51:04 -07:00
Mark McCaskey
5650e12f40 Fix wasm_instance_exports exports memory leak in C API tests 2021-03-18 08:30:11 -07:00
Mark McCaskey
1a56ff2cc8 Fix wat and exports memory leak in all examples 2021-03-18 08:16:17 -07:00
Mark McCaskey
b09b85ada5 Update memory Wasm C API example 2021-03-18 07:51:34 -07:00
Mark McCaskey
7ab71dddad Update deprecated C API to use table API correctly
Enable ExternRef in deprecated C API
2021-03-17 09:14:03 -07:00
bors[bot]
ea4ea47e17 Merge #2003
2003: chore: Build Wasmer on musl r=jubianchi a=jubianchi


This patch adds a specific build for musl. Currently, it will only support JIT engine.

I also changes the workflow definition a bit so we don't depend on the OS name but rather on the environment ID which is our convention.

Closes #1482
Closes #1766

<!-- 
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests

-->

# Description
<!-- 
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->

# Review

- [ ] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: jubianchi <julien@wasmer.io>
2021-03-05 20:24:45 +00:00
Syrus Akbary
1db36fbc34 Merge pull request #2163 from wasmerio/fix-c-api-doc-location
fix: C API location and links are now correct
2021-03-05 11:05:58 -08:00
Ivan Enderlin
21ea09f8ff chore(c-api) Fix merge conflicts. 2021-03-05 01:03:54 +01:00
Ivan Enderlin
d3f7b7ef70 chore(c-api) Change operator to wasm_operator (reserved keyword in C++). 2021-03-05 00:57:40 +01:00
Ivan Enderlin
06a00d9bd0 doc(c-api) Update documentation for clarity. 2021-03-05 00:56:18 +01:00
Ivan Enderlin
1700c2d056 feat(c-api) Return ~1 if metering are exhausted. Add wasmer_metering_points_are_exhausted. 2021-03-05 00:49:13 +01:00
Ivan Enderlin
96524b5796 chore(c-api) Update headers. 2021-03-05 00:23:46 +01:00
Ivan Enderlin
41365360a7 Merge branch 'master' into feature/metering-c-api 2021-03-05 00:18:07 +01:00
jubianchi
feb3963897 fix: C API documentation location and links are now correct 2021-03-04 23:54:40 +01:00
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