Files
zig/stage0/dump.h
Motiejus Jakštys e275e9bb76 Replace copy-based Air export with zero-copy in-place comparison
Pass C-side SemaFuncAir arrays into zig_compare_air so the callback
can compare Air tags/datas/extra directly against the Zig compiler's
in-memory arrays, eliminating 4 heap allocations + 3 memcpys per
function.

Fix the early-return guard in PerThread.zig to also check
verbose_air_callback, so the callback fires even when
enable_debug_extensions is false (ReleaseFast).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:57:58 +00:00

26 lines
846 B
C

// dump.h — Shared result types for raw Air C/Zig comparison.
#ifndef _ZIG0_DUMP_H__
#define _ZIG0_DUMP_H__
#include <stddef.h>
#include <stdint.h>
typedef struct {
uint32_t matched_count;
char* error_msg; // NULL on success, caller frees
} AirCompareResult;
// c_funcs: pointer to SemaFuncAir array (from sema.h). Passed as void* to avoid header dep.
extern AirCompareResult zig_compare_air(const char* src_path, const void* c_funcs, uint32_t c_func_count);
extern void zig_compare_result_free(AirCompareResult* result);
// InternPool dumper (text-based, separate concern).
typedef struct {
char* text; // Heap-allocated, NULL on error. Caller frees.
char* error_msg; // Heap-allocated, NULL on success. Caller frees.
} DumpResult;
extern DumpResult zig_dump_intern_pool(const char* source, size_t len);
#endif