Skip to content

Self-host M3/M5: native emit Runtime::__construct init for inventory-scale CFG (emit-TU) #2827

Description

@PurHur

Milestone

M3 (native emit) / M5 (full Compiler CFG) — parent #1492 / #1402

Problem

M3 strict smoke gates (compile-smoke, runtime-compile-smoke, compiler-unit-probe) report emit_path=native ✅, but inventory-scale native emit through helloworld_m3_emit_native_entry.php / BootstrapCompileSmokeM3Emit still documents emit-TU runtime init blockers for full lib/Compiler.php + driver paths (#1768, #1937).

Harness 2026-05-27 (after patch gate #2826 class fix): re-verify whether bin/compile.php still segfaults at sidecar link or fails only on Expr_MagicScriptConst vendor gap.

Scope

Path Work
lib/Runtime.php __construct → loadJit / standalone init on emit-TU
lib/JIT.php registerM3EmitTuSidecarFromPath, emit-helper link env
lib/JIT/BootstrapCompileSmokeM3Emit.php Native bridge when sidecar missing
test/selfhost/compiler_helloworld_smoke/helloworld_m3_emit_native_entry.php M3 emit TU entry
lib/Web/LiteralIncludeDiscovery.php, lib/Web/SourceBundler.php Hot paths in bin/compile.php vs minimal smoke

Repro

# After #2826 green — M5 driver (today may be LogicException or segfault):
./script/docker-exec.sh -- bash -lc '
  export PHP_COMPILER_M3_SOURCE=/compiler/bin/compile.php
  ./script/bootstrap-selfhost-helloworld-compile-bin.sh
'

# Sidecar link (emit-helper):
./script/docker-exec.sh -- bash -lc '
  source script/php-env.sh
  export PHP_COMPILER_SELFHOST_AOT=1
  php bin/compile.php -o /tmp/out bin/compile.php; echo exit:$?
'
# Missing build/.m3_bin_compile_aot_blob after helloworld-compile-bin (#2697)

# Strict unit vs full CFG contrast:
./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-compiler-unit-probe-strict'
./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-compile-smoke-strict'

Done when

Labels

self-host, bootstrap, IMPORTANT

Links

#1492 · #2697 · #1937 · #1768 · #1402

Activity

  1. added 2 commits that reference this issue on May 27, 2026
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