一句话:通过开发者提供的常量输入特化程序并删除未使用特性,从而缩减代码体积。
Trimmer 是一个代码体积缩减工具,核心思想是利用开发者提供的常量输入(命令行选项或配置文件)对程序进行特化。这些常量决定特定部署中需要保留的特性,进而可删除未使用特性。Trimmer 包含面向输入特化的编译器变换,支持精确而高效的上下文敏感过程间常量传播,并引入自定义循环展开器。工具易用且高度参数化,开发者可显式权衡分析精度与特化时间。论文还概述了 Trimmer 的静态分析遍。源码与演示视频已公开。
We present Trimmer, a state-of-the-art tool for reducing code size. Trimmer reduces code sizes by specializing programs with respect to constant inputs provided by developers. The static data can be provided as command-line options or through configuration files. The constants define the features that must be retained, which in turn determine the features that are unused in a specific deployment (and can therefore be removed). Trimmer includes sophisticated compiler transformations for input specialization, supports precise yet efficient context-sensitive inter-procedural constant propagation, and introduces a custom loop unroller. Trimmer is easy-to-use and extensively parameterized. We discuss how Trimmer can be configured by developers to explicitly trade analysis precision and specialization time. We also provide a high-level description of Trimmer’s static analysis passes. The source code is publicly available at: https://github.com/ashish-gehani/Trimmer. A video demonstration can be found here: https://youtu.be/6pAuJ68INnI.