arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2408.17208cs.PL
收藏

用内联汇编扩展 C/C++ 内存模型

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

Paulo Emílio de Vilhena, Ori Lahav, Viktor Vafeiadis, Azalea Raad

AI总结:

本文首次提出支持 Intel x86 内联汇编的 C++ 内存模型,涵盖非临时存储和存储栅栏,并证明既有正确的编译器优化与映射在该扩展模型下依然保持正确。

摘要:

用 C/C++ 编写的程序通常包含内联汇编:一段架构特定的汇编代码,用于访问在源语言中无法实现或模拟代价高昂的底层功能。尽管内联汇编被广泛使用,但其语义尚未得到正式研究。在本文中,我们通过研究内联汇编对 C/C++ 程序一致性语义的影响来弥补这一不足。我们提出了第一个支持 Intel x86 内联汇编的 C++ 编程语言内存模型,包括非临时存储和存储栅栏。我们认为,先前被证明正确的编译器优化和正确的编译器映射在这种扩展模型下应保持正确,并证明我们的模型满足这一要求。

英文摘要:

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.

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

↑