调试 WebAssembly?给它加点 Whamm!
Debugging WebAssembly? Put some Whamm on it!
AI总结:
本文提出 Whamm,一种用于 WebAssembly 的声明式插桩 DSL,通过抽象插桩策略并利用字节码重写与引擎优化,解决了工具碎片化、高开销和底层定制繁琐的问题,实现了高效且可编程的程序监控。
摘要:
调试和监控程序对于软件的工程化与部署至关重要。动态分析技术通过源代码或 IR 注入、机器码或字节码重写,以及虚拟机或直接硬件支持来监控应用程序。尽管这些技术在各自领域内是可行的,但跨技术的通用工具却很罕见,导致技能碎片化、工作重复以及功能支持不一致。我们通过 Whamm 解决了 WebAssembly 生态系统中的这一问题,这是一种用于 WebAssembly 的声明式插桩 DSL,它对插桩策略进行了抽象,能够根据可用性利用字节码重写和引擎支持。Whamm 解决了三个问题:1)工具碎片化,2)通用框架过高的插桩开销,以及 3)定制底层高性能机制的繁琐性。Whamm 提供了完全可编程的插桩,具备声明式匹配规则、静态与动态谓词、自动状态报告和用户库支持,同时通过编译器和引擎优化实现了高性能。在后端,Whamm 以 Wasm 代码的形式向 Wasm 引擎提供插桩,复用现有的引擎优化并解锁新的优化,尤其是内联化(intrinsification),以最小化开销。具体而言,在匹配规则中显式请求程序状态,而非使用反射,使引擎能够高效地打包参数,甚至内联编译后的探针逻辑。Whamm 简化了工具开发工作,因为其字节码重写目标能够在任何地方运行插桩后的程序,降低了碎片化并推动了引擎支持的技术前沿。我们通过非平凡监控器的案例研究对 Whamm 进行了评估,结果表明它具有表达力、强大且高效。
英文摘要:
Debugging and monitoring programs are integral to engineering and deploying software. Dynamic analyses monitor applications through source code or IR injection, machine code or bytecode rewriting, and virtual machine or direct hardware support. While these techniques are viable within their respective domains, common tooling across techniques is rare, leading to fragmentation of skills, duplicated efforts, and inconsistent feature support. We address this problem in the WebAssembly ecosystem with Whamm, a declarative instrumentation DSL for WebAssembly that abstracts above the instrumentation strategy, leveraging bytecode rewriting and engine support as available. Whamm solves three problems: 1) tooling fragmentation, 2) prohibitive instrumentation overhead of general-purpose frameworks, and 3) tedium of tailoring low-level high-performance mechanisms. Whamm provides fully-programmable instrumentation with declarative match rules, static and dynamic predication, automatic state reporting, and user library support, while achieving high performance through compiler and engine optimizations. At the back end, Whamm provides instrumentation to a Wasm engine as Wasm code, reusing existing engine optimizations and unlocking new ones, most notably intrinsification, to minimize overhead. In particular, explicitly requesting program state in match rules, rather than reflection, enables the engine to efficiently bundle arguments and even inline compiled probe logic. Whamm streamlines the tooling effort, as its bytecode-rewriting target can run instrumented programs everywhere, lowering fragmentation and advancing the state of the art for engine support. We evaluate Whamm with case studies of non-trivial monitors and show it is expressive, powerful, and efficient.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。