Skip to content

Fix bootstrap stdlib filesystem AOT and add stream JIT (#1116, #1117)#1134

Merged
PurHur merged 5 commits into
masterfrom
fix/1116-1117-stdlib-fs-streams
May 23, 2026
Merged

Fix bootstrap stdlib filesystem AOT and add stream JIT (#1116, #1117)#1134
PurHur merged 5 commits into
masterfrom
fix/1116-1117-stdlib-fs-streams

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 23, 2026

Summary

  • Fix test/bootstrap-aot/stdlib_filesystem.php by enabling real JIT lowering for mkdir, file_put_contents, unlink, and rmdir under PHP_COMPILER_SELFHOST_AOT, and by using a repo-local fixture path instead of sys_get_temp_dir() / getmypid() (not available in AOT).
  • Add minimal JIT for fopen / fread / fclose via phpc_stream.c runtime helpers (__compiler_fopen, __compiler_fread, __compiler_fclose) following the existing file_put_contents / fwrite pattern.
  • Add compliance phpt fopen_fread_fclose_jit.phpt and extend SelfHostBuiltinPolicy tests.

Test plan

  • php bin/compile.php + run test/bootstrap-aot/stdlib_filesystem.php with PHP_COMPILER_SELFHOST_AOT=1 (expected/actual 11)
  • phpunit test/unit/SelfHostBuiltinPolicyTest.php
  • make bootstrap-aot-link (full gate; many unrelated targets still failing on master)
  • make bootstrap-selfhost-probe (currently fails on master with LLVM ICmp type mismatch)

Made with Cursor

Enable real lowering for mkdir, file_put_contents, unlink, and rmdir under
PHP_COMPILER_SELFHOST_AOT, and point the bootstrap fixture at a repo-local
path instead of unimplemented sys_get_temp_dir/getmypid helpers.

Add minimal fopen/fread/fclose JIT via phpc_stream.c runtime helpers and a
compliance phpt covering the read/close path after file_put_contents.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
Copy link
Copy Markdown
Owner Author

PurHur commented May 23, 2026

Superseded by #1141 (fopen/fread/fclose JIT on master). Remaining stdlib_filesystem bootstrap fixes can be a fresh PR if still needed.

@PurHur PurHur closed this May 23, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur reopened this May 23, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
Copy link
Copy Markdown
Owner Author

PurHur commented May 23, 2026

Superseded by #1141 (fopen/fread/fclose) and #1144 (SelfHostBuiltinPolicy filesystem builtins for #1116).

Resolve conflicts by taking master stream JIT and stdlib policy updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur reopened this May 23, 2026
)

ConstStringFolder::sourceDir real lowering triggers LLVM ICmp operand type
mismatch in bootstrap-selfhost; disable real lowering like IncludePathResolver.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant