WABT(1)
π WABT β wasm-opcodecnt π
okay bestie, so you found your way into the WABT manual (that's the WebAssembly Binary Toolkit, the whole iconique family) and specifically into the page for wasm-opcodecnt. this one is a little stats goblin and honestly? she eats. let's get into it π
β¨ NAME β¨
wasm-opcodecnt β literally just counts how many times each opcode shows up in your instructions. that's the whole job. she's a counter. she's counting. π
πΈ SYNOPSIS πΈ
wasm-opcodecnt [options] file ...
yep, that's it. options first, then one or more files, and she'll do her thing. β¨
π¦ DESCRIPTION π¦
So here's the vibe: wasm-opcodecnt reads a file in the wasm binary format and counts opcode usage for instructions. Like, for every instruction she bumps a tally, and then she shows you the receipts. main character behaviour, fr fr. π
the options are as follows, and yes we're doing all of them, no skipping, that's the rules:
π OPTIONS π
--helpβ prints a help message. the "hi bestie what do you need" of flags. π«Ά--versionβ prints version information. show her some ID please. π-v,--verboseβ use it multiple times for more info. stack it up, the more-vthe more tea. β--enable-exceptionsβ enables Experimental exception handling. π¨--disable-mutable-globalsβ disables Import/export mutable globals.--disable-saturating-float-to-intβ disables Saturating float-to-int operators.--disable-sign-extensionβ disables Sign-extension operators.--disable-simdβ disables SIMD support.--enable-threadsβ enables Threading support. π§΅--enable-function-referencesβ enables Typed function references.--disable-multi-valueβ disables Multi-value.--enable-tail-callβ enables Tail-call support.--disable-bulk-memoryβ disables Bulk-memory operations.--disable-reference-typesβ disables Reference types (externref).--enable-annotationsβ enables Custom annotation syntax.--enable-code-metadataβ enables Code metadata.--enable-gcβ enables Garbage collection. take out the trash, slay. ποΈβ¨--enable-memory64β enables 64-bit memory.--enable-multi-memoryβ enables Multi-memory.--enable-extended-constβ enables Extended constant expressions.--enable-allβ enables all features. yes all of them. the whole buffet. π₯-o,--output=FILENAMEβ output file for the opcode counts, by default use stdout. so if you don't pass it, she just yells the counts directly at your terminal. π¬-c,--cutoff=Nβ cutoff for reporting counts less thanN. anything underNdoesn't make the cut. sorry not sorry. βοΈ-s,--separator=SEPARATORβ separator text between element and count when reporting counts. so you can make it pretty. π
π EXAMPLES π
okay so the example in the manual says: Parse binary file test.wasm and write pcode dist file test.dist. here's the exact move:
$ wasm-opcodecnt test.wasm -o test.dist
and boom, test.dist has your opcode counts. iconic. π
β SEE ALSO β
go read these too, they're all family:
wasm-decompile(1), wasm-interp(1), wasm-objdump(1), wasm-strip(1), wasm-validate(1), wasm2c(1), wasm2wat(1), wast2json(1), wat-desugar(1), wat2wasm(1), spectest-interp(1)
π BUGS π
found a bug? don't suffer in silence bestie, report it at https://github.com/WebAssembly/wabt/issues. they wanna know. π«Ά
okay and that's the whole page, no cap. this one comes from the Debian folks, version$Mdocdate$, and yeah it'sWABT(1). mwah, go count some opcodes ππβ¨
π¦ where this page comes from
- debian bookworm: wabt 1.0.32-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms