WebAssembly的快速就地解释器
A fast in-place interpreter for WebAssembly
摘要:
WebAssembly(Wasm)是一种紧凑的、指定良好的字节码格式,它提供了一个具有接近本机执行速度的可移植编译目标。字节码格式被专门设计为能够快速解析、验证和编译,将自身定位为本机代码的可移植替代品。它被明确地设计成不能被直接解释。相反,当时的设计考虑集中在与本机代码竞争,利用优化编译器作为主要执行层。然而,在JIT场景中,编译时间和内存消耗严重影响应用程序启动,导致许多Wasm引擎稍后部署基线(单遍)编译器。尽管速度更快,但基线编译器仍然需要时间并浪费不经常执行的代码的代码空间。典型的解释器是不可行的,一些引擎不把Wasm编译成机器码,而是编译成更紧凑但易于解释的格式。这仍然需要时间和浪费内存。相反,我们在本文中介绍了一个快速的WebAssembly就地解释器,其中不需要重写,也不需要单独的格式。我们的评估表明,Wasm代码的就地解释具有空间效率和快速性,其性能与解释定制设计的内部格式不相上下。这填补了Wasm执行层空间中的一个漏洞,允许比以前的引擎配置更快的启动和更低的内存占用。
英文摘要:
WebAssembly (Wasm) is a compact, well-specified bytecode format that offers a portable compilation target with near-native execution speed. The bytecode format was specifically designed to be fast to parse, validate, and compile, positioning itself as a portable alternative to native code. It was pointedly not designed to be interpreted directly. Instead, design considerations at the time focused on competing with native code, utilizing optimizing compilers as the primary execution tier. Yet, in JIT scenarios, compilation time and memory consumption critically impact application startup, leading many Wasm engines to later deploy baseline (single-pass) compilers. Though faster, baseline compilers still take time and waste code space for infrequently executed code. A typical interpreter being infeasible, some engines resort to compiling Wasm not to machine code, but to a more compact, but easy to interpret format. This still takes time and wastes memory. Instead, we introduce in this article a fast in-place interpreter for WebAssembly, where no rewrite and no separate format is necessary. Our evaluation shows that in-place interpretation of Wasm code is space-efficient and fast, achieving performance on-par with interpreting a custom-designed internal format. This fills a hole in the execution tier space for Wasm, allowing for even faster startup and lower memory footprint than previous engine configurations.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。