Repository navigation
[AUTOMATED] [PROPOSAL] Embedder hooks: add a rule to a default pool and run code at phase boundaries - #1699
Closed
coleleavitt wants to merge 2 commits into
Closed
[AUTOMATED] [PROPOSAL] Embedder hooks: add a rule to a default pool and run code at phase boundaries#1699coleleavitt wants to merge 2 commits into
coleleavitt wants to merge 2 commits into
Conversation
… at phase boundaries First slice of the hook registry. Code that links kuna-decomp can add one rule to the default action tree and run a callback when a phase finishes, without replacing the universal action. - infra/kuna_hooks.rs: HookRegistry on Architecture, read each time the universal tree is built. No option and no CLI surface. - Architecture::add_rule(after_group, RuleState, Box<dyn Rule>) inserts the rule behind the last rule of after_group, in the first pool that holds a rule of that group. - Architecture::on_phase(phase, callback) runs at one schedule point per phase: P2 after start; P3, P4, P5 after fullloop settles; P6 after copymarker; P7 after the final blockstructure; P8 before prototypewarnings. P1 and P9 have no point inside the action tree and are an error for now. - With an empty registry the schedule gains no rule row and no leaf: the listing snapshot is unchanged and decompile-all output is byte-identical. lift_override and the P1/P9 callbacks follow in later slices. Refs Noelo-Lab#1641
sjkim1127
added a commit
to sjkim1127/kuna
that referenced
this pull request
Nov 19, 2026
[AUTOMATED] Adds how Noelo-Lab#1534's symbolic p-code emulator, the Noelo-Lab#1641/Noelo-Lab#1699 phase hooks, the Noelo-Lab#317 ghidra-sim harness, the per-PR compile-and-compare oracles and DecBench byte_match relate to this proposal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
coleleavitt
force-pushed
the
fix/hook-registry
branch
from
November 21, 2026 18:18
cfec216 to
cf7fdd9
Compare
[AUTOMATED] Keep the P6 hook boundary and the typevote action (both sides of the typerecovery insertion).
mahaloz
added a commit
to sjkim1127/kuna
that referenced
this pull request
Nov 22, 2026
…hase-hooks status P9 and P6 carry 27 and 13 fix(pN) commits since 2026-06-01, not 24 and 12, and the other single-phase tags total 17. Draft Noelo-Lab#1699 was closed unmerged; phase hooks are tracked by the open issue Noelo-Lab#1641. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
mahaloz
added a commit
to sjkim1127/kuna
that referenced
this pull request
Nov 23, 2026
Resolve the add/add conflicts in docs/features/diffverify/{analysis.md,proposal.md,
record.json} (the design record merged as Noelo-Lab#1714): keep this branch's newer C1-C4 status
and results text, and re-apply main's corrections from 4dc3f68 (the P9/P6 fix-tag
counts, and phase hooks tracked by the open issue Noelo-Lab#1641 since draft Noelo-Lab#1699 closed
unmerged). record.json's status line now names the C3 and decbench work the branch
holds.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
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.
[AUTOMATED]
Code that links
kuna-decompcan now add one rule to the default tree and run acallback when a phase finishes, without replacing the universal action. First
slice of #1641; draft for the design below.
cd decompiler && cargo test -p kuna-decomp --test integration hook_registry::decompiles
tests/fixtures/hook_registry.xml(x86-64, built from the.Snextto it) before and after those two calls:
This slice
infra/kuna_hooks.rs: aHookRegistryonArchitecture, read each time theuniversal tree is built. No option, no CLI surface.
Architecture::add_rule(after_group, RuleState, Box<dyn Rule>)puts the rulebehind the last rule of
after_group, in the first pool that holds thatgroup. An unknown group is an error.
Architecture::on_phase(phase, callback)runs at one schedule point perphase: P2 after
start; P3, P4, P5 together afterfullloopsettles (Band Bhas no boundary between them); P6 after
copymarker; P7 after the finalblockstructure; P8 beforeprototypewarnings. Each point is a leaf in itsneighbours' group, so reduced roots skip the phases they do not run.
snapshot test is unchanged, and
decompile-all /usr/bin/lsis byte-identicaland no slower (6.6-7.2 s against 6.9-7.9 s before, dev build).
before it are lost; group lists are kept.
Design: what follows
before the function exists, P9 is the printer), so they are driven from
decompile_drive.rs; registering for them is an error until then.lift_override(Address, FnMut(&mut PcodeEmit) -> bool): one instruction'sp-code replaced at lift time. It goes through
FlowEnvironmentinp2_lift/flow.rs; the passes that lift instructions on their own (calleecontracts, call-width proofs) need the same lookup, which is why it is its
own slice.
architecture's type factory), if the first users need it.
Phases touched: none change behaviour. The code is in
infra/and the spectext in
docs/spec/00-overview.md§0.6.Tests
tests/hook_registry.rs: the rule and the P5 rename both show in the printed Cand the P2/P6/P8 callbacks fire in schedule order; the hooks sit at the stated
positions in the action listing; bad registrations are errors; an empty registry
gives the same listing and the same C. The test rule folds
(x | y) + (x & y)rather than the issue's
x ^ x, which the default pool already folds.Refs #1641
Model:
anthropic/claude-fable-5-2