Skip to content

AOT: array_push/unshift without NestedJIT iterate (#27226) - #27325

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-27226-aot-array-push-unshift
Aug 3, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-27226-aot-array-push-unshift

Conversation

@PurHur

@PurHur PurHur commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Thin AOT NestedJIT of ArrayPushJitHelper::pushFromList / ArrayUnshiftJitHelper::unshiftFromList died on foreach ($ht->iterate()): CFG typed the Traversable temp as PHPCompiler\VM\Variable, so ObjectPropertyForeach boxed a null objectPropertySlot (Builder::call TypeError).
  • Append/prepend at the call site via ArrayBuiltinHelper::appendElement and HashTableUnshiftPrepend (VM helpers unchanged).
  • JitArrayPush::pushWithValueBoxGuard accepts __value__writeHashtable's TYPE_HASHTABLE tag (masked), not only VM TYPE_ARRAY.
  • Safety: already-boxed property fetches copy via JitValueBox::copyFromPointer; HashTableIterate results stay TYPE_HASHTABLE.

Closes #27226

Test plan

  • test/repro/aot_array_push_unshift_27226.php — VM / JIT / AOT all print:
    3 1,2,3
    4 0,1,2,3
    
  • vendor/bin/phpunit --filter 'ArrayPushRuntimeShrinkTest|ArrayUnshiftRuntimeShrinkTest' — OK (6 tests)
  • Not run: full ci-local.sh / north-star5-verify --strict

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
export PHP_COMPILER_HELPER_RUNTIME_O=0
REPRO=test/repro/aot_array_push_unshift_27226.php
php bin/vm.php $REPRO
php bin/jit.php $REPRO
php bin/compile.php -o /tmp/x $REPRO && /tmp/x
vendor/bin/phpunit --filter "ArrayPushRuntimeShrinkTest|ArrayUnshiftRuntimeShrinkTest"
'

Made with Cursor

Thin AOT NestedJIT of ArrayPush/UnshiftJitHelper foreach($ht->iterate())
hit ObjectPropertyForeach with a Variable-typed temp and a null
objectPropertySlot. Append/prepend at the call site (appendElement /
HashTableUnshiftPrepend), accept TYPE_HASHTABLE in the value-box guard,
and keep already-boxed property fetches copy-safe.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 10b002e into master Aug 3, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-27226-aot-array-push-unshift branch August 3, 2026 15:21
PurHur added a commit that referenced this pull request Aug 3, 2026
…#27329)

Honest bootstrap-gen0-refresh-argv-driver rebuild — stamps live fingerprint
ff28067e… and clears north-star5-fast step 4f-m after array_push/unshift
landed past #27324. Functional smoke OK. No restamp-only.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
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.

Regression: AOT array_push()/array_unshift() compile fails — ObjectInstancePropertyLlvm null call (ext/standard/array.c)

1 participant