Bit-Stealing Made Legal: Compilation for Custom Memory Representations of Algebraic Data Types
نویسندگان
چکیده
Initially present only in functional languages such as OCaml and Haskell, Algebraic Data Types (ADTs) have now become pervasive mainstream languages, providing nice data abstractions an elegant way to express functions through pattern matching. Unfortunately, ADTs remain seldom used low-level programming. One reason is that their increased convenience comes at the cost of abstracting away exact memory layout values. Even Rust, which tries optimize layout, severely limits control over representation. In this article, we a new approach specify rich types based on dual view: source type, high-level description available rest code, along with full layout. This view allows for better reasoning about both correctness, dedicated validity criteria linking two views, optimizations manipulate view. We then provide algorithms compile constructors destructors, including matching, prove our compilation correct, implement them tool called ribbit compiles LLVM IR, show some early experimental results.
منابع مشابه
Compilation of LOTOS Abstract Data Types
Lotos data structures are described by sorts, which represent value domains, and operations, which are mathematical functions defined on these domains by algebraic equations. Value expressions are terms built from variables and operations. Sorts, operations, and equations are grouped in modules called types, which can be combined together using multiple inheritance, renaming, parametrization, a...
متن کاملRefining algebraic data types
Our purpose is to formalize two potential refinements of single-sorted algebraic data types – subalgebras and algebras which satisfy equivalence relations – by considering their categorical interpretation. We review the usual categorical formalization of singleand multi-sorted algebraic data types as initial algebras, and the correspondence between algebraic data types and endofunctors. We intr...
متن کاملAbstractions in Decision Procedures for Algebraic Data Types Abstractions in Decision Procedures for Algebraic Data Types Abstractions in Decision Procedures for Algebraic Data Types
ions in Decision Procedures for Algebraic Data Types
متن کاملSimple algebraic data types for C
ADT is a simple tool in the spirit of Lex and Yacc that makes algebraic data types and a restricted form of pattern matching on those data types as found in SML available in C programs. ADT adds runtime checks, which make C programs written with the aid of ADT less likely to dereference a NULL pointer. The runtime tests may consume a significant amount of CPU time; hence they can be switched of...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
ژورنال
عنوان ژورنال: Proceedings of the ACM on programming languages
سال: 2023
ISSN: ['2475-1421']
DOI: https://doi.org/10.1145/3607858