Skip to content
Commit Detail

Commit c331b47

Author
Hood Chatham <roberthoodchatham@gmail.com> 2025-05-08 11:41:44 -0400
Parents
8bff903
Tree
11d6845
Python: Fix 0.26.0a2 package snapshots against v8 13.7 (#4107)

This is a fix for a problem with package snapshots in 0.26.0a2. 0.26.0a2 tests if
wasm-type-reflection is supported by the runtime and if so uses it to avoid function pointer
casting instead of a JS trampoline. We cannot stack switch through the JS trampoline so we need
to make sure that when stack switching is available, we don't use JS trampolines. When 0.26.0a2
was released, wasm-stack-switching implied wasm-type-reflection.

Unfortunately there is a bug (fixed in 0.26.0a3...) that made the assumption that if the runtime
that we use to make a snapshot supports wasm-type-reflection, the runtime we use it in will too.

Later, JSPI was rewritten not to depend on wasm-type-reflection, but the implication was left in
the v8 codebase until a few weeks ago. So our snapshots expect to be able to use an implementation
of `patched_PyEM_CountFuncParams` based on wasm-type-reflection, but it's not on anymore.

Luckily, in the meantime there is a way to count the arguments of a webassembly function using
wasm-gc. It's not exactly pretty though.
This is copied from https://github.com/python/cpython/blob/main/Python/emscripten_trampoline.c

Files changed

3 files changed~3 modified