6 research outputs found
Semantic Analysis of Macro Usage for Portability
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 four real-world
programs. We submitted patches to Linux maintainers that transform eleven
macros, nine of which have been accepted.Comment: 12 pages. 4 figures. 2 tables. To appear in the 2024 IEEE/ACM 46th
International Conference on Software Engineering (ICSE '24), April 14-20,
2024, Lisbon, Portugal. See https://zenodo.org/doi/10.5281/zenodo.7783131 for
the latest version of the artifact associated with this pape
Variability-aware Datalog
Variability-aware computing is the efficient application of programs to
different sets of inputs that exhibit some variability. One example is program
analyses applied to Software Product Lines (SPLs). In this paper we present the
design and development of a variability-aware version of the Souffl\'{e}
Datalog engine. The engine can take facts annotated with Presence Conditions
(PCs) as input, and compute the PCs of its inferred facts, eliminating facts
that do not exist in any valid configuration. We evaluate our variability-aware
Souffl\'{e} implementation on several fact sets annotated with PCs to measure
the associated overhead in terms of processing time and database size.Comment: PADL'20 pape