Skip to content

Self-host M0/M2: lib/JIT.php Expr_ArrowFunction fatal blocks bootstrap-selfhost-link #2573

Closed

Description

@PurHur

Milestone

M0/M2 — blocks compiler_minimal native link and M2 spine smoke until fixed (#1492)

Problem

make bootstrap-selfhost-link fails at Zend parse (before LLVM) with:

PHP Fatal error: Uncaught RuntimeException: Unknown Expr Type Expr_ArrowFunction
  in vendor/ircmaxell/php-cfg/lib/PHPCfg/Parser.php:940
bootstrap-selfhost-link: compile failed (progress gate; see stderr above)

Root cause: lib/JIT.php uses PHP 7.4+ arrow functions in array_map callbacks on the compiler_minimal spine path:

  • lib/JIT.php:3664 — static fn (string $n): string => ltrim($n, '\\')
  • lib/JIT.php:4413 — same pattern

PHPCfg\Parser (vendor php-cfg) does not implement Expr_ArrowFunction. Full language lowering is tracked in #142; this issue is the bootstrap unblock on the compile path.

Scope

Path Work
lib/JIT.php Replace the two static fn callbacks with static function (string $n): string { return ltrim($n, '\\'); } (or equivalent closure)
test/selfhost/compiler_minimal/main.php No change expected (already require_onces lib/JIT.php)
test/selfhost/compiler_lib_spine_smoke/main.php Unblocked once JIT.php parses

Out of scope: VM/JIT lowering for arrow functions (#142). Optional follow-up: php-cfg parse-only patch (#2574).

Repro (harness-safe)

./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-link'
# exit 1 — Expr_ArrowFunction fatal

./script/docker-exec.sh -- bash -lc 'BOOTSTRAP_LIB_SPINE_SMOKE=1 make bootstrap-selfhost-lib-spine-smoke'
# same fatal at compile step

./script/docker-exec.sh -- bash -lc './script/bootstrap-loop-probe.sh --dry-run'
# exit 1 at M2 lib spine smoke (same stack trace)

Done when

  • make bootstrap-selfhost-link prints compiler_minimal bundle OK
  • BOOTSTRAP_LIB_SPINE_SMOKE=1 make bootstrap-selfhost-lib-spine-smoke reaches native link (may still hit downstream M3/M4 blockers)
  • ./script/bootstrap-loop-probe.sh --dry-run passes M2 spine step (M3 partial may still be 🚧)

Labels

Suggest: self-host, bootstrap, IMPORTANT (blocks entire M2–M4 ladder until green)

Links

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