AOT: localize cached-unit declaration types + call-site-lazy sprintf link; workflow skills (#15642, #15889)#16965
Merged
Merged
Conversation
…link; document workflows in skills (#15642, #15889). Cache-machinery fixes (each independently load-bearing): - HelperRuntimeCache::tryProvide rebuilds extern declaration types against the LOCAL context's named structs. LLVM re-suffixes named structs on bitcode parse (__string__ -> __string__.12) and suffixed declaration types fail module verify at every call site — a latent correctness bug for ANY consumer whose module defines the structs before binding (getStringFromType cannot stringify suffixed structs, so the fallback read struct names via LLVMGetStructName). - StringFormat gains implementIfDeclared(): user-standalone builds skip ensureLinked at init (#13571), so printf()/sprintf()/ number_format() died at link with undefined __compiler_sprintf (#15642). JitSprintf::format now links on first call-site lowering (builder insert-point saved/restored), and ensureJitHelperCompiled consults the helper cache first — with PHP_COMPILER_HELPER_RUNTIME_O=1 the corpus binds as externs instead of a nested compile that OOMs a default-memory build. Remaining gap: cached units lack their init chains, so the sprintf unit crashes at runtime in user builds until per-unit llvm.global_ctors lands (epic #16075 step 4/5) — the link error is fixed, the runtime story is documented on #15642. - PackArgvSerialize memcpy calls adapt to WHATEVER signature the module already declares (main-script i8* vs runtime void* ordering flip). Spine sync to 4181/4182 (3 new fleet DOM files) + sidecar refresh (stamp d8ba2365). M5 fast green, AOT smoke green cache-on and -off, full unit sweep 119 fresh / 0 failed. Skills: phpc-verify gains the LLVM-assert debugging recipe, battery babysitter, and gate-order notes; phpc-fix-loop gains merge-race protocol, worktree-docker and vendor-patch guidance; phpc-selfhost gains spine-sync flags, dedup check, and the deferral workflow; new phpc-helper-cache skill documents the split-compilation cache end-to-end; phpc-setup documents the committed cold-start caches. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 6, 2026
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.
Cache-machinery fixes
tryProvide— LLVM re-suffixes named structs on bitcode parse (__string__.12); extern declarations bound with suffixed types fail module verify at every call site. Declaration types are now rebuilt against the local context's named structs (viaLLVMGetStructName;getStringFromTypereturnsunknownfor suffixed structs). Latent correctness bug for any cache consumer.StringFormat::ensureLinkedat init, soprintf/sprintf/number_formatdied at link with undefined__compiler_sprintf. Now links on first call-site lowering (insert-point save/restore), consulting the helper cache first (externs + unit.o instead of a nested corpus compile that OOMs default-memory builds). The link error is fixed; the cached unit still crashes at runtime in user builds because units lack init chains — that's epic Epic: architecture rearrangement — TU-based pipeline, differential gates, generated maintenance (docs/architecture-review-2026-07.md) #16075 step 4/5, documented on Regression: user-script AOT builds broken for core string builtins — preg_match capture assign, explode CRLF, str_contains, substr negative length (bin/compile.php) #15642.Hygiene
Spine sync 4181/4182 (3 new fleet DOM files) + honest sidecar refresh (
d8ba2365). M5 fast green, AOT smoke green cache-on/off, unit sweep 119 fresh / 0 failed.Skills (workflow documentation)
PHP_COMPILER_LLVM_ASSERT=1debugging recipe (segfault → PHP backtrace), gdb fallback, bundle-failure breadcrumbs, battery babysitter, gate-order note, the->valuevsloadValue()bug shape..gitmount, vendor-patch shipping rules.🤖 Generated with Claude Code