Skip to content

[wasm] Add wa-info tool to src/mono/wasm/tools #110565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 160 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
2b481ee
[wa-info] Initial commit
radekdoulik Aug 27, 2021
4f33c0c
[wa-info] Initial import
radekdoulik Aug 27, 2021
5a125bf
[wa-info] Add .gitignore
radekdoulik Aug 27, 2021
2ba651a
[wa-info] Start reading code section
radekdoulik Aug 28, 2021
2ad558f
[wa-info] Add opcodes
radekdoulik Aug 28, 2021
eb66e0a
[wa-info] Read instructions
radekdoulik Aug 31, 2021
8996284
[wa-info] Refactoring
radekdoulik Aug 31, 2021
85bb559
[wa-info] Parse custom name section
radekdoulik Sep 15, 2021
4946f98
[wa-info] Read selected name maps
radekdoulik Sep 15, 2021
57b5f6f
[wa-info] Add assembly reader
radekdoulik Sep 17, 2021
7af97dd
[wa-info] WIP, add new options and filter by assembly & type
radekdoulik Sep 17, 2021
2fdd88b
[wa-info] Simple code dump
radekdoulik Sep 20, 2021
64ece3e
[wa-info] Add disassemble and function filter options
radekdoulik Sep 20, 2021
b058c92
[wa-info] Improve instruction print
radekdoulik Sep 20, 2021
4650323
[wa-info] Fix function lookup
radekdoulik Sep 20, 2021
562ac4b
[wa-info] Cleaning the code
radekdoulik Sep 20, 2021
d87cad0
[wa-info] Count how many functions use interpreter
radekdoulik Sep 20, 2021
290a2ab
[wa-info] Add simplified options
radekdoulik Sep 20, 2021
b667fe0
[wa-info] Show globals names in disassembly
radekdoulik Sep 21, 2021
334669f
[wa-info] Show offset & align for memory instructions
radekdoulik Sep 21, 2021
1565d59
[wa-info] Print summary when no -d or --aot-stats are used
radekdoulik Oct 4, 2021
dcbddd4
[wa-info] Print function index when we don't know the name
radekdoulik Oct 4, 2021
305a306
[wa-info] Print function parameters when they are present
radekdoulik Oct 4, 2021
d90c14a
[wa-info] Print I64,F32,F64 const instructions
radekdoulik Oct 4, 2021
ecb36ba
[wa-info] Show `else` for else blocks in disassembly
radekdoulik Oct 4, 2021
48589bb
[wa-info] Add more information to the README
radekdoulik Oct 4, 2021
da86aa8
[wa-info] Add dotnet tool properties
radekdoulik Oct 4, 2021
be8d3fa
[wa-info] Add github workflow to build and publish nuget
radekdoulik Oct 4, 2021
05e323c
[wa-info] Use dotnet 6.0.x
radekdoulik Oct 4, 2021
74820f7
[wa-info] Add include-prerelease
radekdoulik Oct 4, 2021
4679c7c
[wa-info] Remove publish to github action
radekdoulik Oct 4, 2021
d945540
[wa-info] Add info about installation as dotnet tool
radekdoulik Oct 4, 2021
340a027
[wa-info] Show function type and tbl index for call.indirect
radekdoulik Oct 4, 2021
54c7ffb
[wa-info] Add note about name section
radekdoulik Oct 4, 2021
19e3df2
[wa-info] Print custom section names in the summary
radekdoulik Oct 4, 2021
6dcd247
[wa-info] Faster code disassembly
radekdoulik Oct 5, 2021
5e6d0f9
[wa-info] Fix --aot-stats to work with lazy code reading
radekdoulik Oct 5, 2021
15004a1
[wa-info] Release version 0.0.2
radekdoulik Oct 5, 2021
21a4d55
[wa-info] Update README
radekdoulik Oct 5, 2021
b330e30
[wa-info] Fix README formatting
radekdoulik Oct 5, 2021
c33adb7
[wa-info] Fix compiler warning
radekdoulik Oct 5, 2021
e082080
[wa-info] Update nuget information and license
radekdoulik Oct 5, 2021
37a9585
[wa-info] Release version 0.0.3
radekdoulik Oct 5, 2021
9c67c14
[wa-info] Add new -o option
radekdoulik Nov 25, 2021
08b6a5b
[wa-info] Release version 0.0.4
radekdoulik Nov 25, 2021
6fad19c
[wa-info] Read table and element sections
radekdoulik Nov 26, 2021
b4907a2
[wa-info] Add SIMD support
radekdoulik Mar 7, 2022
665a646
[wa-info] Release version 0.0.5
radekdoulik Mar 7, 2022
4953136
[wa-info] Update README
radekdoulik Mar 8, 2022
38a863a
[wa-info] Print v128.const immediate value
radekdoulik Mar 11, 2022
3082138
[wa-info] Add exception handling instructions
radekdoulik Mar 11, 2022
bc23e4b
[wa-info] Release version 0.0.6
radekdoulik Mar 15, 2022
d26a139
[wa-info] Beginning of wa-diff tool
radekdoulik Mar 15, 2022
d368e3f
[wa-info] Show file size and sections difference in bytes
radekdoulik Mar 16, 2022
190c748
[wa-info] Improve sections comparison
radekdoulik Mar 16, 2022
3051e55
[wa-info] Fix wa-info build
radekdoulik Mar 16, 2022
e77f644
[wa-info] Add Tag section id
radekdoulik Mar 16, 2022
61dbd5b
[wa-info] Publish nuget only for commits with version tags
radekdoulik Mar 25, 2022
db63593
[wa-info] Compare disassembled functions with -d and -f
radekdoulik Mar 25, 2022
7b51d1c
[wa-info] Build and publish both tools
radekdoulik Mar 25, 2022
883fd5a
[wa-info] Fix packaging
radekdoulik Mar 25, 2022
171b97f
[wa-info] Fix workflow
radekdoulik Mar 25, 2022
d050732
[wa-info] Fix artifacts upload
radekdoulik Mar 25, 2022
ba8dbaa
[wa-info] Add WasmStructs.cs back
radekdoulik Mar 25, 2022
60a5206
[wa-info] Add info about wa-diff
radekdoulik Mar 25, 2022
5bef7c6
[wa-info] Fix help and colors
radekdoulik Mar 25, 2022
b89ce86
[wa-info] Release version 0.0.7
radekdoulik Mar 25, 2022
1cefd12
[wa-info] Revert "Publish nuget only for commits with version tags"
radekdoulik Mar 25, 2022
c6c9fe3
[wa-info] Fix GetFunctionIdx
radekdoulik Mar 30, 2022
3ec9143
[wa-info] Use otherIdx where appropriate
radekdoulik Mar 30, 2022
d9b43ba
[wa-info] Lookup the other function in other reader
radekdoulik Mar 30, 2022
36dec04
[wa-info] Fix method names in call instruction's ToString
radekdoulik Mar 30, 2022
37f9b46
[wa-info] Release version 0.0.8
radekdoulik Mar 30, 2022
2a81cdc
[wa-info] Fix SIMD opcode reading
radekdoulik Apr 11, 2022
527cadc
[wa-info] Handle vector type in value types
radekdoulik Apr 11, 2022
14cece8
[wa-info] Display local names to make code more readable
radekdoulik Apr 11, 2022
12442cf
[wa-info] Display parameter names to improve readability
radekdoulik Apr 11, 2022
a31d30e
[wa-info] Pass start index
radekdoulik Apr 11, 2022
7a4ad4b
[wa-info] Release version 0.0.9
radekdoulik Apr 11, 2022
1b8d50d
[wa-info] Display imm lane for replace.lane instructions
radekdoulik Apr 12, 2022
656aeeb
[wa-info] Display imm lane for mode SIMD instructions
radekdoulik Apr 12, 2022
c6646d7
[wa-info] New function-offset option to filter functions
radekdoulik Jul 11, 2022
fae4a9c
[wa-info] Improve print of I8x16_Shuffle SIMD opcode
radekdoulik Jul 11, 2022
35f942d
[wa-info] Add MT instructions
radekdoulik Sep 8, 2022
445e8ca
[wa-info] Fix -d without function filter or offset set
radekdoulik Sep 8, 2022
cb09c13
[wa-info] Add Prefix instructions
radekdoulik Sep 8, 2022
8e615ff
[wa-info] Add few missing instructions
radekdoulik Sep 8, 2022
dcd99ce
[wa-info] Fix reading of atomic fence
radekdoulik Sep 8, 2022
7b58d06
[wa-info] Print MT and Prefix instructions
radekdoulik Sep 8, 2022
e469151
[wa-info] Release version 0.0.10
radekdoulik Sep 8, 2022
2c48f7a
[wa-info] Remove debug print
radekdoulik Sep 8, 2022
f484944
[wa-info] Release version 0.0.11
radekdoulik Sep 8, 2022
5c45617
[wa-info] Add new file with MT opcodes
radekdoulik Sep 8, 2022
c4a608d
[wa-info] Parse Data section
radekdoulik Nov 3, 2022
f19a960
[wa-info] More info for Data section
radekdoulik Nov 3, 2022
0da1d10
[wa-info] Fix wrong function offsets
radekdoulik Nov 4, 2022
4f09f77
[wa-info] Parse Global section
radekdoulik Nov 4, 2022
ada3e54
[wa-info] Make data segments parse output better readable
radekdoulik Nov 4, 2022
c893431
[wa-info] Release version 0.0.12
radekdoulik Nov 4, 2022
f2e957d
[wa-info] Fix functions comparison
radekdoulik Nov 28, 2022
a388421
[wa-info] Start wa-edit tool implementation
radekdoulik Nov 28, 2022
02bbd08
[wa-info] Implement rewriting of Data section
radekdoulik Nov 28, 2022
9d4b74a
[wa-info] Add forgotten file
radekdoulik Nov 28, 2022
cc4da1b
[wa-info] Fix data segment length
radekdoulik Nov 28, 2022
915866b
[wa-info] Add a|data-auto-split option
radekdoulik Nov 29, 2022
144ff01
[wa-info] Format the numbers
radekdoulik Nov 29, 2022
a7518d9
[wa-info] Parse Memory section
radekdoulik Nov 29, 2022
e8ef83f
[wa-info] Add `m|data-section-mode=` option
radekdoulik Nov 30, 2022
e9b9bdf
[wa-info] Do not write DataCount section
radekdoulik Nov 30, 2022
d37f78e
[wa-info] Publish wa-edit
radekdoulik Nov 30, 2022
4cde4a7
[wa-info] Use .net 7 as wa-edit requires it
radekdoulik Nov 30, 2022
9ffdcf0
[wa-info] Release new version 0.0.13
radekdoulik Nov 30, 2022
3b3bcab
[wa-info] Add wa-edit information
radekdoulik Nov 30, 2022
32347ca
[wa-info] Update wa-edit example to look as other examples
radekdoulik Nov 30, 2022
62c3f9f
[wa-info] Add installation info for wa-edit
radekdoulik Nov 30, 2022
ed458c3
[wa-info] Add RollForward=Major property to build (#2)
lambdageek Dec 1, 2022
f836f94
[wa-info] Read function names from dotnet.js.symbols
radekdoulik Jan 2, 2023
1096bc2
[wa-info] Fill nameToFunction when reading function names
radekdoulik Jan 2, 2023
83d191a
[wa-info] Use wasm's file filename to read js.symbols
radekdoulik Jan 5, 2023
c7f4d37
[wa-info] Add s|function-size option to wa-diff
radekdoulik Jan 5, 2023
e14787b
[wa-info] Fix I32 write
radekdoulik Jan 9, 2023
fe06d00
[wa-info] Print sorted table with function code size delta
radekdoulik Jan 10, 2023
474e7a6
[wa-info] Fix few idx vs otherIdx errors
radekdoulik Jan 10, 2023
d38f546
[wa-info] Print size table total
radekdoulik Jan 10, 2023
3615ec3
[wa-info] Omit zero differences
radekdoulik Jan 10, 2023
959f169
[wa-info] Improve functions comparison
radekdoulik Jan 16, 2023
b28d4ca
[wa-info] Fix build
radekdoulik Jan 17, 2023
069d4fa
[wa-info] Add solution with all tools projects
radekdoulik Jan 17, 2023
99f95de
[wa-info] Add new h|hide-const-loads option
radekdoulik Jan 17, 2023
64d05ce
[wa-info] Add wa-diff example output with -h
radekdoulik Jan 17, 2023
54dd5bf
[wa-info] Add note about -vv to help messages
radekdoulik Jan 17, 2023
2cf0413
[wa-info] Update usage in the README
radekdoulik Jan 17, 2023
17033c8
[wa-info] Release new version 0.1
radekdoulik Jan 17, 2023
04bb607
[wa-info] Add RollForward major to wa-edit as well
radekdoulik Jan 17, 2023
32a770e
[wa-info] Improve import description parsing
radekdoulik Sep 11, 2024
2880b7b
[wa-info] Initial wit component support
radekdoulik Sep 13, 2024
8c9e59a
[wa-info] Fix warnings
radekdoulik Sep 13, 2024
351a026
[wa-info] Release version 0.2
radekdoulik Sep 13, 2024
cf33609
[wa-info] Remove debug print
radekdoulik Sep 23, 2024
695ae75
[wa-info] Sumarise wit sections in the summary info
radekdoulik Oct 7, 2024
61de07e
[wa-info] Parse WIT export and import sections
radekdoulik Oct 8, 2024
12eb9c7
[wa-info] Add 2 new options to print wit exports/imports
radekdoulik Oct 8, 2024
826bd09
[wa-info] Release version 0.3
radekdoulik Oct 8, 2024
4c00284
[wa-info] Add wa-lib and refactor
radekdoulik Oct 25, 2024
c9378ea
[wa-info] Show custom section data in verbose2 as dump bytes
radekdoulik Oct 30, 2024
8ba6226
[wa-info] Complete imports improvements
radekdoulik Oct 30, 2024
50c0feb
[wa-info] Fix dump bytes to correctly display last line
radekdoulik Oct 30, 2024
da1ba8c
[wa-info] Release version 0.4
radekdoulik Oct 30, 2024
eefae2f
[wa-info] Parse linking section and symbol table
radekdoulik Nov 12, 2024
52e0ddf
[wa-info] Parse WasmSegmentInfo linking subsection
radekdoulik Nov 20, 2024
1743f58
[wa-info] Parse relocation tables
radekdoulik Nov 20, 2024
3a7c0a8
[wa-info] Parse remaining linking section subsections types
radekdoulik Dec 4, 2024
615fe4c
[wa-info] Release version 0.5
radekdoulik Dec 4, 2024
166a786
[wa-info] Update README.md
radekdoulik Dec 4, 2024
2985f95
[wa-info] Reference wa-lib from WBT and use NetCoreAppToolCurrent tfm
radekdoulik Dec 6, 2024
3ed26b1
[wa-info] Fix code-analysis errors
radekdoulik Dec 6, 2024
71e1a76
Merge branch 'main' into pr-rodo-add-wa-info-tool
radekdoulik Feb 13, 2025
c03216e
Merge branch 'main' into pr-rodo-add-wa-info-tool
radekdoulik Mar 3, 2025
f049946
Merge branch 'main' into pr-rodo-add-wa-info-tool
radekdoulik May 6, 2025
9b326f0
Style fixes
radekdoulik May 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/mono/wasm/Wasm.Build.Tests/Wasm.Build.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
<PackageReference Include="Microsoft.Playwright" Version="1.47.0" />
<PackageReference Include="MSBuild.StructuredLogger" Version="2.2.350" />
<ProjectReference Include="$(RepoRoot)src\tasks\Microsoft.NET.Sdk.WebAssembly.Pack.Tasks\Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj" />
<ProjectReference Include="$(RepoRoot)src\mono\wasm\tools\wa-info\wa-lib\wa-lib.csproj" />
<Compile Include="$(BrowserProjectRoot)debugger\DebuggerTestSuite\BrowserLocator.cs" />

<None Include="$(BrowserProjectRoot)\test-main.js" CopyToOutputDirectory="PreserveNewest" />
<None Include="..\testassets\**\*" Link="testassets\%(RecursiveDir)%(FileName)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
Expand Down
48 changes: 48 additions & 0 deletions src/mono/wasm/tools/wa-info/.github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: .NET Core

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
include-prerelease: true
source-url: https://nuget.pkg.github.com/<owner>/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Install dependencies
run: |
dotnet restore wa-info; dotnet restore wa-diff; dotnet restore wa-edit
- name: Build
run: |
dotnet build --configuration Release --no-restore wa-info; dotnet build --configuration Release --no-restore wa-diff; dotnet build --configuration Release --no-restore wa-edit
- name: Test
run: |
dotnet test --no-restore --verbosity normal wa-info; dotnet test --no-restore --verbosity normal wa-diff; dotnet test --no-restore --verbosity normal wa-edit
- name: Pack nuget
run: |
dotnet pack -c Release wa-info; dotnet pack -c Release wa-diff; dotnet pack -c Release wa-edit
- name: Artifacts
uses: actions/upload-artifact@v3
with:
name: NuGets
path: |
wa-info\nupkg\*.nupkg
wa-diff\nupkg\*.nupkg
wa-edit\nupkg\*.nupkg
- name: Setup NuGet
uses: nuget/setup-nuget@v1
- name: Publish to nuget
run: |
dotnet nuget push wa-info\nupkg\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --no-symbols --skip-duplicate --source "https://api.nuget.org/v3/index.json"; dotnet nuget push wa-diff\nupkg\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --no-symbols --skip-duplicate --source "https://api.nuget.org/v3/index.json"; dotnet nuget push wa-edit\nupkg\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --no-symbols --skip-duplicate --source "https://api.nuget.org/v3/index.json"
4 changes: 4 additions & 0 deletions src/mono/wasm/tools/wa-info/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
obj/
bin/
.vs/
nupkg/
6 changes: 6 additions & 0 deletions src/mono/wasm/tools/wa-info/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<ProductVersion>0.5</ProductVersion>
</PropertyGroup>
<Import Project="../../../Directory.Build.props" />
</Project>
21 changes: 21 additions & 0 deletions src/mono/wasm/tools/wa-info/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) .NET Foundation Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
286 changes: 286 additions & 0 deletions src/mono/wasm/tools/wa-info/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
# wa-info
`wa-info` is a tool to inspect [WebAssembly](https://webassembly.org/) [binary format](https://webassembly.github.io/spec/core/binary/index.html) wasm files.

It can show sections overview in the summary output, disassemble function(s) code, show information about dotnet AOT. It is available as [dotnet tool](https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools).

It can also inspect WIT component wasm files, produced by WASI tools. And wasm object files produced by clang or other tools.

# wa-diff

`wa-diff` is a tool to compare WebAssembly binary files

# wa-edit

`wa-edit` is a tool to modify WebAssembly binary files

### Installation

To install `wa-info`, `wa-diff` and `wa-edit` as dotnet tool run:
```
dotnet tool install -g wa-info
dotnet tool install -g wa-diff
dotnet tool install -g wa-edit
```
to update use:
```
dotnet tool update -g wa-info
dotnet tool update -g wa-diff
dotnet tool update -g wa-edit
```

### Nugets

The packaged tools can be also retrieved as nugets

https://www.nuget.org/packages/wa-info
https://www.nuget.org/packages/wa-diff
https://www.nuget.org/packages/wa-edit

### Command line options

wa-info:
```
Usage: wa-info OPTIONS* file.wasm [file2.wasm ...]

Provides information about WebAssembly file(s)

Copyright 2021 Microsoft Corporation

Options:
--aot-stats Show stats about methods
-a, --assembly-filter=REGEX
Filter assemblies and process only those matching
REGEX
-d, --disassemble Show functions(s) disassembled code
-f, --function-filter=REGEX
Filter wasm functions REGEX
--function-offset=REGEX
Filter wasm functions REGEX
-h, --help, -? Show this message and exit
-o, --instruction-offsets Show instruction offsets
-t, --type-filter=REGEX Filter types and process only those matching REGEX
-v, --verbose Output information about progress during the run
of the tool. Use multiple times to increase
verbosity, like -vv
```

wa-diff:
```
Usage: wa-diff OPTIONS* file1.wasm file2.wasm

Compares WebAssembly binary file(s)

Copyright 2021 Microsoft Corporation

Options:
-d, --disassemble Show functions(s) disassembled code
-f, --function-filter=REGEX
Filter wasm functions REGEX
--function-offset=REGEX
Filter wasm functions REGEX
-h, --hide-const-loads Hide const loads values
-s, --function-size Compare function code sizes
-v, --verbose Output information about progress during the run
of the tool. Use multiple times to increase
verbosity, like -vv
```

wa-edit:
```
Usage: wa-edit OPTIONS* source.wasm destination.wasm

Modifies WebAssembly file (source.wasm) and writes updated file (destination.
wasm)

Copyright 2022 Microsoft Corporation

Options:
-a, --data-auto-split Split the data segment to avoid long empty chunks
with zeroes
-d, --data-section=FILE Replace the data section with content of the FILE
-m, --data-section-mode=MODE
Set the data section replacement MODE. Possible
values: Active, Passive
-o, --data-offset=VALUE Data section offset
-h, --help, -? Show this message and exit
-v, --verbose Output information about progress during the run
of the tool. Use multiple times to increase
verbosity, like -vv
```

### Example usage
Disassemble function
```
> wa-info -d -f test test.wasm
(func test_simd(param i32) (result i32))
local 1 123
local.get $0
i32x4.splat [SIMD]
local.tee $1
local.get $1
i16x8.avgr.u [SIMD]
i32x4.extract.lane [SIMD]
```

Summary of the module and sections
```
> wa-info dotnet.wasm
Module: path: dotnet.wasm
size: 74,502,446
binary format version: 1
sections: 17
id: Type size: 5,237
id: Import size: 4,315
id: Function size: 163,566
id: Table size: 9
id: Memory size: 7
id: Global size: 19
id: Export size: 7,213
id: Element size: 428,929
id: Code size: 34,177,740
id: Data size: 9,520,741
id: Custom name: name size: 21,544,785
id: Custom name: .debug_info size: 4,035,679
id: Custom name: .debug_loc size: 1,436,083
id: Custom name: .debug_ranges size: 140,966
id: Custom name: .debug_abbrev size: 240,230
id: Custom name: .debug_line size: 2,060,872
id: Custom name: .debug_str size: 735,984
```

Disassemble function

*note: build the app with `-p:WasmNativeDebugSymbols=true -p:WasmNativeStrip=false` to preserve name custom section*
```
> wa-info -d -f ves_icall_RuntimeFieldInfo_GetValueInternal$ dotnet.wasm
(func ves_icall_RuntimeFieldInfo_GetValueInternal(param i32 i32 i32) (result i32))
local.get $0
i32.load align:2
i32.load offset:12 align:2
local.tee $0
local.get $1
if
local.get $1
i32.load align:2
else
i32.const 0

local.tee $1
local.get $2
call mono_field_get_value_object_checked
i32.const 11201820
i32.load align:2
call mono_handle_new
```

Get AOT stats
```
> wa-info --aot-stats dotnet.wasm
AOT stats: 5005 function(s) call(s) interpreter, 2.96% of 169215 functions
```

Compare functions
```
> wa-diff -d -f corlib_System_RuntimeType_IsDelegate dotnet1.wasm dotnet2.wasm
(func corlib_System_RuntimeType_IsDelegate(param i32 i32) (result i32))
...
local.tee $2
global.set $__stack_pointer
- i32.const 1573600
+ i32.const 1573760
i32.load8.u
i32.eqz
...
i32.const 25177
call aot_wrapper_pinvoke_corlib__Interop_sl_Sys___le_PosixFAdvise_gt_g____PInvoke___verbar_83_0_pinvoke_i4_iii8i8cl1a_Interop_2fSys_2fFileAdvice_i4_iii8i8cl1a_Interop_2fSys_2fFileAdvice_
- i32.const 1573600
+ i32.const 1573760
i32.const 1
i32.store8
...
i32.store offset:12 align:2
local.get $2
- i32.const 1516792
+ i32.const 1516952
i32.load align:2
local.tee $3
```

Hide load consts, this helps to reduce "noise" when checking the code changes. Output with `-h`
```
> wa-diff -h -d -f corlib.*Vector128_1_long_GetHashCode 1.wasm 2.wasm
(func corlib_System_Runtime_Intrinsics_Vector128_1_long_GetHashCode(param i32, i32) (result i32))
...
i64.load align:3
local.get $1
- call corlib_System_HashCode_Add_T_ULONG_T_ULONG
+ call corlib_System_HashCode_Add_T_LONG_T_LONG
local.get $0
i32.const
...
i64.load offset:8 align:3
local.get $1
- call corlib_System_HashCode_Add_T_ULONG_T_ULONG
+ call corlib_System_HashCode_Add_T_LONG_T_LONG
local.get $1
local.get $1
```
and standard output:
```
> wa-diff -d -f corlib.*Vector128_1_long_GetHashCode 1.wasm 2.wasm
(func corlib_System_Runtime_Intrinsics_Vector128_1_long_GetHashCode(param i32, i32) (result i32))
...
local.tee $1
global.set $global:0
- i32.const 4411468
+ i32.const 4900240
i32.load8.u
i32.eqz
if
- i32.const 869872
+ i32.const 1032336
call mono_aot_corlib_init_method
- i32.const 4411468
+ i32.const 4900240
i32.const 1
i32.store8
...
i64.load align:3
local.get $1
- call corlib_System_HashCode_Add_T_ULONG_T_ULONG
+ call corlib_System_HashCode_Add_T_LONG_T_LONG
local.get $0
i32.const -1
...
i64.load offset:8 align:3
local.get $1
- call corlib_System_HashCode_Add_T_ULONG_T_ULONG
+ call corlib_System_HashCode_Add_T_LONG_T_LONG
local.get $1
local.get $1
```

Replace Data section
```
> wa-edit -v dotnet.wasm d4.wasm -a -o 0 -d memory.dat
Reading wasm file: dotnet.wasm
Writing wasm file: d4.wasm
WebAssembly binary format version: 1
Reading section: Type size: 1632
Reading section: Import size: 3104
Reading section: Function size: 17745
Reading section: Table size: 5
Reading section: Memory size: 7
Reading section: Global size: 2394
Reading section: Export size: 4227
Reading section: Element size: 8702
Reading section: Code size: 6282132
Reading section: Data size: 649676 segments detected: 29,539 zero bytes stripped: 48,137,494
Reading section: Custom size: 880619
Reading section: Custom size: 3388054
Reading section: Custom size: 360611
Reading section: Custom size: 134358
Reading section: Custom size: 211464
Reading section: Custom size: 3645378
Reading section: Custom size: 706701
```
Loading
Loading