Skip to content

Self-host M5: cli_driver m3 sidecar LLVM verify — try_catch_dispatch cross-function basic block #3023

@PurHur

Description

@PurHur

Category

bootstrap

Milestone

M5 (honest CLI / bin/compile.php native emit) — parent #1492. Related #2880, #2900, #2114 (try/catch JIT phase 2).

Problem

Bootstrap probes that host-compile src/cli_driver.php for the m3 emit TU log a non-fatal sidecar failure:

m3-emit-tu sidecar host-compile failed: exit=255 source=…/src/cli_driver.php
RuntimeException: Module verification failed due to Referring to a basic block in another function!
  br label %try_catch_dispatch

Stack: JIT\TryCatchHelper::buildDispatch()JIT\Context::compileCommonRuntime::standalonecli_driver.php run().

Inventory argv / gen-3 paths may still pass, but BOOTSTRAP_M5_DRIVER_HOST_FULL_CLI=1 and honest single-TU bin/compile.php sidecars remain blocked.

php-src reference

N/A (LLVM IR invariant). Analogous to LLVM rule: terminators may only target basic blocks in the same function.

Repro

docker info >/dev/null
./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-driver-smoke 2>&1 | grep -A3 try_catch_dispatch'

Full gate:

BOOTSTRAP_M5_DRIVER_HOST_FULL_CLI=1 ./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-driver-host-compile'

Today: exit 255 + Referring to a basic block in another function. Done when: sidecar host-compile succeeds, verify clean.

Scope

Path Work
lib/JIT/TryCatchHelper.php buildDispatch()try_catch_dispatch BB must be function-local or shared via llvm::BasicBlock in common helper with correct parent Function*
lib/JIT/Context.php Run module verify before compileToFile (~line 570) in dev builds
src/cli_driver.php Minimal repro TU containing try/catch on CLI path

Not: VM-only try/catch without fixing JIT; internal_* PHP shims.

Done when

  • m3-emit-tu sidecar host-compile for cli_driver.php succeeds (LLVM module verify clean)
  • BOOTSTRAP_M5_DRIVER_HOST_FULL_CLI=1 make bootstrap-selfhost-driver-host-compile exits 0
  • php script/bootstrap-inventory.php --check still green after fix
  • No regression in test/unit/TryCatch* / compliance try/catch PHPTs

Verification

./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-driver-smoke bootstrap-selfhost-link'

Related

Labels

bootstrap, implementation-ready, MOST IMPORTANT, phase-0:Foundation

Metadata

Metadata

Assignees

No one assigned

    Labels

    MOST IMPORTANTThis are the most important targetsarea:compilerCompiler / CFG / JITimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevEx

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions