-
Notifications
You must be signed in to change notification settings - Fork 16
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] Support new c-apis #13
Conversation
Hello, I am a code review bot on flows.network. Here are my reviews of code commits in this PR. The Pull Request includes many changes in various parts of the codebase, including updates to existing functionality and new functionality. The most significant changes were made to the The patch descriptions could be improved to provide more context, and it may be necessary to review the changes in more detail to verify that all changes work together well. The patch demonstrates routine maintenance tasks, but it is hard to tell if more complex underlying restructuring is happening in the codebase due to the lack of context. The Pull Request includes tests, but they don't seem to cover some of the specific changes made. Overall, there are no significant issues with the Pull Request, but it is recommended to review the changes in more detail and request more information from the author where necessary. DetailsCommit 95c92e381f39c52c75e168c309a9778055836bdcKey changes
Potential problems
Commit 3f74cd2d0c50815432a86bc2758ca92bad914a2cThis patch adds the The change could potentially cause problems if the Commit d5ed906c7ca71d0e96a9b634ced8e2ff45784c22This patch adds a new function Commit 71dddba4152f99cd11d4b419cae0a4f3b6dab34cThe patch adds a new method The changes look good and seem to serve the purpose. However, it would have been helpful to have more information on how the function should be used and the purpose behind it. Additionally, the patch could have included some documentation for the new function and any potential issues users may need to be aware of while using it. Commit f3f2d73ef5c3d984047efcbd5663e0f5387f8fb8The patch exports a new type Commit fa3dd0f7d7b031e67779f8a96648321efb5bccd4The patch is a code reformatting, which makes no functional changes to the software. It only modifies the import.rs file by rearranging the order of imports and formatting the code according to Rust formatting conventions. There are no potential problems with this change. Commit 20c857d3ce40714e2aa85df44fc1e26ef0d2b338Key Changes:
Potential Problems:
Commit 662d58a95c86df8f4e23904114712a78f51c6187Key changes:
Potential problems:
Commit 76d082e5f54eb01e7712a0bdc7887e339e73fc09Key changes:
Potential problems:
Commit 9e5311e63b877a153ce0fc51d0fffd9c6b2e02d9Key changes:
Potential problems:
Commit 8428b54b55aff11e13646d889601f3fdac1accd4Key Changes:
Potential Problems:
Commit aec4622f2f8109b84f5a1c9dd3e2efe2e5c71824The key change in this pull request is an update to the There don't appear to be any potential problems with this change as it is a straightforward and sensible improvement to the Commit 32b3c85f2ff4cb658066b69f7f3469411019ddf1This patch updates the Rust SDK by changing the The most important finding is that the developer has added A potential problem with this change is that it might not be compatible with existing code that expects Another potential problem is that the addition of the Commit da8751e72d27d89caa179584067f1bdfc5467c5eThe key changes in this patch are the refactoring of There doesn't seem to be any major issues with this patch. The changes appear to be consistent with the updated API requirements, but the patch itself lacks context regarding the motivation for the updates. It may be worthwhile to check if any other code references this newly added Commit 904cc6085582d39c42e765a764271d8ed275d7b2Key Changes:
Potential problems:
Commit f05c65cc0a27de43941b641ddee062190b674953The patch adds an implementation of A potential problem with this change is that adding Commit ead8118e2387b42908cf5cf04f70c3d3a341cdf7The patch updates example and test code for the wasmedge-sys crate. There are no major issues found. However, it's worth noting that the changes were not explained in the pull request description, so it's difficult to identify why these specific changes were made. Additionally, the patch updates the use of the ImportModule from Commit 3c38e00b6fa712b80ba7e04ba23c6fa05178dbdbThe key change is adding the Potential problems:
|
@L-jasmine Could you please help review this PR? Thanks a lot! |
src/import.rs
Outdated
pub fn build_with_data<T>( | ||
self, | ||
name: impl AsRef<str>, | ||
host_data: &mut T, | ||
finalizer: Option<Finalizer>, | ||
) -> WasmEdgeResult<ImportObject> { |
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.
This function creates an ImportObject
that does not have a dependency on &mut host_data
in terms of its lifetime. This could potentially lead to memory safety issues.
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.
Accepted. Thanks a lot!
pub fn host_data<T>(&self) -> Option<&mut T> { | ||
let ctx = unsafe { ffi::WasmEdge_ModuleInstanceGetHostData(self.inner.0) }; | ||
|
||
match ctx.is_null() { | ||
true => None, | ||
false => { | ||
let ctx = unsafe { &mut *(ctx as *mut T) }; | ||
Some(ctx) | ||
} | ||
} | ||
} | ||
|
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.
The Instance struct, in which host_data exists, is Send and Sync. However, host_data is obtained through an immutable borrow, which creates a mutable borrow. This means that when an Instance is cloned and sent to different threads, it's possible for multiple threads to simultaneously have &mut host_data, leading to potential data race issues.
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.
Accepted. Thanks a lot!
…rt new c-apis Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
Signed-off-by: Xin Liu <[email protected]>
@L-jasmine Thanks for the review! |
In this PR, the new c-apis below are supported:
WasmEdge_ModuleInstanceCreateWithData
WasmEdge_ModuleInstanceGetHostData