Stream: git-wasmtime

Topic: wasmtime / issue #9461 Duplicate JIT debug module registr...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 13 2024 at 20:43):

SingleAccretion opened issue #9461:

Reproduction:
1) Compile any component, e. g.

int main()
{
    int a = 1;
    return a;
}
> & $env:WASI_SDK_PATH/bin/clang main.cpp -o main.wasm -g3 -target wasm32-unknown-wasip2

2) Debug with lldb+wasmtime:

> lldb wasmtime -- -D debug-info -O opt-level=0 main.wasm
> (lldb) b main
> (lldb) c ; Until you reach WASM's 'main'

3) Observe four (JIT) modules (for each core module in a component). All of them have the exact same content.

> (lldb) image list

4) Also observe that LLDB needed to index the same DWARF info four times. This means that "startup with debugging" is 4x slower if we exclude the time to compile code and transform DWARF.

The bug is somewhere around here:
https://github.com/bytecodealliance/wasmtime/blob/460a4c0ad5d3655b7dbaec193e726196de848898/crates/wasmtime/src/runtime/instantiate.rs#L72-L79

AFAICT, with components, the generated image is a shared (among core modules) resource, so each Module::from_parts_raw call here:
https://github.com/bytecodealliance/wasmtime/blob/460a4c0ad5d3655b7dbaec193e726196de848898/crates/wasmtime/src/runtime/component/component.rs#L408-L414

Registers the same image.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 16 2024 at 23:19):

alexcrichton closed issue #9461:

Reproduction:
1) Compile any component, e. g.

int main()
{
    int a = 1;
    return a;
}
> & $env:WASI_SDK_PATH/bin/clang main.cpp -o main.wasm -g3 -target wasm32-unknown-wasip2

2) Debug with lldb+wasmtime:

> lldb wasmtime -- -D debug-info -O opt-level=0 main.wasm
> (lldb) b main
> (lldb) c ; Until you reach WASM's 'main'

3) Observe four (JIT) modules (for each core module in a component). All of them have the exact same content.

> (lldb) image list

4) Also observe that LLDB needed to index the same DWARF info four times. This means that "startup with debugging" is 4x slower if we exclude the time to compile code and transform DWARF.

The bug is somewhere around here:
https://github.com/bytecodealliance/wasmtime/blob/460a4c0ad5d3655b7dbaec193e726196de848898/crates/wasmtime/src/runtime/instantiate.rs#L72-L79

AFAICT, with components, the generated image is a shared (among core modules) resource, so each Module::from_parts_raw call here:
https://github.com/bytecodealliance/wasmtime/blob/460a4c0ad5d3655b7dbaec193e726196de848898/crates/wasmtime/src/runtime/component/component.rs#L408-L414

Registers the same image.


Last updated: Nov 22 2024 at 17:03 UTC