Paulo Emílio de Vilhena, Ori Lahav, Viktor Vafeiadis, Azalea Raad
{"title":"Extending the C/C\\texttt{++} Model with Inline Assembly","authors":"Paulo Emílio de Vilhena, Ori Lahav, Viktor Vafeiadis, Azalea Raad","doi":"arxiv-2408.17208","DOIUrl":null,"url":null,"abstract":"Programs written in C/C\\texttt{++} often include \\textit{inline assembly}: a\nsnippet of architecture-specific assembly code used to access low-level\nfunctionalities that are impossible or expensive to simulate in the source\nlanguage. % Although inline assembly is widely used, its semantics has not yet\nbeen formally studied. In this paper, we overcome this deficiency by investigating the effect of\ninline assembly on the \\textit{consistency} semantics of~C/C\\texttt{++}\nprograms. % We propose the first memory model of the~C\\texttt{++} Programming\nLanguage with support for inline assembly for Intel's \\textsf{x86} including\n\\textit{non-temporal stores} and \\textit{store fences}. % We argue that\nprevious provably correct compiler optimizations and correct compiler mappings\nshould remain correct under such an extended model and we prove that this\nrequirement is met by our proposed model.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":"5 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Programming Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2408.17208","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
Programs written in C/C\texttt{++} often include \textit{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 \textit{consistency} semantics of~C/C\texttt{++}
programs. % We propose the first memory model of the~C\texttt{++} Programming
Language with support for inline assembly for Intel's \textsf{x86} including
\textit{non-temporal stores} and \textit{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.