pchickey edited PR #3313 from pch/native_hooks_double_calls
to main
.
pchickey edited PR #3313 from pch/native_hooks_double_calls
to main
:
(note: description rewritten after alex responded)
This PR replaces the
Store::entering_native_code_hook
andStore::exiting_native_code_hook
functions with a singleStore::call_hook
. The closure passed toStore::call_hook
takes aCallHook
argument, which looks like:pub enum CallHook { CallingWasm, ReturningFromWasm, CallingHost, ReturningFromHost }
This exposes all 4 state transitions to the user instead of aliasing them onto 2. Users who want the old functionality can use
CallHook::entering_host(&self) -> bool
andCallHook::exiting_host
to indicate which of the old state transitions are being made.One of the big motivations for this work is avoiding tricky or ambiguous cases when the trap hook returns a trap. After trapping, the call hook may still get called with additional ReturningFrom{Host, Wasm} events as the call stack returns.
The tests have been expanded to cover all of the different ways to trap.
pchickey has marked PR #3313 as ready for review.
pchickey requested alexcrichton for a review on PR #3313.
alexcrichton submitted PR review.
alexcrichton merged PR #3313.
Last updated: Dec 23 2024 at 12:05 UTC