feat: added Ir.Inst.Ref, global constant pool, lazy lowering in Sema
This commit is contained in:
parent
ce5385ebac
commit
e5e2b7c559
6 changed files with 615 additions and 534 deletions
|
|
@ -15,8 +15,10 @@ fn dumpSimpleInst(d: Dumper, offset: usize, op: Opcode) !usize {
|
|||
fn dumpByteInst(d: Dumper, context: *const Object.ContentPath, offset: usize, op: Opcode) !usize {
|
||||
const arg = context.bytes[offset + 1];
|
||||
if (op == .load_const) {
|
||||
const constant_index = context.const_pool[arg];
|
||||
const global_constant = d.story.constants_pool.items[constant_index];
|
||||
try d.writer.print("{s} {d} (", .{ @tagName(op), arg });
|
||||
try d.dumpObject(context.const_pool[arg]);
|
||||
try d.dumpObject(global_constant);
|
||||
try d.writer.print(")\n", .{});
|
||||
} else {
|
||||
try d.writer.print("{s} {x}\n", .{ @tagName(op), arg });
|
||||
|
|
@ -31,7 +33,9 @@ fn dumpGlobalInst(
|
|||
op: Opcode,
|
||||
) !usize {
|
||||
const arg = context.bytes[offset + 1];
|
||||
const global_name: *Object.String = @ptrCast(context.const_pool[arg]);
|
||||
const constant_index = context.const_pool[arg];
|
||||
const global_constant = d.story.constants_pool.items[constant_index];
|
||||
const global_name: *Object.String = @ptrCast(global_constant);
|
||||
const name_bytes = global_name.bytes[0..global_name.length];
|
||||
|
||||
try d.writer.print("{s} {x} '{s}'\n", .{ @tagName(op), arg, name_bytes });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue