arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.16143cs.PL
收藏

一种两阶段无限/有限低级内存模型

A Two-Phase Infinite/Finite Low-Level Memory Model

Calvin Beck, Irene Yoon, Hanxi Chen, Yannick Zakowski, Steve Zdancewic

AI总结:

针对低级内存模型特性与程序转换正确性证明的协调难题,提出含无限/有限层级的两阶段内存模型,通过处理内存不足的求精关联两层,在LLVM IR场景实例化后可证明更多优化的正确性。

摘要:

本文提出了一种新方法,用于协调复杂的低级内存模型特性(如指针-整数转换)与证明程序转换正确性所需的理想求精关系。其核心思想是采用“两阶段”内存模型:一个具备无限内存及对应的无限整数类型,另一个则采用有限内存;我们提出的可处理内存不足行为的求精概念,明确了两个层级之间的关联。该方法支持开展更多优化,并清晰划分了程序的理想化语义与该程序在有限硬件上的实现之间的边界。为在实践中验证该思路的实用性,我们在Zakowski等人的VIR语义(验证式中间表示语义)场景下实例化了该两阶段内存模型,得到了LLVM IR的无限与有限内存模型,涵盖undef(未定义值)、bitcast(位转换)等低级特性。作为规范的无限模型与有限模型,均可被证明能求精为可执行的参考解释器。该语义可证明死alloca消除等优化的正确性,而这类优化此前无法或难以被证明正确。

英文摘要:

This paper provides a novel approach to reconciling complex low-level memory model features, such as pointer--integer casts, with desired refinements that are needed to justify the correctness of program transformations. The idea is to use a "two-phased" memory model, one with and unbounded memory and corresponding unbounded integer type, and one with a finite memory; the connection between the two levels is made explicit by our notion of refinement that handles out-of-memory behaviors. This approach allows for more optimizations to be performed and establishes a clear boundary between the idealized semantics of a program and the implementation of that program on finite hardware. To demonstrate the utility of this idea in practice, we instantiate the two-phase memory model in the context of Zakowski et al.'s VIR semantics, yielding infinite and finite memory models of LLVM IR, including low-level features like undef and bitcast. Both the infinite and finite models, which act as specifications, can provably be refined to executable reference interpreters. The semantics justify optimizations, such as dead-alloca-elimination, that were previously impossible or difficult to prove correct.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑