Skip to content

Refactor CABI onto explicit stack-switching interface#637

Merged
lukewagner merged 1 commit intomainfrom
stack-switching
Apr 22, 2026
Merged

Refactor CABI onto explicit stack-switching interface#637
lukewagner merged 1 commit intomainfrom
stack-switching

Conversation

@lukewagner
Copy link
Copy Markdown
Member

This PR is pure CABI-spec-refactoring (no behavioral change) intended to simplify a subsequent PR in progress, but I found it kinda clarifying on its own, so I thought I'd post it in case folks were interested to review it or had comments.

The change is to factor out 4 functions (in a new "Stack Switching" section in CanonicalABI.md) which directly correspond to the Core WebAssembly stack-switching proposal's cont.new, resume and suspend (where resume is split into 2 functions specialized to the 2 effect tags that are needed). These 4 functions then conveniently factor out and encapsulate all the Python threading plumbing from the existing Thread class (that defines what a cooperative thread is), leaving only the semantically "interesting" bits in Thread, which is nice. This change also helps clarify how one could implement Component Model concurrency in-terms-of stack-switching and how Component Model concurrency would compose with Core WebAssembly stack-switching-based concurrency.

@lukewagner lukewagner force-pushed the stack-switching branch 3 times, most recently from 40a9956 to 963688e Compare April 20, 2026 16:35
@lukewagner lukewagner merged commit aec7010 into main Apr 22, 2026
2 checks passed
@lukewagner lukewagner deleted the stack-switching branch April 22, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant