Declarative Composition of Stack Frames

Christian Lindig and Norman Ramsey

When a compiler translates a procedure, it must lay out the procedure's stack frame in a way that respects the calling convention. Many compilers respect the convention either by restricting the order in which slots can be allocated or by using different abstractions ad hoc for allocating in different regions of a frame. Such techniques cause the implementation of the layout to be spread over much of the compiler, making it difficult to maintain and verify. We have concentrated the implementation of layout into a single, unifying abstraction: the block. The block abstraction decouples layout from slot allocation. Stack-frame layout is specified in one central place, and even complex layouts are achieved by composing blocks using only two simple operators. Our implementation is used in the Quick C-- compiler to support multiple calling conventions on multiple architectures.

Full paper

The paper is available as US Letter PostScript (379K), US Letter PDF (137K), and US Letter TeX DVI (56K).