拆箱 Virgil ADT 以获取乐趣与收益
Unboxing Virgil ADTs for Fun and Profit
AI总结:
本文探索在系统级编程语言 Virgil 中通过 #unboxed 和 #packed 注解引导 ADT 表示优化,消除堆分配开销并支持自定义位布局,以节省内存并满足硬件数据格式要求。
摘要:
代数数据类型(ADTs)是现代编程语言中日益常见的特性。在许多实现中,非空多分支 ADT 的值在堆上分配,这可能降低性能并增加内存使用。本研究探索了在 Virgil(一种编译为 x86、x86-64、Wasm 和 Java 虚拟机的系统级编程语言)中通过注解引导的 ADT 表示优化。我们通过注解扩展了 Virgil:使用 #unboxed 通过自动编译器转换为标量表示来消除堆分配的开销,以及使用 #packed 启用程序员表达的位布局。这些注解允许程序员既节省内存,又以硬件规定的格式操作数据。我们将此工作作为对与 Jens 合作完成的《生成机器代码工具的声明式方法》(2005 年未发表手稿)的致敬与呼应。事实上,本研究继承了该先前工作的一些语法约定。这些表示变更的性能影响在多种工作负载上以执行时间和内存使用情况进行了评估,但我们不包含这些内容,因为 Jens 更喜欢语义和类型系统!
英文摘要:
Algebraic Data Types (ADTs) are an increasingly common feature in modern programming languages. In many implementations, values of non-nullary, multi-case ADTs are allocated on the heap, which may reduce performance and increase memory usage. This work explores annotation-guided optimizations to ADT representation in Virgil, a systems-level programming language that compiles to x86, x86-64, Wasm and the Java Virtual Machine. We extend Virgil with annotations: #unboxed to eliminate the overhead of heap allocation via automatic compiler transformation to a scalar representation, and #packed, to enable programmer-expressed bit-layouts. These annotations allow programmers to both save memory and manipulate data in formats dictated by hardware. We dedicate this work as an homage and echo of work done in collaboration with Jens in the work entitled "A Declarative Approach to Generating Machine Code Tools", an unpublished manuscript from 2005. In fact, this work inherits some syntactic conventions from that prior work. The performance impact of these representation changes was evaluated on a variety of workloads in terms of execution time and memory usage, but we don't include it because Jens like semantics and type systems better!
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。