M3 emit TU: runtime spine skip-list + emit phase diagnostics (#2442) - #2506
Conversation
- Add isM3EmitTuRuntimeSpineLoweringName so emit-TU link does not stub Runtime::parse/compile/compileEmitSmoke via self-host skip lists. - Split BootstrapCompileSmokeM3Emit failures into parse vs compileEmitSmoke phases; refuse hollow runtimeSpine forward declarations at link time. - Fall back to patch-php-cfg-match.py when php-cfg-match.patch is corrupt. - Accept helloworld_compile_smoke log prefix in helloworld probe success grep. Native emit still returns null from Runtime::parse at runtime (forward-decl ordering vs compileM3EmitTuMainNative); probe remains zend partial until parse is real-lowered before bridge IR is emitted. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Harness repro confirms remaining blocker after link: BOOTSTRAP_M3_LINK_COMPILE_DRIVER=1 BOOTSTRAP_M3_COMPILE_DRIVER_REAL_LOWERING=1 \
PHP_COMPILER_EMIT_HELPER_LINK=1 ./script/bootstrap-m3-emit-tu-execute.sh
# runtime_compile_smoke_m3_emit: parseAndCompile returned null |
|
Partial overlap with merged #2526 (bridge ordering) and #2523 (emit-helper Runtime spine + operand-chain helpers). Remaining unique value here looks like |
Replace eager PHP CFG pre-lowering in compileM3EmitTuRuntimeSpineDecls with native LLVM stubs for Runtime parse/compileEmitSmoke/standalone/construct so emit-helper link avoids LLVM 9 segfaults on initParsePipeline and markObjectConstructed. Split parse+compileEmitSmoke in the emit bridge with phase diagnostics (continues #2506). Blocker: BootstrapCompileSmokeM3Emit::emitMainEntry still segfaults during IR build after spine registration — emit_path=native not green yet. Next: Batch A real lowering (#2516) for parse/standalone/init*. Co-authored-by: Cursor <cursoragent@cursor.com>
Harness verification (May 26)Progress: Identified LLVM 9 link crash root cause — eager Still red: ./script/docker-exec.sh -- bash -lc '
source script/php-env.sh && script/apply-patches.sh
BOOTSTRAP_M3_LINK_COMPILE_DRIVER=1 \
BOOTSTRAP_M3_COMPILE_DRIVER_REAL_LOWERING=1 \
BOOTSTRAP_M3_RUNTIME_COMPILE=1 \
./script/bootstrap-selfhost-helloworld-probe.sh
'
# emit helper link failed (segfault) — emit_path=zend partialNarrow repro: PHP_COMPILER_SELFHOST_AOT=1 PHP_COMPILER_M3_COMPILE_DRIVER=1 PHP_COMPILER_EMIT_HELPER_LINK=1 \
php bin/compile.php -o build/emit test/bootstrap-aot/runtime_m3_emit_native_entry.php
# exit 139 during JIT compile (after spine stubs register; crash in emitMainEntry IR)Next: #2516 Batch A — real |
Problem
M3 emit-TU helper translation units can link but do not reliably execute natively yet: running the resulting binary still hits
parse returned nulland the probe falls back toemit_path=zend partial(tracked as the primary gate in #2442).This issue documents the concrete emitter skip-list + diagnostics work needed on the emit-TU path, with clear file paths and repro commands.
Gates / repro
Minimal repro (harness-safe Docker):
Expected:
emit_path=native.Actual (today):
emit_path=zend partialand/orparse returned nullunless the runtime spine is bound to real-lowered symbols.Scope (files / symbols)
lib/JIT.phpcompileM3EmitTuMainNative()(bridge ordering dependency tracked by Self-host M3: defer emit-bridge IR until after spine pre-lower in compileM3EmitTuMainNative #2512)isM3EmitTuRuntimeSpineLoweringName()PHP_COMPILER_M3_EMIT_LOG_PREFIX, etc.)test/bootstrap-aot/runtime_m3_emit_native_entry.phptest/bootstrap-aot/compile_smoke_m3_emit_native_entry.phptest/bootstrap-aot/helloworld_m3_emit_native_entry.php./script/bootstrap-selfhost-helloworld-probe.shmake bootstrap-selfhost-runtime-compile-smokebin/compile.php(M3 env dispatch)Done when
*: compile OKsmoke line and exit 0./script/bootstrap-selfhost-helloworld-probe.shreportsemit_path=native(strict off)BOOTSTRAP_M3_HELLOWORLD_STRICT=1passes once Self-host M3: native emit-TU binaries run without startup crash #2442 is greenDependencies
Made with Cursor