The CSI Framework for Compiler-Inserted Program Instrumentation

T. Schardl, Tyler Denniston, Damon Doucet, Bradley C. Kuszmaul, I. Lee, C. Leiserson
{"title":"The CSI Framework for Compiler-Inserted Program Instrumentation","authors":"T. Schardl, Tyler Denniston, Damon Doucet, Bradley C. Kuszmaul, I. Lee, C. Leiserson","doi":"10.1145/3219617.3219657","DOIUrl":null,"url":null,"abstract":"The CSI framework provides comprehensive static instrumentation that a compiler can insert into a program-under-test so that dynamic-analysis tools - memory checkers, race detectors, cache simulators, performance profilers, code-coverage analyzers, etc. - can observe and investigate runtime behavior. Heretofore, tools based on compiler instrumentation would each separately modify the compiler to insert their own instrumentation. In contrast, CSI inserts a standard collection of instrumentation hooks into the program-under-test. Each CSI-tool is implemented as a library that defines relevant hooks, and the remaining hooks are \"nulled\" out and elided during either compile-time or link-time optimization, resulting in instrumented runtimes on par with custom instrumentation. CSI allows many compiler-based tools to be written as simple libraries without modifying the compiler, lowering the bar for the development of dynamic-analysis tools. We have defined a standard API for CSI and modified LLVM to insert CSI hooks into the compiler's internal representation (IR) of the program. The API organizes IR objects - such as functions, basic blocks, and memory accesses - into flat and compact ID spaces, which not only simplifies the building of tools, but surprisingly enables faster maintenance of IR-object data than do traditional hash tables. CSI hooks contain a \"property\" parameter that allows tools to customize behavior based on static information without introducing overhead. CSI provides \"forensic\" tables that tools can use to associate IR objects with source-code locations and to relate IR objects to each other. To evaluate the efficacy of CSI, we implemented six demonstration CSI-tools. One of our studies shows that compiling with CSI and linking with the \"null\" CSI-tool produces a tool-instrumented executable that is as fast as the original uninstrumented code. Another study, using a CSI port of Google's ThreadSanitizer, shows that the CSI-tool rivals the performance of Google's custom compiler-based implementation. All other demonstration CSI tools slow down the execution of the program-under-test by less than 70%.","PeriodicalId":210440,"journal":{"name":"Abstracts of the 2018 ACM International Conference on Measurement and Modeling of Computer Systems","volume":null,"pages":null},"PeriodicalIF":0.0000,"publicationDate":"2017-12-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"18","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Abstracts of the 2018 ACM International Conference on Measurement and Modeling of Computer Systems","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3219617.3219657","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 18

Abstract

The CSI framework provides comprehensive static instrumentation that a compiler can insert into a program-under-test so that dynamic-analysis tools - memory checkers, race detectors, cache simulators, performance profilers, code-coverage analyzers, etc. - can observe and investigate runtime behavior. Heretofore, tools based on compiler instrumentation would each separately modify the compiler to insert their own instrumentation. In contrast, CSI inserts a standard collection of instrumentation hooks into the program-under-test. Each CSI-tool is implemented as a library that defines relevant hooks, and the remaining hooks are "nulled" out and elided during either compile-time or link-time optimization, resulting in instrumented runtimes on par with custom instrumentation. CSI allows many compiler-based tools to be written as simple libraries without modifying the compiler, lowering the bar for the development of dynamic-analysis tools. We have defined a standard API for CSI and modified LLVM to insert CSI hooks into the compiler's internal representation (IR) of the program. The API organizes IR objects - such as functions, basic blocks, and memory accesses - into flat and compact ID spaces, which not only simplifies the building of tools, but surprisingly enables faster maintenance of IR-object data than do traditional hash tables. CSI hooks contain a "property" parameter that allows tools to customize behavior based on static information without introducing overhead. CSI provides "forensic" tables that tools can use to associate IR objects with source-code locations and to relate IR objects to each other. To evaluate the efficacy of CSI, we implemented six demonstration CSI-tools. One of our studies shows that compiling with CSI and linking with the "null" CSI-tool produces a tool-instrumented executable that is as fast as the original uninstrumented code. Another study, using a CSI port of Google's ThreadSanitizer, shows that the CSI-tool rivals the performance of Google's custom compiler-based implementation. All other demonstration CSI tools slow down the execution of the program-under-test by less than 70%.
用于编译器插入程序检测的CSI框架
CSI框架提供了全面的静态检测工具,编译器可以将其插入到被测程序中,以便动态分析工具——内存检查器、竞争检测器、缓存模拟器、性能分析器、代码覆盖率分析器等——可以观察和调查运行时行为。到目前为止,基于编译器插装的工具将分别修改编译器以插入它们自己的插装。相反,CSI在被测程序中插入一个标准的检测挂钩集合。每个csi工具都是作为定义相关钩子的库实现的,其余的钩子在编译时或链接时优化期间被“空化”和省略,从而导致仪表化的运行时与自定义仪表化相当。CSI允许将许多基于编译器的工具编写为简单的库,而无需修改编译器,从而降低了开发动态分析工具的门槛。我们为CSI定义了一个标准API,并修改了LLVM,以便将CSI钩子插入到程序的编译器内部表示(IR)中。API将IR对象(如函数、基本块和内存访问)组织到扁平和紧凑的ID空间中,这不仅简化了工具的构建,而且比传统的哈希表更快地维护IR对象数据。CSI钩子包含一个“属性”参数,该参数允许工具基于静态信息定制行为,而不会引入开销。CSI提供了“取证”表,工具可以使用这些表将IR对象与源代码位置关联起来,并将IR对象彼此关联起来。为了评估CSI的疗效,我们实施了六个示范CSI工具。我们的一项研究表明,使用CSI进行编译并链接到“null”CSI工具会产生一个工具检测的可执行文件,其速度与原始的未检测代码一样快。另一项使用Google ThreadSanitizer的CSI端口的研究表明,CSI工具的性能可以与Google基于编译器的定制实现相媲美。所有其他演示CSI工具将被测程序的执行速度降低不到70%。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信