Affiliation:
1. UNSW, Australia
2. University of Cambridge, UK
3. University of Edinburgh, UK
4. Utrecht University, Netherlands
5. University of Melbourne, Australia
Abstract
Systems programmers need fine-grained control over the memory layout of data structures, both to produce performant code and to comply with well-defined interfaces imposed by existing code, standardised protocols or hardware. Code that manipulates these low-level representations in memory is hard to get right. Traditionally, this problem is addressed by the implementation of tedious marshalling code to convert between compiler-selected data representations and the desired compact data formats. Such marshalling code is error-prone and can lead to a significant runtime overhead due to excessive copying. While there are many languages and systems that address the correctness issue, by automating the generation and, in some cases, the verification of the marshalling code, the performance overhead introduced by the marshalling code remains. In particular for systems code, this overhead can be prohibitive. In this work, we address both the correctness and the performance problems.
We present a data layout description language and data refinement framework, called Dargent, which allows programmers to declaratively specify how algebraic data types are laid out in memory. Our solution is applied to the Cogent language, but the general ideas behind our solution are applicable to other settings. The Dargent framework generates C code that manipulates data directly with the desired memory layout, while retaining the formal proof that this generated C code is correct with respect to the functional semantics. This added expressivity removes the need for implementing and verifying marshalling code, which eliminates copying, smoothens interoperability with surrounding systems, and increases the trustworthiness of the overall system.
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference37 articles.
1. Cogent
2. DataScript- A Specification and Scripting Language for Binary Data
3. Julian Bangert and Nickolai Zeldovich . 2014 . Nail: A Practical Tool for Parsing and Generating Data Formats. In 11th USENIX Symposium on Operating Systems Design and Implementation (OSDI 14) . USENIX Association, Broomfield, CO. 615–628. isbn:978-1-93 1971-16-4 https://www.usenix.org/conference/osdi14/technical-sessions/presentation/bangert Julian Bangert and Nickolai Zeldovich. 2014. Nail: A Practical Tool for Parsing and Generating Data Formats. In 11th USENIX Symposium on Operating Systems Design and Implementation (OSDI 14). USENIX Association, Broomfield, CO. 615–628. isbn:978-1-931971-16-4 https://www.usenix.org/conference/osdi14/technical-sessions/presentation/bangert
4. Conventional and uniqueness typing in graph rewrite systems
Cited by
3 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Garbage Collection for Mostly Serialized Heaps;Proceedings of the 2024 ACM SIGPLAN International Symposium on Memory Management;2024-06-20
2. Unboxed Data Constructors: Or, How cpp Decides a Halting Problem;Proceedings of the ACM on Programming Languages;2024-01-05
3. Bit-Stealing Made Legal: Compilation for Custom Memory Representations of Algebraic Data Types;Proceedings of the ACM on Programming Languages;2023-08-30