Put cooperative threads into their own per-component-instance table #600
+219
−205
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.
As described in a new blurb in this PR (in the Thread State section in CanonicalABI.md), the main motivation this change is to help an optimization engine cheaply lazily allocate thread elements, saving the real initialization until a real stack-switching operation occurs. Having threads in the same handle table as everything else would otherwise thwart this optimization since unrelated resource/waitable handle allocations would shift the indices around. This also has the pleasant effect of reverting what was otherwise a semantic change from when cooperative threads were added: an export's implicit thread is allocated a thread index which observably shifts indices (thereby causing annoyance when enabling/disabling the coop-threads feature changes index allocation).