-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix borrow scope for store in WrappedCallable
impl for WasmtimeFn
.
#366
Fix borrow scope for store in WrappedCallable
impl for WasmtimeFn
.
#366
Conversation
This looks good; would it be feasible to convert your example from #365 into a testcase? wasmtime-api/examples/gcd.rs may be useful as a starting point. |
I didn't see formal tests for the API crate yet. Should I add a unit test or an test case as an example? |
I think it makes sense to add a |
wasm_func_call
.WrappedCallable
impl for WasmtimeFn
.
9a57d95
to
491466a
Compare
@sunfishcode I've amended the commit with a test case. |
@sunfishcode @yurydelendik It appears that there's a calling convention mismatch for the import in the new test case on Windows. Is there something I should be doing in the Rust API or is this a current limitation? |
Let's disable tests on Windows, so it will not block landing of this PR -- I'll look into that calling convention problem shortly. |
Should I file a new issue to track the calling convention mismatch panic? |
Filed as #378. |
|
@mrowqa Would you mind taking a look at this test failure? |
This PR fixes the borrow scope of store in the `WrappedCallable` impl of `WasmTimeFn` such that it does not remain borrowed across the call to `wasmtime_call_trampoline`. By limiting the scope of the borrow, the implementation can be reentered if an exported function calls an imported function, which in turn calls another exported function. Fixes bytecodealliance#365.
72ef81d
to
66e29cf
Compare
@mrowqa the |
@peterhuene I can't reproduce the CI failure. I have updated the Rust version in the meantime, though. Since the test changed in the meantime, my suggestion was to rebase your PR onto master, but I can see you already did that when I was writing this comment 😃 . Other weird thing is the stack trace didn't make sense. It pointed to an empty line. |
@mrowqa thanks for looking into it. I'll keep an eye out in case it fails again. |
Looks like everything works. The formatting problem is within lightbeam. I have already opened an PR there CraneStation/lightbeam#28. |
Thanks! |
This PR fixes the borrow scope of
store
in theWrappedCallable
impl ofWasmTimeFn
such that it does not remain borrowed across the call towasmtime_call_trampoline
. By limiting the scope of the borrow, the implementation can be reentered if an exported function calls an imported function, which in turn calls another exported function.Fixes #365.