Skip to content

Self-host M3: real-lower ConstStringFolder helpers for M3 compile driver - #2837

Merged
PurHur merged 1 commit into
masterfrom
agent/selfhost-conststringfolder-helpers
May 27, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/selfhost-conststringfolder-helpers

Conversation

@PurHur

@PurHur PurHur commented May 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Extend M3 compile-driver real lowering to ConstStringFolder private helpers (literalStringValue, magicScriptConstValue, sourceDir, CFG walkers, foldDeployPathConcat) so fold() / foldConcat() callees are not stubbed no-ops during native link.
  • Register those methods on the emit-TU PHP CFG allowlist (with existing public entry points).
  • Unit tests assert web-bootstrap stubs stay off when PHP_COMPILER_M3_COMPILE_DRIVER=1.

Why

fold() was real-lowered but called separate FUNCDEFs that still returned stub nulls, breaking __DIR__/__FILE__ include-path folding on bin/compile.php and driver-scale bundles (#2827).

Test plan

  • vendor/bin/phpunit --filter JitCompilerSelfHostStubTest
  • make bootstrap-selfhost-link
  • PHP_COMPILER_M3_SOURCE=bin/compile.php ./script/bootstrap-selfhost-helloworld-compile-bin.sh
  • BOOTSTRAP_M3_HELLOWORLD_STRICT=1 ./script/bootstrap-selfhost-helloworld-probe.sh → emit_path=native

Closes #2827

Made with Cursor

…e driver.

fold() called stubbed literalStringValue/magicScriptConstValue callees and broke
__DIR__/__FILE__ include-path folding when the M3 compile driver was active.
Whitelist helper FUNCDEFs for PHP CFG lowering and allow them in the emit-TU gate.

Closes #2827

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 9c298f7 into master May 27, 2026
@PurHur
PurHur deleted the agent/selfhost-conststringfolder-helpers branch May 27, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant