Remove all @import("zig_internals") from stage0/ so that test_obj
compilation is independent of the Zig compiler (~6min). The sema
comparison now uses text-based dumpers:
- Zig side (src/verbose_air.zig): compiles source through the full Zig
pipeline, captures verbose_air output, exports zig_dump_air() as a C
function. Compiled as a separate dumper_obj that is cached
independently.
- C side (stage0/verbose_air.c): formats C Air structs to text in the
same format as Zig's Air/print.zig.
Changing stage0 code no longer triggers Zig compiler recompilation:
C compile + cached test_obj + cached dumper + link = seconds.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
24 lines
688 B
Zig
24 lines
688 B
Zig
// verbose_intern_pool.zig — Zig-side dumper for InternPool text output.
|
|
// Compiles source via the Zig compiler pipeline and dumps the InternPool.
|
|
// Exports a C-compatible function for use by stage0 tests.
|
|
|
|
const std = @import("std");
|
|
|
|
const DumpResult = extern struct {
|
|
text: ?[*:0]u8,
|
|
error_msg: ?[*:0]u8,
|
|
};
|
|
|
|
export fn zig_dump_intern_pool(
|
|
source_ptr: [*]const u8,
|
|
source_len: usize,
|
|
) DumpResult {
|
|
// Stub: not yet implemented.
|
|
_ = source_ptr;
|
|
_ = source_len;
|
|
const gpa = std.heap.c_allocator;
|
|
const result = gpa.dupeZ(u8, "") catch
|
|
return .{ .text = null, .error_msg = null };
|
|
return .{ .text = result.ptr, .error_msg = null };
|
|
}
|