Add the trace buffer that raise/try push to and catch/or/destructure clear, following the JNI-TLS precedent exactly (a thread_local IR global doesn't work under the ORC JIT, which doesn't init TLS for AddObjectFile'd objects). - library/vendors/sx_trace_runtime/sx_trace.c: a `_Thread_local` fixed-cap ring (32 frames) of opaque u64s + C API (push / clear / len / truncated / frame_at). Overflow keeps the newest CAP frames and latches `truncated` (Zig-style); frame_at returns oldest-to-newest. The frame is opaque — the E3.3 formatter dispatches on context (PC at runtime, packed (func_id, offset) at comptime). - build.zig: link the .c into the compiler so the JIT resolves sx_trace_* via dlsym (and so the unit test links against it). - src/runtime_trace.test.zig: exercises push / overflow-survives-newest / clear / len / truncated / ordering against the linked C — grounds the buffer logic without shipping throwaway sx builtins. - lower.zig getTraceFids(): lazily declares the sx_trace_push/clear externs + sets needs_trace_runtime. Declared now; the raise/try push sites and the absorbing clear sites get wired at E3.2. - core.zig: auto-injects the .c as a #source for AOT when needs_trace_runtime, mirroring the JNI env runtime. Gates: zig build, zig build test (incl. the new buffer tests), bash tests/run_examples.sh (277 passed; no codegen change this step — lone failure is the user's uncommitted 213-canonical-map pack WIP).
40 lines
1.6 KiB
Zig
40 lines
1.6 KiB
Zig
pub const llvm_api = @import("llvm_api.zig");
|
|
pub const token = @import("token.zig");
|
|
pub const lexer = @import("lexer.zig");
|
|
pub const ast = @import("ast.zig");
|
|
pub const parser = @import("parser.zig");
|
|
pub const print = @import("print.zig");
|
|
pub const types = @import("types.zig");
|
|
pub const target = @import("target.zig");
|
|
pub const builtins = @import("builtins.zig");
|
|
pub const errors = @import("errors.zig");
|
|
pub const errors_tests = @import("errors.test.zig");
|
|
pub const trace_runtime_tests = @import("runtime_trace.test.zig");
|
|
pub const sema = @import("sema.zig");
|
|
pub const imports = @import("imports.zig");
|
|
pub const core = @import("core.zig");
|
|
pub const c_import = @import("c_import.zig");
|
|
pub const ir = @import("ir/ir.zig");
|
|
|
|
pub const lsp = struct {
|
|
pub const server = @import("lsp/server.zig");
|
|
pub const transport = @import("lsp/transport.zig");
|
|
pub const types = @import("lsp/types.zig");
|
|
pub const document = @import("lsp/document.zig");
|
|
};
|
|
|
|
test {
|
|
// Discover every test in the module graph so `zig build test` actually
|
|
// runs them. Without this, the test binary finds no `test` blocks at the
|
|
// root and trivially "passes" while exercising nothing. Nested barrels
|
|
// (e.g. ir/ir.zig) carry their own `test { refAllDecls }`, so this chains
|
|
// into them.
|
|
@import("std").testing.refAllDecls(@This());
|
|
// refAllDecls only reaches the top-level decls; the `lsp` files live one
|
|
// struct deeper, so reference them directly to pull in their tests.
|
|
_ = lsp.server;
|
|
_ = lsp.document;
|
|
_ = lsp.types;
|
|
_ = lsp.transport;
|
|
}
|