paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Extending the C/C++ Memory Model with Inline Assembly

用内联汇编扩展 C/C++ 内存模型
OOPSLA 8(OOPSLA2)2024匹配度 2/10 · 该论文是并发内存模型与编译正确性的形式化语义工作,虽兼具理论形式化与证明,但主题落在 C/C++ 内存模型与内联汇编语义上,与用户画像的核心方向(静态分析、LLM/Agent 与 PL 的交叉、浮点程序分析、贝叶斯程序分析)没有直接关联。引用 1 inbox
Paulo Emílio de Vilhena, Ori Lahav, Viktor Vafeiadis, Azalea Raad
dblp: 2026-09-10crossref: 2026-09-10arxiv: 2026-09-10

AI 速览

一句话:首次为含内联汇编(Intel x86,含非临时存储与存储栅栏)的 C/C++ 提出内存模型,并证明既有编译器优化与映射仍正确。

C/C++ 程序常使用内联汇编访问底层功能,但其对一致性的影响尚无形式化研究。本文考察内联汇编如何影响 C/C++ 程序的一致性语义,提出首个支持 Intel x86 内联汇编的 C++ 内存模型,涵盖非临时存储(non-temporal stores)和存储栅栏(store fences)。作者认为,此前已被证明正确的编译器优化与编译器映射在扩展模型下仍应保持正确,并将该要求作为设计约束;论文证明所提模型满足这一要求。结果给出内联汇编的正式语义基础,并为验证编译器在含内联汇编时的正确性提供依据。

问题
内联汇编被广泛使用,但其对 C/C++ 一致性语义的影响尚未被形式化研究,编译器优化在内联汇编存在时是否仍正确也不清楚。
方法
提出首个支持 Intel x86 内联汇编(含非临时存储和存储栅栏)的 C++ 内存模型,并把既有正确编译器优化与映射应保持正确作为约束。
评估
通过论证并证明所提扩展内存模型满足该约束,即保持此前可证明正确的编译器优化与编译器映射的正确性。
原文摘要(Abstract)

Programs written in C/C++ often include inline assembly : a snippet of architecture-specific assembly code used to access low-level functionalities that are impossible or expensive to simulate in the source language. Although inline assembly is widely used, its semantics has not yet been formally studied. In this paper, we overcome this deficiency by investigating the effect of inline assembly on the consistency semantics of C/C++ programs. We propose the first memory model of the C++ Programming Language with support for inline assembly for Intel’s x86 including non-temporal stores and store fences . We argue that previous provably correct compiler optimizations and correct compiler mappings should remain correct under such an extended model and we prove that this requirement is met by our proposed model.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@article{Vilhena0VR24,
  title = {Extending the C/C++ Memory Model with Inline Assembly},
  author = {Paulo Emílio de Vilhena and Ori Lahav and Viktor Vafeiadis and Azalea Raad},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {OOPSLA2},
  year = {2024},
  doi = {10.1145/3689749}
}