Skip to content

Self-host M3: emit-TU parseAndCompile returns null (runtime_m3_emit_native_entry) #2508

Description

@PurHur

Problem

M3 emit-helper translation units link, but native execute fails before AOT emit completes. Harness repro (May 2026):

script/apply-patches.sh
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

Observed:

runtime_compile_smoke_m3_emit: parseAndCompile returned null (CFG/compile spine)
runtime_compile_smoke_m3_emit: native emit failed at phase=parseAndCompile

HelloWorld probe still reports emit_path=zend partial with NEXT_LOWER: M3 emit TU runtime init.

Parent tracker #2442 covers emit-TU startup crash / execute; this issue owns the parseAndCompile null failure mode on the smallest emit entry first.

Goal

runtime_m3_emit_native_entry.php (then compile_smoke_m3_emit_native_entry.php, helloworld_m3_emit_native_entry.php) completes native emit:

runtime_compile_smoke_m3_emit: compile OK
emit_path=native

Strict gates (#1937, #1968) can follow once all three entries pass.

Implementation hints

Piece Path Notes
Smallest TU test/bootstrap-aot/runtime_m3_emit_native_entry.php Bisect here first
Driver test/bootstrap-aot/runtime_compile_smoke_m3_emit.php Calls Runtime::parseAndCompile
JIT allowlist lib/JIT.php m3CompileDriverSpineDenyNames(), isM3CompileDriverRealLoweringName()
Runtime lib/Runtime.php Parser → CFG → Compiler path
Batch tracker #1768 Symbol allowlist growth (parallel)
Execute umbrella #2442 Link both ways; close together when probes green

Suggested bisect order

  1. runtime_m3_emit_native_entry.php — parseAndCompile null
  2. compile_smoke_m3_emit_native_entry.php
  3. helloworld_m3_emit_native_entry.php
  4. make bootstrap-selfhost-helloworld → emit_path=native

Gates

Gate Command
Emit-TU execute BOOTSTRAP_M3_LINK_COMPILE_DRIVER=1 BOOTSTRAP_M3_COMPILE_DRIVER_REAL_LOWERING=1 ./script/bootstrap-m3-emit-tu-execute.sh
HelloWorld partial make bootstrap-selfhost-helloworld
M3 strict BOOTSTRAP_M3_HELLOWORLD_STRICT=1 make bootstrap-selfhost-helloworld
M4 full loop make bootstrap-loop-probe (blocked until M3 strict)

Done when

Repro (Docker)

./script/docker-exec.sh -- bash -lc '
  script/apply-patches.sh
  source script/php-env.sh
  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
'

Links

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions