Repository navigation
[AUTOMATED] feat(p5): structsynth nests a record pointer loaded from a field - #705
Merged
Merged
Conversation
mahaloz
force-pushed
the
feat/structnest
branch
from
September 21, 2026 18:25
3ad74a0 to
2599d88
Compare
…a field New structsynth value nest (opt-in): the loads of a pointer field of an accepted record are measured as one record under the parameter rules, and the field becomes a pointer to it, or to its own record when the loaded record reads nothing the holder does not hold. Self-pointing records are minted around their shell and a load through the self pointer resolves to the completed record. structscore now counts a pointer to a later or enclosing struct as a pointee. param stays the default: see docs/features/structnest/default-on-evaluation.md. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
…s baseline on ce008ce Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
mahaloz
force-pushed
the
feat/structnest
branch
from
September 21, 2026 20:30
2599d88 to
e247a06
Compare
mahaloz
added a commit
that referenced
this pull request
Sep 21, 2026
) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
structsynthgives a pointer parameter a record, but a pointer field of that record stays a scalar, so every read through the loaded field is raw offset arithmetic again.The fix
structsynthvaluenest. The loads of one pointer field are measured as one record under the rules a parameter already follows (already a pointer, no phi, index or integer use, two offsets including 0). The field then becomesstruct_0 *field_0x0over{long; int; int}, and the body reads(long)v1->field_0x8 + v1->field_0x0 + (long)v1->field_0xc.struct_19 { struct_19 *field_0x0; struct_19 *field_0x8; long field_0x10; unsigned char field_0x18; ... }. That struct is minted around its incomplete shell, and a load through the self pointer takes the completed type, so three links down still readsv3->field_0x18and not*(uint1 *)&v3[3].scripts/decbench/structscoreignored a pointer to a struct defined later in the header (or to its own struct) when counting nested fields. That is fixed too.paramstays the default. Withnest, a structure whose field points at another synthesized structure or at itself cannot be rebuilt in another process, so--jobsnames every structure-bearing function in one worker (26.0 s against 15.9 s fordecompile-all --jobs 8on tar O2, with the same output).docs/features/structnest/default-on-evaluation.mdhas the numbers and the protocol change that would lift this.Tests
tests/stages/structsynth-nest.xml: pass 1 (param) pins the raw reads; pass 2 (nest) pins the nested record and the self-pointing tree node. There are also unit tests for the evidence merge, self minting, shell resolution and shard portability.nestwithparamon one build: the 444-slice typesweep stays at 1,353 perfect, with 0 functions better and 0 worse. Over 15 binaries (three of them ARM32), 93 of 7,819 functions change: 86 only instruct_Nnumbering, 7 with reads respelled through the nested record, and no control flow or arity moves. Serialdecompile-allis 1.7% to 5.0% faster (min-of-15; fmt, ls, sort and bash at O2). All 487 exported structs compile with exactoffsetof.🤖 Generated with Claude Code
https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL