Handling Exceptions and Effects with Automatic Resource Analysis

📅 2026-02-28
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the challenge that existing automatic resource analysis techniques struggle to handle non-local control transfers induced by exceptions and effect handlers. We present the first automated amortized resource analysis framework that supports such features, extending type-based AARA (Automatic Amortized Resource Analysis) with a novel type system and a stack-based abstract machine to automatically derive resource bounds for programs with exceptions and algebraic effects. Key technical contributions include linear and polynomial potential functions, a syntax-directed type soundness theorem, and a prototype implementation in Standard ML. Experimental evaluation demonstrates that our approach successfully analyzes programs beyond the scope of prior techniques, with only modest performance overhead introduced by the handling of exceptions and effect mechanisms.

Technology Category

Application Category

📝 Abstract
There exist many techniques for automatically deriving parametric resource (or cost) bounds by analyzing the source code of a program. These techniques work effectively for a large class of programs and language features. However, non-local transfer of control as needed for exception or effect handlers has remained a challenge. This paper presents the first automatic resource bound analysis that supports non-local control transfer between exceptions or effects and their handlers. The analysis is an extension of type-based automatic amortized resource analysis (AARA), which automates the potential method of amortized analysis. It is presented for a simple functional language with lists and linear potential functions. However, the ideas are directly applicable to richer settings and implemented for Standard ML and polynomial potential functions. Apart from the new type system for exceptions and effects, a main contribution is a novel syntactic type-soundness theorem that establishes the correctness of the derived bounds with respect to a stack-based abstract machine. An experimental evaluation shows that the new analysis is capable of analyzing programs that cannot be analyzed by existing methods and that the efficiency overhead of supporting exception and effect handlers is low.
Problem

Research questions and friction points this paper is trying to address.

resource analysis
non-local control transfer
exception handling
effect handlers
amortized analysis
Innovation

Methods, ideas, or system contributions that make the work stand out.

automatic resource analysis
non-local control transfer
amortized analysis
type system
exception handling
🔎 Similar Papers
No similar papers found.
E
Ethan Chu
Carnegie Mellon University, USA
Y
Yiyang Guo
Carnegie Mellon University, USA
Jan Hoffmann
Jan Hoffmann
Carnegie Mellon University
Programming LanguagesFormal MethodsSoftware Security