Skip to content

Extend inline expr call-arg bridging for new expressions (#8561) - #8590

Merged
PurHur merged 5 commits into
masterfrom
agent/issue-8561-bootstrap-aot-link-lane-c
Jun 14, 2026
Merged

PurHur merged 5 commits into
masterfrom
agent/issue-8561-bootstrap-aot-link-lane-c

Conversation

@PurHur

@PurHur PurHur commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Generalize the php-cfg inline call-arg bridge from array literals only to also cover Expr_New producers and New_ ctor consumers (f(new C('x')), new C(['a'])).
  • Route TYPE_ARG_SEND through the producer slot directly instead of emitting a cross-type TYPE_ASSIGN, fixing AOT compile failure (Cannot assign operands of different types (yet): 134, 196) on const_string_folder_func_call_args.php.

php-src reference: N/A — compile-time CFG lowering (Zend zend_compile.c emits a single temp; php-cfg splits producer/consumer).

PHP implementation: lib/Compiler.php (findInlineExprCallArgProducerSlot, compileCallArgSends).

Verification

# Repro scripts (Zend / VM / AOT)
php bin/vm.php test/repro/inline_new_call_arg.php          # 1
php bin/vm.php test/repro/inline_new_array_ctor_arg.php    # 1
php bin/compile.php -o /tmp/new1 test/repro/inline_new_call_arg.php && /tmp/new1          # 1
php bin/compile.php -o /tmp/new2 test/repro/inline_new_array_ctor_arg.php && /tmp/new2  # 1

# Bootstrap smokes (previously failing)
php bin/vm.php test/bootstrap-aot/const_string_folder_smoke.php           # 11
php bin/vm.php test/bootstrap-aot/const_string_folder_func_call_args.php    # 1
php bin/compile.php -o /tmp/csf test/bootstrap-aot/const_string_folder_smoke.php && /tmp/csf       # 11
php bin/compile.php -o /tmp/ccfa test/bootstrap-aot/const_string_folder_func_call_args.php && /tmp/ccfa  # 1

# PHPUnit
./vendor/bin/phpunit test/aot/BootstrapPhaseCTest.php --filter 'InlineNew|InlineArray'
# OK (3 tests, 21 assertions)

# Partial bootstrap-aot-link gate (additional smokes now green; full gate still has unrelated stdlib_hash/include_path failures)
make bootstrap-aot-link  # const_string_folder_*, switch_equal_value_long, dirname_value_path, instanceof_check, deploy_path_include now pass

Closes #8561 (partial — M5 bootstrap-aot-link gate progress; remaining failures are unrelated stdlib/filesystem/hash smokes).

Made with Cursor

PurHur and others added 5 commits June 14, 2026 18:54
Compile-time rewrite maps the if-entry ?string arm to null === $param ? null : $param
(php-src equivalent) and tracks the JumpIf so branch targets stay aligned with IDENTICAL.

Verification: php vendor/bin/phpunit test/unit/NullableNeNullTernaryRewriteTest.php test/unit/TernaryReturnMergeSlotTest.php
  php bin/vm.php test/repro/aot_ternary_ne_null.php
  PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 php bin/compile.php -o /tmp/n test/repro/aot_ternary_ne_null.php && /tmp/n
Co-authored-by: Cursor <cursoragent@cursor.com>
Return typed string operands directly from the if-entry arm instead of
reading the shared phi VALUE box after merge-block dead-operand frees.
Nullable/union if-arms keep per-arm RETURN from the phi slot; pure string
params skip the box on the string arm only.

Verification:
- test/repro/ns_nullable_ternary_return.php AOT exit 0 (was segfault)
- test/repro/aot_ternary_bool.php AOT exit 0
- test/repro/getenv_identical_false.php AOT prints yes
- make bootstrap-aot-link still 16 failures (ns_func, ne_null, …)

Co-authored-by: Cursor <cursoragent@cursor.com>
…8563).

Rewrite direct and ternary returns of explicit ?T params to $param ?? null
(php-src equivalent) so native AOT uses the proven coalesce VALUE-box path.
Register nullable scalar returns as __value__* in JIT ABI; cherry-pick ?: merge
lowering from #8555.

Verification: php vendor/bin/phpunit test/unit/NullableNeNullTernaryRewriteTest.php test/unit/NullableStringReturnAbiTest.php
  PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 php bin/compile.php -o /tmp/t test/repro/aot_ternary_ne_null.php && /tmp/t
  PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 php bin/compile.php -o /tmp/t test/repro/aot_nullable_param_direct_return.php && /tmp/t
Co-authored-by: Cursor <cursoragent@cursor.com>
php-cfg also splits Expr_New results from FuncCall/New ctor args; route
TYPE_ARG_SEND through the producer slot directly to avoid AOT assign type
mismatches. Unblocks const_string_folder bootstrap smokes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 737b021 into master Jun 14, 2026
@PurHur
PurHur deleted the agent/issue-8561-bootstrap-aot-link-lane-c branch June 14, 2026 19:27
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.

M5: CI matrix — precompiled native driver with Zend parity tests

1 participant