WABT(1)

πŸ“¦
version 1.0.32 Β· 2 versions
, in debian bookworm

πŸ’– 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 -v the 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 than N. anything under N doesn'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's WABT(1). mwah, go count some opcodes πŸ’‹πŸŽ€βœ¨
πŸ“¦ where this page comes from