Skip to content

Conversation

@jpco
Copy link
Collaborator

@jpco jpco commented Jan 2, 2026

This lets us control when we do want to save the signal mask (i.e., when longjmping out of the signal handler) or don't (i.e., whenever we're just doing exceptions).

It's a bit more explicit, which is nice, given the "function X is actually slightly-different function Y" macrology can be confusing (I've been bitten by it in the past).

There's also a minor but possibly non-negligible performance benefit, since it makes the most common case, setjmp calls as part of ExceptionHandler macros, ~100x faster by cutting out a couple syscalls for each setjmp(). This is a relatively tiny benefit, but given ExceptionHandler is called for every $&parse, $&here, redirection, lambda evaluation, every time a dynamically-scoped variable is popped, twice for each $&catch, and more, it seems reasonable to make this pretty tiny and simple optimization. If #73 or something similar ever gets merged such that if and <= also catch certain exceptions, then this would help even more.

This lets us control when we do want to save the signal mask (i.e.,
when longjmping out of the signal handler) or don't (i.e., whenever
we're just doing exceptions).
@jpco jpco merged commit b96c59d into wryun:master Jan 8, 2026
1 check passed
@jpco jpco deleted the sigjmp branch January 8, 2026 05:05
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