[php-src] PR #22743: Defer object destructors to the next VM safepoint

From: Date: Wed, 15 Jul 2026 14:07:40 +0000
Subject: [php-src] PR #22743: Defer object destructors to the next VM safepoint
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-37065@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22743 Author: iliaal Object destructors now run at the next VM safepoint instead of inline at the point an object's last reference is released, so a destructor can no longer reenter the VM mid-opcode. Logical death stays synchronous: a WeakReference reads null and a WeakMap entry is gone at the drop, only the __destruct call and the free move. The flush points include every try-region boundary, so a destructor dropped inside a try stays catchable by that try at the correct nesting level; output is identical across the interpreter, tracing JIT, and function JIT. Release callgrind shows no change on code without try/catch and under 1.5% on realistic destructor-in-try workloads; the only larger delta is a trivial try/return in a hot JIT trace, where forced opline materialization dominates and collapses once the function does real work. This builds on the destructor deferral in arnaud-lb/php-src#31; the difference in flush placement and its effect on catchability is in a comment below. The first commit is php/php-src#22515, the user-error-handler half of the same mechanism, in review; this stacks the destructor half on top and rebases to the single destructor commit once #22515 lands. Fixes GH-20001

« previous php.git-pulls (#37065) next »