You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build: no incremental compilation for user projects — every phpc build re-lowers all files as one bundled TU and PHP_COMPILER_CACHE=0 is forced (bin/compile.php, lib/Web/SourceBundler.php, lib/JIT/CompileCache.php) #36199
SourceBundler::bundleForAot() (lib/Web/SourceBundler.php:25-75) string-concatenates the entry and every include into one source blob → one Script → one Block → one LLVM module. Changing one file of a 200-file app re-lowers 200 files.
CompileCache (lib/JIT/CompileCache.php:57-70) — a bitcode cache keyed on (realpath, mtime, sha256(source), fingerprint) — is wired only into Runtime::jit() (lib/Runtime.php:905-940), never into Runtime::standalone() (:956), and bin/compile.php:534 forces PHP_COMPILER_CACHE=0 for user AOT builds (the comment there documents a stale-cache bug rather than fixing the key).
Nothing in a user build runs in parallel; the only fan-out in the repo is the cold helper-corpus emitter (script/emit-helper-runtime-object.php:489-560).
Warm hello-world build on master 4eed6a2785 is 17 s (README claims ~6 s); MiniWebApp measured separately in the tracker.
The per-unit model that would fix this already exists for helpers (HelperRuntimeCache: fingerprinted unit.o + declarations-only unit.bc + manifest, bound via declareExternFromBitcode). The self-host split-TU work (#36147/#36155) is building the same cross-TU binding for the spine. User builds should be the third consumer of that one mechanism, not a separate design.
PHP implementation target
Cheap first step (M): make standalone() consult CompileCache keyed on sha256(bundled source) + HelperRuntimeCache::coreFingerprint() + helper-index digest + ABI version; restore the module and skip lowering when hit. Delete the PHP_COMPILER_CACHE=0 override once the key includes the helper index.
Per-file TUs (L): lower each include to its own module/object under build/user-object-cache/<sha>/{unit.o,unit.bc,manifest.json}; bind cross-file calls/classes via the split-TU manifest (PHP_COMPILER_EXTERNAL_METHOD_MANIFEST path in lib/AOT/ExternalMethodBind.php); emit unchanged files' objects from cache; emit changed ones in parallel worker processes (reuse the EMIT_JOBS scheduler); one link.
Drop the second new Runtime(MODE_AOT) (bin/compile.php:372 vs :382 — both run loadCoreModules()), and replace path-substring mode detection (phpc_compile_is_user_script_aot, :108-140: selfhost/, compile_driver.php…) with an explicit --mode=user|selfhost|chunk flag so a user project under a selfhost/ directory is not silently compiled with self-host stubs.
Category
Foundation:· build speed · child of #36188Problem
SourceBundler::bundleForAot()(lib/Web/SourceBundler.php:25-75) string-concatenates the entry and every include into one source blob → one Script → one Block → one LLVM module. Changing one file of a 200-file app re-lowers 200 files.CompileCache(lib/JIT/CompileCache.php:57-70) — a bitcode cache keyed on(realpath, mtime, sha256(source), fingerprint)— is wired only intoRuntime::jit()(lib/Runtime.php:905-940), never intoRuntime::standalone()(:956), andbin/compile.php:534forcesPHP_COMPILER_CACHE=0for user AOT builds (the comment there documents a stale-cache bug rather than fixing the key).script/emit-helper-runtime-object.php:489-560).4eed6a2785is 17 s (README claims ~6 s); MiniWebApp measured separately in the tracker.The per-unit model that would fix this already exists for helpers (
HelperRuntimeCache: fingerprintedunit.o+ declarations-onlyunit.bc+ manifest, bound viadeclareExternFromBitcode). The self-host split-TU work (#36147/#36155) is building the same cross-TU binding for the spine. User builds should be the third consumer of that one mechanism, not a separate design.PHP implementation target
standalone()consultCompileCachekeyed onsha256(bundled source) + HelperRuntimeCache::coreFingerprint() + helper-index digest + ABI version; restore the module and skip lowering when hit. Delete thePHP_COMPILER_CACHE=0override once the key includes the helper index.build/user-object-cache/<sha>/{unit.o,unit.bc,manifest.json}; bind cross-file calls/classes via the split-TU manifest (PHP_COMPILER_EXTERNAL_METHOD_MANIFESTpath in lib/AOT/ExternalMethodBind.php); emit unchanged files' objects from cache; emit changed ones in parallel worker processes (reuse theEMIT_JOBSscheduler); one link.__value__writeNull, Self-host P0: JIT external class method calls in bundled lib (PhpParser, etc.) #579).new Runtime(MODE_AOT)(bin/compile.php:372 vs :382 — both runloadCoreModules()), and replace path-substring mode detection (phpc_compile_is_user_script_aot, :108-140:selfhost/,compile_driver.php…) with an explicit--mode=user|selfhost|chunkflag so a user project under aselfhost/directory is not silently compiled with self-host stubs.Repro
Today both builds take the same time.
Done when
examples-web-smoke.shanddeploy-smoke.shgreen on the incremental binarytest/fixtures/aot/selfhost/app.phpbuilds as a user script (mode flag) and matches ZendPHP_COMPILER_BUILD_TIMING=jsonphase report (boot/parse/lower/opt/codegen/link ms) committed for hello-world and MiniWebApp