bytecodealliance / wasmtime

A fast and secure runtime for WebAssembly
https://wasmtime.dev/
Apache License 2.0
14.82k stars 1.24k forks source link

wasmtime: Annotate emit-clif output with source line numbers #8771

Open jameysharp opened 3 weeks ago

jameysharp commented 3 weeks ago

When we're compiling a WebAssembly module that contains a DWARF .debug_lines section, this commit adds comments to the output of wasmtime compile --emit-clif indicating which file/line/column each block of CLIF instructions originated from.

This is useful when trying to understand why we're generating the code we do when there's a lot of WebAssembly in a single function. That can happen either because there's a lot of source code in that function, or because the toolchain (e.g. LLVM) inlined a lot of other functions into it before generating WebAssembly.

pchickey commented 3 weeks ago

This looks great to me, but I'm going to re-assign reviewer to Nick because he knows this domain a lot better than me.