Hello,
In the code documentation for declare_value_needs_stack_map, it mentions that stack maps are not reloaded after safepoints and that moving GCs are unsupported as a result. But, it sounds the like this PR that they are now reloaded after safepoints. Is the code documentation outdated or is there more nuance to the issue?
naively it sounds to me like maybe the docs just need to be updated but cc @fitzgen (he/him) for the definitive answer!
yes, the docs just need to be updated. @Max T. Kristiansen are you interested in sending a PR updating that wording to say that needs-stack-map values are always reloaded from their stack slot after safepoints, and thus compatible with moving GCs?
Sure thing: https://github.com/bytecodealliance/wasmtime/pull/11659
While it's still on topic, what is the intended mechanism for using these stack maps, before they're reloaded again? Given that the spill and reload happens right before and after a call site respectively, there's seemingly no way to invoke a GC while the stack is spilled. If I were to place a call instruction to some GC invocation right before another call, the GC call would be placed before the stack is spilled.
I might be missing something, but is that not also a supported use case of the user stack maps?
The idea is that the GC can only happen during some call -- the expectation is that the GC root scanning itself is not implemented as inline CLIF, but as part of a runtime, so you'll either directly call invoke_my_gc() (which is a callsite that will have roots spilled for its duration) or you'll call some other function that eventually does something that incidentally invokes a GC
That makes sense - I'll see what I can put together. Thank you two very much for the help.
Last updated: Dec 06 2025 at 07:03 UTC