Extending the C/C++ Memory Model with Inline Assembly
Paulo Emílio de Vilhena, Ori Lahav, Viktor Vafeiadis, Azalea Raad
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.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 2cb8c10b-31ee-40f5-b60d-192d17ab56c2Builds on5
- Extending Intel-x86 consistency and persistency: formalising the semantics of Intel-x86 memory types and non-temporal storesAzalea Raad, Luc Maranget, Viktor VafeiadisPOPL 2022 · 24 citations
- Verifying observational robustness against a c11-style memory modelRoy David Margalit, Ori LahavPOPL 2021 · 22 citations
- DimSum: A Decentralized Approach to Multi-language Semantics and VerificationMichael Sammler, Simon Spies, Youngju Song, Emanuele D'Osualdo et al.POPL 2023 · 18 citations
- Kater: Automating Weak Memory Model Metatheory and Consistency CheckingMichalis Kokologiannakis, Ori Lahav, Viktor VafeiadisPOPL 2023 · 15 citations
- Compound Memory ModelsAndrés Goens, Soham Chakraborty, Susmit Sarkar, Sukarn Agarwal et al.PLDI 2023 · 11 citations
Related papers
- Symbolic MRD: Dynamic Memory, Undefined Behaviour, and Extrinsic ChoiceJay Richards, Daniel Wright, Simon Cooksey, Mark BattyOOPSLA 2025 · 1 citation
- Taming x86-TSO persistencyArtem Khyzha, Ori LahavPOPL 2021 · 26 citations
- Putting Weak Memory in Order via a Promising Intermediate RepresentationSung-Hwan Lee, Minki Cho, Roy David Margalit, Chung-Kil Hur et al.PLDI 2023 · 5 citations
- (Almost) Fence-less Persist OrderingSara Mahdizadeh-Shahri, Seyed Armin Vakil-Ghahani, Aasheesh KolliMICRO 2020 · 15 citations
- Persistency semantics of the Intel-x86 architectureAzalea Raad, John Wickerson, Gil Neiger, Viktor VafeiadisPOPL 2020 · 61 citations
