Semantic Analysis of Macro Usage for Portability
Semantic Analysis of Macro Usage for Portability
复制标题
可移植性宏用法的语义分析
DOI:
10.1145/3597503.3623323
复制
发表时间:
2024
期刊:
影响因子:
--
通讯作者:
Gazzillo, Paul
中科院分区:
文献类型:
--
作者:
Pappas, Brent;Gazzillo, Paul
C is an unsafe language. Researchers have been developing tools to port C to safer languages such as Rust, Checked C, or Go. Existing tools, however, resort to preprocessing the source file first, then porting the resulting code, leaving barely recognizable code that loses macro abstractions. To preserve macro usage, porting tools need analyses that understand macro behavior to port to equivalent constructs. But macro semantics differ from typical functions, precluding simple syntactic transformations to port them. We introduce the first comprehensive framework for analyzing the portability of macro usage. We decompose macro behavior into 26 fine-grained properties and implement a program analysis tool, called Maki, that identifies them in real-world code with 94% accuracy. We apply Maki to 21 programs containing a total of 86,199 macro definitions. We found that real-world macros are much more portable than previously known. More than a third (37%) are easy-to-port, and Maki provides hints for porting more complicated macros. We find, on average, 2x more easy-to-port macros and up to 7x more in the best case compared to prior work. Guided by Maki's output, we found and hand-ported macros in three real-world programs. We submitted patches to Linux maintainers that transform eleven macros, nine of which have been accepted.
登录
查看更多内容
DOI:
10.1145/2594291.2594319
发表时间:
2014
期刊:
Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation
影响因子:
--
作者:
Justin Pombrio;S. Krishnamurthi
通讯作者:
S. Krishnamurthi
DOI:
--
发表时间:
2003
期刊:
Proceedings Third IEEE International Workshop on Source Code Analysis and Manipulation
影响因子:
--
作者:
J. Favre
通讯作者:
J. Favre
DOI:
--
发表时间:
2004
期刊:
Proceedings. 12th IEEE International Workshop on Program Comprehension, 2004.
影响因子:
--
作者:
Christopher A. Mennie;C. Clarke
通讯作者:
C. Clarke
DOI:
--
发表时间:
2000
期刊:
Software, Practice & Experience
影响因子:
--
作者:
Greg J. Badros;D. Notkin
通讯作者:
D. Notkin
DOI:
--
发表时间:
2002
期刊:
ACM SIGPLAN International Conference on Functional Programming
影响因子:
--
作者:
M. Flatt
通讯作者:
M. Flatt