Skip to content

Commit 1ef992f

Browse files
committed
goobj: say what the wasm listing and its blocks carry in their comments
1 parent 5ab93e2 commit 1ef992f

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎internal/goobj/wasm.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import (
1010
"loov.dev/lensm/internal/source"
1111
)
1212

13-
// disassembleWasm renders a wasm function with its block nesting.
13+
// disassembleWasm renders a wasm function with its block nesting, its
14+
// branches as jumps, and for a core module the statements it spells.
1415
// Loading, names, calls and source positions come from objfile.
1516
func disassembleWasm(file *File, fn *Func, opts disasm.Options) (*disasm.Code, error) {
1617
bin := file.bin

‎internal/goobj/wasmstmt.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func wasmStatements(info *wasmInfo, idx int, insts []disasm.Inst, goArgs map[int
132132
return fmt.Sprint("g", i)
133133
}
134134

135-
// Name the blocks that branches go to, in order.
135+
// block is an open block, loop or if.
136136
type block struct {
137137
label string
138138
// cases is set for a block that a switch's case goes to: its end
@@ -149,6 +149,7 @@ func wasmStatements(info *wasmInfo, idx int, insts []disasm.Inst, goArgs map[int
149149
height int // the stack's height when the block started
150150
result int // the values the block leaves
151151
}
152+
// The blocks that branches go to get labels, in order.
152153
targeted := wasmTargets(body)
153154
cases, switches, selectors := wasmSwitches(m, body, insts)
154155
labels := 0

0 commit comments

Comments
 (0)