From 5cb16912654bded44d45ffbd8333e91c445df05b Mon Sep 17 00:00:00 2001 From: agra Date: Wed, 3 Jun 2026 14:03:44 +0300 Subject: [PATCH] docs(debugger): correct trace-frame op name and sx_trace_push attribution (A9.2) Name the niladic op `.trace_frame` (no `.trace_frame_push` op exists) in the trace-path roadmap, matching the rest of the doc and src/ir/inst.zig. Describe the `.trace_frame` arm as building/interning the Frame global and yielding its address as the op's value; the separate sx_trace_push call is emitted by the lowerer via normal call lowering, not by the arm itself. --- docs/debugger.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/debugger.md b/docs/debugger.md index fd3b56b..08e5540 100644 --- a/docs/debugger.md +++ b/docs/debugger.md @@ -109,8 +109,9 @@ each backend derives the frame from its own context: current function → `{file, line, col, func}` (reusing the source map wired in for DWARF), **interns and builds the `Frame` global** in [`src/backend/llvm/reflection.zig`](../src/backend/llvm/reflection.zig) - (the same mechanism, in the same file, as the tag-name table), then emits - `call sx_trace_push(ptr)`. + (the same mechanism, in the same file, as the tag-name table), and yields + its address as the op's value. The lowerer feeds that value to a separate + `sx_trace_push` call emitted through the normal call lowering. - **`interp`:** pushes the packed `(func_id, ir_offset)` from its own execution context. @@ -276,13 +277,15 @@ traces and DWARF can never disagree: 1. `lower.zig` reaches a failure site — `lowerRaise`, `lowerTry`'s propagation branch, `lowerFailableOr`, or `lowerDestructureDecl` — and - (when `tracesEnabled()`) emits the niladic `.trace_frame_push` op, - replacing today's `emitTracePush(placeholderTraceFrame())`. Absorbing - sites emit `emitTraceClear()` → `call sx_trace_clear()`. -2. **Compiled backend** (`emit_llvm.emitInst`, `.trace_frame_push` arm): + (when `tracesEnabled()`) emits the niladic `.trace_frame` op via + `placeholderTraceFrame()`, whose result feeds a separate `sx_trace_push` + call via `emitTracePush()`. Absorbing sites emit `emitTraceClear()` → + `call sx_trace_clear()`. +2. **Compiled backend** (`emit_llvm.emitInst`, `.trace_frame` arm): resolve the op's `span` + current function → `{file,line,col,func}`, intern into the `Frame` table (built alongside `tag_name_array`), and - emit `call sx_trace_push(ptr_to_Frame)`. The `sx_trace_push` extern is + yield the `Frame` global's address as the op's value, which the separate + `sx_trace_push` call (step 1) consumes. The `sx_trace_push` extern is declared lazily by `getTraceFids()` (which sets `needs_trace_runtime`). 3. **Interpreter** (`interp.zig`, same op): pack `(current_func_id, ir_offset)` into a `u64` and call the foreign `sx_trace_push` (resolved