Files
sdk/pkg/dart2wasm/docs/inspecting_wasm.md
T
Martin Kustermann 10429f4e89 [dart2wasm] Add a bit more documentation to pkg/dart2wasm/doc/*
Adds some more documentation about

* using `wami` to dump section stats / wasm code
* building & testing dart2wasm

...

Change-Id: I439daf04d8f4599e817577c3b4cb58053a836b47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365806
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-05-15 11:11:27 +00:00

888 B

Inspecting the generated Wasm code

Using the compiler itself

The compiler allows printing the Wasm code for all functions by using --print-wasm

pkg/dart2Wasm/tool/compile_benchmark --compiler-asserts --print-wasm app.dart app.wasm

Use wami to inspect Wasm files

The V8 repository contains a wami tool to inspect Wasm files.

First ensure you Checkout & Build V8. That will result in a out/x64.release/wami binary.

Consider putting it into PATH or adding an alias wami=<path-to-v8>/out/x64.release/wami into shellrc.

Inspect sections of Wasm file

It can be used to dump section statistics

% wami --section-stats -o app.stats app.wasm

Inspect contents of Wasm file

It can be used to dump the entire Wasm file with or without offsets

% wami --offsets --full-wat -o app.wat app.wasm
% wami --full-wat -o app.wat app.wasm