Stream: git-wasmtime

Topic: wasmtime / PR #3313 Replace `Store::{entering,exiting}_na...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 00:43):

pchickey edited PR #3313 from pch/native_hooks_double_calls to main.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 00:50):

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 and Store::exiting_native_code_hook functions with a single Store::call_hook. The closure passed to Store::call_hook takes a CallHook 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 and CallHook::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.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 00:50):

pchickey has marked PR #3313 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 00:50):

pchickey requested alexcrichton for a review on PR #3313.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 14:20):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 14:20):

alexcrichton merged PR #3313.


Last updated: Dec 23 2024 at 12:05 UTC