Modern programming languages, most notably Rust, offer advanced linguistic constructs for building highly configurable software systems as aggregation of features -- identified by a configuration. However, they pose substantial challenges for program analysis, optimization, and testing, as the combinatorial explosion of configurations often makes exhaustive exploration infeasible. In this manuscript, we present the first compiler-based method for prioritizing configurations. Our approach consists of four main steps: 1. extracting a tailored intermediate representation from the Rust compiler, 2. constructing two complementary graph-based data structures, 3. using centrality measures to rank features, and 4. refining the ranking by considering the extent of code they impact. A fixed number of most relevant configurations are generated based on the achieved feature ranking. The validity of the generated configurations is guaranteed by using a SAT solver that takes a representation of this graph in conjunctive normal form. We formalized this approach and implemented it in a prototype, RustyEx, by instrumenting the Rust compiler. An empirical evaluation on higher-ranked open source Rust projects shows that RustyEx efficiently generates user-specified sets of configurations within bounded resources, while ensuring soundness by construction. The results demonstrate that centrality-guided configuration prioritization enables effective and practical exploration of large configuration spaces, paving the way for future research in configuration-aware analysis and optimization.
翻译:现代编程语言(尤其是Rust)通过将软件系统构建为特征聚合体(由配置项标识)的方式,提供了构建高度可配置系统的高级语言构造。然而,这给程序分析、优化和测试带来了重大挑战,因为配置的组合爆炸通常使得穷举探索不可行。本文首次提出基于编译器的配置优先级排序方法。该方法包含四个主要步骤:1. 从Rust编译器中提取定制化的中间表示;2. 构建两种互补的基于图的数据结构;3. 运用中心性度量对特征进行排序;4. 通过考量特征影响的代码范围来精细化排序结果。基于所得特征排序,可生成固定数量的最相关配置。通过将图结构的合取范式表示输入SAT求解器,可确保生成配置的有效性。我们形式化了该方法,并通过改造Rust编译器在原型系统RustyEx中实现。对高星级开源Rust项目的实证评估表明,RustyEx能够在有限资源内高效生成用户指定规模的配置集合,同时通过构造过程保证正确性。实验结果表明,基于中心性度量的配置优先级排序能够实现对大规模配置空间的有效实践探索,为未来面向配置的分析与优化研究开辟了新路径。