一句话:提出模块重语境化技术,在未修改的生产运行时中实现高效的模块级动态分析。
动态程序分析长期用于获取程序执行信息,但现有系统在生产语言运行时中往往带来高昂开销。本文提出模块重语境化(module recontextualization),利用 JavaScript、Racket 等现代动态语言在运行时以字符串形式加载模块代码的导入机制,在模块加载前对其进行轻量级加载时代码变换:变换作用于模块的字符串表示及其即将绑定的上下文,将开发者提供的、分析专用的代码插入模块,从而在未修改的生产语言运行时环境中捕获围绕该模块的所有交互。作者在 JavaScript 和 Racket 生态中分别实现系统,并评估表明该方法相较当前最先进的动态分析系统可带来数量级(order-of-magnitude)的性能提升,同时支持多种分析,平均每种分析仅需约 100 行代码实现。
Dynamic program analysis is a long-standing technique for obtaining information about program execution. We present module recontextualization, a new dynamic analysis approach that targets modern dynamic languages such as JavaScript and Racket, enabled by the fact that they feature a module-import mechanism that loads code at runtime as a string. This approach uses lightweight load-time code transformations that operate on the string representation of the module, as well as the context to which it is about to be bound, to insert developer-provided, analysis-specific code into the module before it is loaded. This code implements the dynamic analysis, enabling this approach to capture all interactions around the module in unmodified production language runtime environments. We implement this approach in two systems targeting the JavaScript and Racket ecosystems. Our evaluation shows that this approach can deliver order-of-magnitude performance improvements over state-of-the-art dynamic analysis systems while supporting a range of analyses, implemented on average in about 100 lines of code.
@inproceedings{paperbot6406,
title = {Efficient module-level dynamic analysis for dynamic languages with module recontextualization},
author = {Nikos Vasilakis and Grigoris Ntousakis and Veit Heller and Martin C. Rinard},
booktitle = {FSE},
year = {2021},
doi = {10.1145/3468264.3468574}
}