Skip to content

Stdlib: fix AOT sys_getloadavg() + count() on boxed arrays (#27294) - #27431

Merged
PurHur merged 1 commit into
masterfrom
agent/stdlib-27294-aot-sys-getloadavg
Aug 3, 2026
Merged

Stdlib: fix AOT sys_getloadavg() + count() on boxed arrays (#27294)#27431
PurHur merged 1 commit into
masterfrom
agent/stdlib-27294-aot-sys-getloadavg

Conversation

@PurHur

@PurHur PurHur commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

php-src: ext/standard/basic_functions.cPHP_FUNCTION(sys_getloadavg); ext/standard/array.cphp_count.

Test plan

  • Issue repro via ./script/docker-exec.sh — Zend/VM/JIT/AOT print before\nafter\n3
  • AOT binary 10/10 identical (exit 0)
  • count([1,2,3]) / count([]) AOT OK; SplFixedArray::fromArray count still 3
  • vendor/bin/phpunit --filter VmSysGetloadavgRuntimeShrinkTest — OK
  • vendor/bin/phpunit --filter AotRegressionFixtureCatalogTest — OK
  • php script/bootstrap-inventory.php --check — OK 6928/6928

Exact verification

./script/docker-exec.sh -- bash -lc '
source script/php-env.sh
cat > /tmp/loadavg.php <<P
<?php
echo "before\n";
$a = sys_getloadavg();
echo "after\n";
echo is_array($a) ? count($a) : "notarr", "\n";
P
php /tmp/loadavg.php
php bin/vm.php /tmp/loadavg.php
php bin/jit.php /tmp/loadavg.php
php bin/compile.php -o /tmp/loadavg.bin /tmp/loadavg.php
for i in 1 2 3 4 5 6 7 8 9 10; do /tmp/loadavg.bin; echo exit=$?; done
'
# → before/after/3 ×10, exit=0

Not covered: full ci-local.sh / compliance suites; bootstrap-selfhost-link (stale gen-0 → Zend fallback, terminated after ~20m compile).

Made with Cursor

NestedJIT HashTable returns are not thin-AOT `__hashtable__*` — materialize
loadavg via scalar helpers + setDoubleAt. count() on TYPE_VALUE must branch
on the box type tag so SplFixedArray Countable dispatch (#26793) does not
abort plain array counts.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 75c062a into master Aug 3, 2026
0 of 2 checks passed
@PurHur
PurHur deleted the agent/stdlib-27294-aot-sys-getloadavg branch August 3, 2026 20:01
@PurHur
PurHur restored the agent/stdlib-27294-aot-sys-getloadavg branch August 3, 2026 20:01
@PurHur
PurHur deleted the agent/stdlib-27294-aot-sys-getloadavg branch August 5, 2026 08:12
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 sys_getloadavg() segfaults after build — VM/JIT match Zend (ext/standard/basic_functions.c)

1 participant