diff options
| author | _ov4 <ov4@ov4.org> | 2026-07-26 12:15:33 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-07-26 12:15:33 +0000 |
| commit | 1749b2b4a3e55db7c9bed95376f99b7f07932b49 (patch) | |
| tree | fca50620a4e6b46609f18abaf205416ea245dce8 /AGENTS | |
| parent | b9b7f048b0874df0f034f6b1e15e1a4ee2131475 (diff) | |
refactor: drop per-type micro handlers and the parallel NamedValues map
Integer/Real/Boolean/CharHandler carried only five one-line LLVM API
wrappers (now inlined at their call sites in CodeGen.cc) plus dead
emitDeclare methods that violated the documented two-table lock-step
invariant. StringHandler::emitDeclare (also dead) and its NamedValues
reference go too.
With the dead writers gone, NamedValues held no information not already
in Symbols[].Storage, so the parallel map is removed: getNamedValue
reads Symbols, ArrayHandler/FunctionGen take one table, and function
bodies save/restore a single map. Behavior unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'AGENTS')
| -rw-r--r-- | AGENTS/CONVENTIONS.md | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/AGENTS/CONVENTIONS.md b/AGENTS/CONVENTIONS.md index cd1adfc..6d6bb81 100644 --- a/AGENTS/CONVENTIONS.md +++ b/AGENTS/CONVENTIONS.md @@ -40,14 +40,12 @@ operations (including `&` concatenation, `StringHandler::emitConcat`) live in and INPUT STRING buffers — declared in `SetupExternalFunctions`, never fetched with a bare `getFunction("malloc")`. -**One flat symbol namespace.** Two parallel maps in CodeGen — `NamedValues` -(name → storage `Value*`) and `Symbols` (name → `SymbolInfo{Storage, TypeName, -IsArray}`) — must always be updated in lock-step: via `registerSymbol()`, or directly -but both together as `FunctionGen::createArgumentAllocas` does for parameters. (The -per-type handlers' `emitDeclare` methods set `NamedValues` alone — that is dead code; -don't imitate it.) There is no scope stack. `FunctionGen` saves/clears/restores both -maps around a function body, but `ArrayHandler::ArrayTable` is *not* scoped (see -`PITFALLS.md`). +**One flat symbol namespace, one table.** `Symbols` (name → `SymbolInfo{Storage, +TypeName, IsArray}`) in CodeGen is the only symbol table; register through +`registerSymbol()` (or directly, as `FunctionGen::createArgumentAllocas` does for +parameters) and read storage through `getNamedValue()`/`getSymbolInfo()`. There is no +scope stack. `FunctionGen` saves/clears/restores the table around a function body, but +`ArrayHandler::ArrayTable` is *not* scoped (see `PITFALLS.md`). **Dispatch is by `dynamic_cast` chain, not virtual methods.** `CodeGen::emitStmt` and `emitExpr` walk a linear if-chain of casts. **A statement type missing from the chain is |
