-
Notifications
You must be signed in to change notification settings - Fork 821
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(c-api) Implement wasm_module_validate
#1636
Conversation
It depends on It requires wasmerio/wasmer#1636. The `include/` file is already from this PR.
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 good to me!
I was initially a bit uncertain about having anything but the bare minimum syntax in a macro, but I think it's probably fine!
97521a7
to
ff4cb6d
Compare
@MarkMcCaskey I've rebased the PR on top of the I don't use Finally, I prefer to use Thoughts? |
My biggest issue with I think |
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.
Other than that, looks good to me!
lib/c-api/src/wasm_c_api/module.rs
Outdated
@@ -32,6 +33,30 @@ pub unsafe extern "C" fn wasm_module_new( | |||
#[no_mangle] | |||
pub unsafe extern "C" fn wasm_module_delete(_module: Option<Box<wasm_module_t>>) {} | |||
|
|||
#[no_mangle] | |||
pub unsafe extern "C" fn wasm_module_validate( | |||
store_ptr: Option<NonNull<wasm_store_t>>, |
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.
I commented elsewhere on this PR about the implied semantics of NonNull
, store: &wasm_store_t
is probably better, especially if we're calling unwrap
on it
`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.
I've updated the definition of struct wasm_store {
inner: Store
} The rest of the patch above updates the code accordingly. Thoughts? |
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 great to me!
bors r+ |
1636: feat(c-api) Implement `wasm_module_validate` r=Hywan a=Hywan This PR implements `wasm_module_validate`. It returns a bool, but it populates the error handler too. I took the liberty to update the `c_try!` macro to return any kind of value, so that it is generic over the returned type of the function using `c_try!`. Co-authored-by: Ivan Enderlin <ivan@mnt.io>
This PR was included in a batch that successfully built, but then failed to merge into master (it was a non-fast-forward update). It will be automatically retried. |
Build succeeded: |
This PR implements
wasm_module_validate
.It returns a bool, but it populates the error handler too. I took the liberty to update the
c_try!
macro to return any kind of value, so that it is generic over the returned type of the function usingc_try!
.