Skip to content

Language: ArrayAccess JIT/AOT offset dispatch (#4012) - #4017

Merged
PurHur merged 2 commits into
masterfrom
agent/issue-4012-arrayaccess-jit-aot
Jun 1, 2026
Merged

PurHur merged 2 commits into
masterfrom
agent/issue-4012-arrayaccess-jit-aot

Conversation

@PurHur

@PurHur PurHur commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implement ArrayAccessHelper for JIT/AOT $obj[$key] read/write/isset/unset via offsetGet/offsetSet/offsetExists/offsetUnset instance dispatch (RuntimeIndirectInstanceMethodCall).
  • Remove containsArrayAccessObjectOpcodes from Block::requiresVmLowering so bin/jit.php no longer VM-fallbacks solely for ArrayAccess.
  • Fix RuntimeIndirectInstanceMethodCall / JitValueBox::coerceToValuePtrForStore when user methods return __value__ struct vs __value__*.

php-src reference: Zend/zend_object_handlers.c (zend_std_read_dimension, zend_std_write_dimension)

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./vendor/bin/phpunit --filter "array_access|ArrayAccess"'
OK (9 tests, 11 assertions)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./vendor/bin/phpunit --filter ArrayAccessJitCompileTest'
OK (1 test, 3 assertions)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./vendor/bin/phpunit --filter ArrayAccessJITTest'
OK (2 tests)  # compile.php -l on jit PHPT fixtures

Note: MCJIT execute for ArrayAccess still segfaults (LLVM 9); JITTest skips array_access* execute — same pattern as SplObjectStorageJITTest (lint + LLVM verify green).

Closes #4012

Made with Cursor

PurHur and others added 2 commits June 1, 2026 16:21
Add ArrayAccessHelper for offsetGet/Set/Exists/Unset via runtime instance
method dispatch, remove ArrayAccess from requiresVmLowering, and guard
compile/AOT with lint + LLVM verify tests. MCJIT execute remains skipped
in JITTest (segfault, same class as SplObjectStorage).

php-src: Zend/zend_object_handlers.c read_dimension / write_dimension
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 5bf020f into master Jun 1, 2026
@PurHur
PurHur deleted the agent/issue-4012-arrayaccess-jit-aot branch June 1, 2026 16: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.

Language: ArrayAccess — JIT/AOT offset dispatch on user objects (phase 2 of #3331)

1 participant