CABI: remove the may_enter flag/trap - #705
Open
lukewagner wants to merge 1 commit into
Open
Conversation
This was referenced Aug 20, 2026
lukewagner
force-pushed
the
simplify
branch
2 times, most recently
from
August 20, 2026 21:45
df29fc4 to
0e24efa
Compare
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes the
may_enterflag+trap that shows up on thecanon lift,resource.drop(destructor) andsubtask.cancel(eager-cancellation) paths as well as from some of the cooperative thread scheduling conditions. It also adds a bunch of WAST tests for reentrance cases that used to trap but are now valid. This PR also includes updated versions of the new tests sitting in #696, updating them accordingly. (Both #696 and #697 are obviated by this PR.)As background: already #650 removed the previous attempt to define+check "asynchronous recursion" (by necessity: it's not well-defined when the host is involved, unfortunately), leaving only a weaker check that prevents "synchronous recursion". This trap has been around since before 0.2 was released and in theory was supposed to simplify the lives of guest toolchains and bindings generators, but now that we've built a bunch, it doesn't actually appear to be load-bearing (once you already have to support all the other kinds of reentrance). In the meantime, there are valid use cases for reentrance (even before callbacks) coming soon, so it seems best to just remove the trap if it's costing (both perf and expressivity) without buying us anything concrete.
What still remains is the "run to completion" semantics (as it's now called in Explainer.md#component-invariants in this PR) of core wasm running as part of a 0.3.0
asyncfunction which serializes individual turns of thecallbackevent loop using automatic backpressure; this is load-bearing in our currentasyncbindgen.