-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(runtime-c-api) Ability to generate ImportObject
for a specific WASI version
#1030
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hywan
added
🎉 enhancement
New feature!
📦 lib-c-api
About wasmer-c-api
🧪 tests
I love tests
labels
Dec 2, 2019
Hywan
commented
Dec 2, 2019
Hywan
added a commit
to Hywan/wasmer
that referenced
this pull request
Dec 2, 2019
bors try |
MarkMcCaskey
approved these changes
Dec 2, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, though see my feedback on #1028 ; I think we should probably add a new method if we want to do fuzzy matching on module's import signatures
tryBuild succeeded |
Hywan
added a commit
to Hywan/wasmer
that referenced
this pull request
Dec 4, 2019
Hywan
force-pushed
the
feat-runtime-c-api-wasi-version
branch
2 times, most recently
from
December 4, 2019 13:42
639c81a
to
b9679eb
Compare
Hywan
added a commit
to Hywan/go-ext-wasm
that referenced
this pull request
Dec 4, 2019
… WASI version. This patch introduces 2 new functions: * `wasmer_wasi_generate_import_object_for_version` and * `wasmer_wasi_get_version`. It mimics the current API provided by `wasmer_wasi`, nothing fancy here. It's just a regular port to C/C++. Because `wasmer_wasi::get_wasi_version` returns an option, and in order to simplify the C/C++ API, `wasmer_wasi_get_version` can return `Version::Unknown` in case of an error. It's up to the user to check the version is valid (i.e. not unknown).
This patch updates `test-wasi-import-object` to test the new `wasmer_wasi_get_version` & `wasmer_wasi_generate_import_object_for_version` functions, and the new `Version` type.
When the version has type `Version`, we expect the user to give a valid `Version` variant. Since the `Version` is basically a `uint8_t`, the user is able to pass everything she wants, which can create an undefined behavior on the Rust side. To avoid such situation, the version has now type `c_uchar` (`unsigned char` or `uint8_t` on C side —on most platforms). Then the `From` trait is implemented on `Version`. In case the value is unbound, `Version::Unknown` is returned.
…ort_object_for_version`.
0 matches to `Unknown`, 1 matches to `Snapshot0` and 2 matches to `Snapshot1`.
Hywan
force-pushed
the
feat-runtime-c-api-wasi-version
branch
from
December 4, 2019 14:36
3f1fe12
to
4ef799f
Compare
This was referenced Dec 4, 2019
bors r+ |
bors bot
added a commit
that referenced
this pull request
Dec 6, 2019
1030: feat(runtime-c-api) Ability to generate `ImportObject` for a specific WASI version r=Hywan a=Hywan ❗️⚠️ Contains #1028, must be merged before this one. This patch introduces 2 new functions: * `wasmer_wasi_generate_import_object_for_version` and * `wasmer_wasi_get_version`. It mimics the current API provided by `wasmer_wasi`, nothing fancy here. It's just a regular port to C/C++. Because `wasmer_wasi::get_wasi_version` returns an option, and in order to simplify the C/C++ API, `wasmer_wasi_get_version` can return `Version::Unknown` in case of an error. It's up to the user to check the version is valid (i.e. not unknown). To see only the changes provided by this PR (excluding #1028), check Hywan/wasmer@fix-wasi-get-version...feat-runtime-c-api-wasi-version. Co-authored-by: Ivan Enderlin <[email protected]>
Build succeeded |
bors bot
added a commit
to wasmerio/wasmer-go
that referenced
this pull request
Jan 7, 2020
92: feat(wasi) Support `WasiGetVersion` & other `*ForVersion` WASI API r=Hywan a=Hywan Fix #90. Fix #77.⚠️ Depends on wasmerio/wasmer#1028, wasmerio/wasmer#1029, and wasmerio/wasmer#1030. They must be merged before merging this PR! Marking this PR as a draft to be sure (the shared libraries must be updated too). This patch updates `bridge.go` and `wasmer.h` to support the new `wasmer_wasi_generate_import_object_for_version` and `wasmer_wasi_get_version` functions. After that, this patch updates `wasi.go` to implement the new `NewDefaultWasiImportObjectForVersion`, `NewWasiImportObjectForVersion` and the `WasiGetVersion` functions. In addition to that, we create a new `WasiVersion` type. Finally, this patch updates the tests to test this new API. And it works like a charm 👌. Co-authored-by: Ivan Enderlin <[email protected]>
bors bot
added a commit
to wasmerio/wasmer-go
that referenced
this pull request
Jan 8, 2020
92: feat(wasi) Support `WasiGetVersion` & other `*ForVersion` WASI API r=Hywan a=Hywan Fix #90. Fix #77.⚠️ Depends on wasmerio/wasmer#1028, wasmerio/wasmer#1029, and wasmerio/wasmer#1030. They must be merged before merging this PR! Marking this PR as a draft to be sure (the shared libraries must be updated too). This patch updates `bridge.go` and `wasmer.h` to support the new `wasmer_wasi_generate_import_object_for_version` and `wasmer_wasi_get_version` functions. After that, this patch updates `wasi.go` to implement the new `NewDefaultWasiImportObjectForVersion`, `NewWasiImportObjectForVersion` and the `WasiGetVersion` functions. In addition to that, we create a new `WasiVersion` type. Finally, this patch updates the tests to test this new API. And it works like a charm 👌. Co-authored-by: Ivan Enderlin <[email protected]>
bors bot
added a commit
to wasmerio/wasmer-go
that referenced
this pull request
Jan 15, 2020
92: feat(wasi) Support `WasiGetVersion` & other `*ForVersion` WASI API r=Hywan a=Hywan Fix #90. Fix #77.⚠️ Depends on wasmerio/wasmer#1028, wasmerio/wasmer#1029, and wasmerio/wasmer#1030. They must be merged before merging this PR! Marking this PR as a draft to be sure (the shared libraries must be updated too). This patch updates `bridge.go` and `wasmer.h` to support the new `wasmer_wasi_generate_import_object_for_version` and `wasmer_wasi_get_version` functions. After that, this patch updates `wasi.go` to implement the new `NewDefaultWasiImportObjectForVersion`, `NewWasiImportObjectForVersion` and the `WasiGetVersion` functions. In addition to that, we create a new `WasiVersion` type. Finally, this patch updates the tests to test this new API. And it works like a charm 👌. Co-authored-by: Ivan Enderlin <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
❗️⚠️ Contains #1028, must be merged before this one.
This patch introduces 2 new functions:
wasmer_wasi_generate_import_object_for_version
andwasmer_wasi_get_version
.It mimics the current API provided by
wasmer_wasi
, nothing fancyhere. It's just a regular port to C/C++.
Because
wasmer_wasi::get_wasi_version
returns an option, and inorder to simplify the C/C++ API,
wasmer_wasi_get_version
can returnVersion::Unknown
in case of an error. It's up to the user to checkthe version is valid (i.e. not unknown).
To see only the changes provided by this PR (excluding #1028), check Hywan/wasmer@fix-wasi-get-version...feat-runtime-c-api-wasi-version.