Category
php-in-php · runtime
Problem
gc_collect_cycles() VM uses lib/VM/CycleCollector.php via ext/standard/gc_collect_cycles.php, but JIT declares native entrypoints in lib/JIT/Builtin/GcCollectCyclesNative.php (__compiler_gc_collect_cycles, phpc_gc_* from C runtime). GC cycle semantics belong in PHP for self-host (#1492); C should remain a thin ABI for destructor hooks only.
Pairs #9150 (gc_status() php-in-php).
php-src reference
Repro
<?php
$a = new stdClass();
$b = new stdClass();
$a->r = $b;
$b->r = $a;
unset($a, $b);
echo gc_collect_cycles(), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php repro_gc.php
php bin/jit.php repro_gc.php
'
| Runtime |
Prints collected count ≥ 0; no fatal |
| VM |
yes |
| JIT |
must match VM collector results on same graph |
Scope
| Layer |
Path |
| VM SSOT |
lib/VM/CycleCollector.php, ext/standard/gc_collect_cycles.php |
| JIT |
ext/standard/JitGcCollectCycles.php — call PHP collector, not __compiler_gc_collect_cycles |
| Shrink |
lib/JIT/Builtin/GcCollectCyclesNative.php declarations where replaceable |
| Tests |
extend test/compliance/cases/runtime/gc_collect_cycles.phpt with JIT leg |
PHP-in-PHP: shrink phpc_gc.c surface — document any remaining C-only destructor trampoline.
Done when (php-src-strict)
Related
Category
php-in-php·runtimeProblem
gc_collect_cycles()VM useslib/VM/CycleCollector.phpviaext/standard/gc_collect_cycles.php, but JIT declares native entrypoints inlib/JIT/Builtin/GcCollectCyclesNative.php(__compiler_gc_collect_cycles,phpc_gc_*from C runtime). GC cycle semantics belong in PHP for self-host (#1492); C should remain a thin ABI for destructor hooks only.Pairs #9150 (
gc_status()php-in-php).php-src reference
Zend/zend_gc.c—gc_collect_cycles()ext/standard/info.c—PHP_FUNCTION(gc_collect_cycles)exportRepro
Scope
lib/VM/CycleCollector.php,ext/standard/gc_collect_cycles.phpext/standard/JitGcCollectCycles.php— call PHP collector, not__compiler_gc_collect_cycleslib/JIT/Builtin/GcCollectCyclesNative.phpdeclarations where replaceabletest/compliance/cases/runtime/gc_collect_cycles.phptwith JIT legPHP-in-PHP: shrink
phpc_gc.csurface — document any remaining C-only destructor trampoline.Done when (php-src-strict)
__compiler_gc_collect_cyclesbodystdClassgraph./script/ci-fast.sh --filter gc_collect_cyclesgreenRelated