demo · v137

Hex Inspector

Branch hints ship as a custom section called metadata.code.branch_hint. The bytes are silently consumed by the engine — there's no JS API to inspect them. Below: two binaries with the same logic, one with a hint, one without. Watch them validate, instantiate, and see exactly which bytes differ.

probing…

module A: plain

awaiting…

module B: with branch hint

awaiting…
sectionmodule Amodule B
magic + version00 61 73 6d 01 00 00 0000 61 73 6d 01 00 00 00
type / func / export sectionssamesame
code sectionplain if blockplain if block (untouched)
custom section(absent)metadata.code.branch_hint — 1 entry → func 0 → instruction offset → likely

the code

// The hint lives in a custom section the engine reads, but
// JS never sees. We can still construct the bytes by hand:

const branchHintSection = new Uint8Array([
  0x00,                              // custom section id
  /* len */ ...,
  ...encodeName("metadata.code.branch_hint"),
  /* hint entries follow */
  0x01,                              // 1 function with hints
  0x00,                              // function index 0
  0x01,                              // 1 hint
  /* instruction offset */ 0x05,
  0x01,                              // hint kind: likely (0=unlikely, 1=likely)
]);

// Append to a normal module - the engine consumes it,
// validation still passes, behaviour is identical.

see also