This commit is contained in:
agra
2026-02-26 14:46:21 +02:00
parent dd14f1206b
commit 2552882ce6
14 changed files with 6433 additions and 159 deletions

View File

@@ -65,10 +65,10 @@ pub fn printFunction(func: *const Function, func_idx: u32, module: *const Module
try writer.writeAll(" {\n");
// Blocks
var ref_counter: u32 = 0;
// Blocks — each block tracks its own first_ref from emission order
_ = func_idx;
for (func.blocks.items, 0..) |*block, bi| {
var ref_counter: u32 = block.first_ref;
try printBlock(block, @intCast(bi), tt, &ref_counter, writer);
}
@@ -371,6 +371,10 @@ fn printInst(instruction: *const Inst, ref_idx: u32, tt: *const TypeTable, write
.box_any => |ba| try writer.print("box_any %{d} : ", .{ba.operand.index()}),
.unbox_any => |u| try writer.print("unbox_any %{d} : ", .{u.operand.index()}),
// ── Reflection ──────────────────────────────────────────
.field_name_get => |fr| try writer.print("field_name_get T{d}[%{d}] : ", .{ fr.struct_type.index(), fr.index.index() }),
.field_value_get => |fr| try writer.print("field_value_get %{d}, T{d}[%{d}] : ", .{ fr.base.index(), fr.struct_type.index(), fr.index.index() }),
// ── Terminators ─────────────────────────────────────────
.br => |b| {
try writer.print("br bb{d}", .{b.target.index()});