Skip to content

Don’t store the async exception masking state in catch# frames

This MR is intended to fix #23513.

As mentioned in the issue, the bug stems from the fact that catch# frames store the async exception masking state of the enclosing context at the time they’re pushed, and that information can go out of date in the presence of continuation capture and restore (since the continuation can be restored in a context with a different masking state). My initial idea was to patch the stack frames on continuation restore, but after spending some time reading the code, I came to the conclusion that storing the masking state is not actually necessary.

This patch therefore removes the exceptions_blocked field in the StgCatchFrame structure altogether. This has the extremely marginal benefit of making catch# frames one word smaller at the equally marginal cost of properly updating the masking state during stack unwinding. As far as I can tell, this approach works without issue, and it solves the bug in a more satisfying way.

Merge request reports