Skip to content

Fix AOT function-scoped array append segfault (revert #36314 delref dtor CFG) - #36331

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-36215-fn-array-append-dtor-regression
Sep 2, 2026
Merged

Fix AOT function-scoped array append segfault (revert #36314 delref dtor CFG)#36331
PurHur merged 1 commit into
masterfrom
agent/issue-36215-fn-array-append-dtor-regression

Conversation

@PurHur

@PurHur PurHur commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Reverts the #36314 / #36195 changes to lib/JIT/Builtin/Refcount.php::__ref__delref that segfault on the first $a[] = … inside a user function (g_fn_array_append.php, test/repro/issue_36252_fn_array_append.php).
  • Restores the #36252 delref body: header-only free without __hashtable__dtor / misplaced emitPossibleGcRootOnDelref in the keep-alive CFG block.
  • {main} append continued to work; function CV append was broken — differential g_fn_array_append 0/3, Zend 16000.

Root cause

Bisect on master: 4f814aad66 (#36252) passes fn append; HEAD with #36314 dtor wiring fails. Removing only __hashtable__dtor is insufficient — the #36195 GC-root emit placement corrupts the delref CFG for refcounted arrays in function frames.

Test plan

make dev-verify-fast                                    # OK (75s, aot-smoke 9/9)
make north-star5-verify-fast                            # OK
./script/docker-exec.sh -- bash -lc '
  source script/php-env.sh
  php bin/compile.php -o /tmp/fn.bin test/repro/issue_36252_fn_array_append.php
  /tmp/fn.bin 16000   # -> 16000
  php bin/compile.php -o /tmp/main.bin test/repro/issue_36252_main_array_append.php
  /tmp/main.bin 16000 # -> 16000
'

Follow-up: re-land #36215 dtor + #36195 GC-root with fn-append regression in differential corpus.

Closes #36215 (partial — dtor deferred)

Made with Cursor

…dtor/GC CFG (#36215)

#36314 wired __hashtable__/__object__ dtors into __ref__delref and #36195 moved
emitPossibleGcRootOnDelref into the wrong CFG block. Together they segfault on the
first `$a[] = …` inside a user function while {main} append still works.

Restore the #36252 Refcount delref body until dtor/GC lowering is fixed with a
regression test (g_fn_array_append.php).

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 8821c42 into master Sep 2, 2026
@PurHur
PurHur deleted the agent/issue-36215-fn-array-append-dtor-regression branch September 2, 2026 11:06
PurHur added a commit that referenced this pull request Sep 2, 2026
…36427)

Wave-1 mandelbrot timeout (>60s, 51s sys) was fixed on master by reverting
the broken delref/dtor CFG (#36331); absolute targets are now met (mandelbrot
0.09s, simple 0.14s). Refresh benchmarks/BASELINE.json from pinned image and
add a differential case for the Julia while-loop shape.

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

1 participant