ICFP 2025
Sun 12 - Sat 18 October 2025 Singapore
co-located with ICFP/SPLASH 2025

While enabling use cases such as backtracking search and probabilistic programming, multiple resumptions have the reputation of being incompatible with efficient implementation techniques, such as stack switching.
This paper sets out to resolve this conflict and thus bridge the gap between expressiveness and performance.
To this end, we present a compilation strategy and runtime system for lexical effect handlers with support for multiple resumptions and stack-allocated mutable state.
By building on garbage-free reference counting and associating stacks with stable prompts, our approach enables constant-time continuation capture and resumption when resumed exactly once, as well as constant-time state access. Nevertheless, we also support multiple resumptions by copying stacks when necessary.
We practically evaluate our approach by implementing an LLVM backend for the Effekt language.
A performance comparison with state-of-the-art systems, including dynamic and lexical effect handler implementations,
suggests that our approach achieves competitive performance and the increased expressiveness only comes with limited overhead.