Abstract
Modern compilers often implement function calls (or returns) in two steps: first, a “closure” environment is properly installed to provide access for free variables in the target program fragment; second, the control is transferred to the target by a “jump with arguments (for results).” Closure conversion—which decides where and how to represent closures at runtime—is a crucial step in the compilation of functional languages. This paper presents a new algorithm that exploits the use of compile-time control and data-flow information to optimize funtion calls. By extensive closure sharing and allocation by 36% and memory fetches for local and global variables by 43%; and improves the already efficient code generated by an earlier version of the Standard ML of New Jersey compiler by about 17% on a DECstation 5000. Moreover, unlike most other approaches, our new closure-allocation scheme the strong
safe-for-space-complexity
rule, thus achieving good asymptotic space usage.
Publisher
Association for Computing Machinery (ACM)
Cited by
17 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Generating Well-Typed Terms That Are Not “Useless”;Proceedings of the ACM on Programming Languages;2024-01-05
2. Closure Conversion in Little Pieces;International Symposium on Principles and Practice of Declarative Programming;2023-10-22
3. Analyzing binding extent in 3CPS;Proceedings of the ACM on Programming Languages;2022-08-29
4. A small scheme VM, compiler, and REPL in 4k;Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages;2021-10-19
5. 3CPS: The Design of an Environment-Focussed Intermediate Representation;33rd Symposium on Implementation and Application of Functional Languages;2021-09