Category
php-in-php | runtime | stdlib
Problem
VM gc_collect_cycles() uses PHP (lib/VM/CycleCollector.php, ext/standard/gc_collect_cycles.php) but JIT/AOT link lib/AOT/runtime/phpc_gc.c (~368 lines) duplicating Tarjan sweep, weakref clearing, and object graph walks in C. #3160 tracks JIT parity; this issue tracks deleting the C TU once native lowering calls the PHP collector.
php-src reference
Repro (failure today)
C runtime still linked:
./script/docker-exec.sh -- bash -lc 'grep phpc_gc lib/AOT/Linker.php; wc -l lib/AOT/runtime/phpc_gc.c'
VM vs JIT count mismatch on cyclic graph — save as test/repro-maintainer/parity_gc_collect_cycles_jit.php:
<?php
class Node { public ?Node $next = null; }
$a = new Node();
$b = new Node();
$a->next = $b;
$b->next = $a;
unset($a, $b);
echo gc_collect_cycles(), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro-maintainer/parity_gc_collect_cycles_jit.php
php bin/jit.php test/repro-maintainer/parity_gc_collect_cycles_jit.php 2>&1 | head -5
'
| Runtime |
Expected (Zend) |
This compiler |
| VM |
positive int (cycles collected) |
✅ PHP collector |
| JIT |
same count as VM |
❌ C overlay or stub |
Scope (this repo)
| Area |
Files |
| VM (source of truth) |
lib/VM/CycleCollector.php |
| JIT |
lib/JIT/Builtin/GcCollectCyclesRuntime.php — call PHP collector, not C |
| Delete |
lib/AOT/runtime/phpc_gc.c |
| Tests |
test/compliance/cases/stdlib/gc_collect_cycles_cyclic.phpt |
Done when
Related
Category
php-in-php|runtime|stdlibProblem
VM
gc_collect_cycles()uses PHP (lib/VM/CycleCollector.php,ext/standard/gc_collect_cycles.php) but JIT/AOT linklib/AOT/runtime/phpc_gc.c(~368 lines) duplicating Tarjan sweep, weakref clearing, and object graph walks in C. #3160 tracks JIT parity; this issue tracks deleting the C TU once native lowering calls the PHP collector.php-src reference
Zend/zend_gc.c—gc_collect_cycles(),zend_gc_collect_cycles()ext/standard/basic_functions.c—PHP_FUNCTION(gc_collect_cycles)Repro (failure today)
C runtime still linked:
./script/docker-exec.sh -- bash -lc 'grep phpc_gc lib/AOT/Linker.php; wc -l lib/AOT/runtime/phpc_gc.c'VM vs JIT count mismatch on cyclic graph — save as
test/repro-maintainer/parity_gc_collect_cycles_jit.php:Scope (this repo)
lib/VM/CycleCollector.phplib/JIT/Builtin/GcCollectCyclesRuntime.php— call PHP collector, not Clib/AOT/runtime/phpc_gc.ctest/compliance/cases/stdlib/gc_collect_cycles_cyclic.phptDone when
gc_collect_cycles()returns same count as VM on cyclic object repro abovephpc_gc.cdropped fromlib/AOT/Linker.phplink setruntime/Related