Skip to content

gc_status php-src shape + gc_mem_caches MM cache (#9970, #9160) - #11324

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-9970-gc-status-shape
Jun 24, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-9970-gc-status-shape

Conversation

@PurHur

@PurHur PurHur commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

php-src reference

  • ext/standard/php_gc.c — PHP_FUNCTION(gc_status), PHP_FUNCTION(gc_mem_caches)
  • Zend/zend_gc.c — zend_gc_status()
  • Zend/zend_alloc.c — MM cache release

PHP implementation

  • lib/VM/CycleCollector.php — status shape
  • lib/VM/MemoryAccounting.php — MM cache accounting
  • ext/standard/GcStatusJitHelper.php — JIT/AOT table builder (4 keys)
  • lib/JIT/Builtin/GcStatusRuntime.php — LLVM bridge shrunk (~20 lines removed)

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro-maintainer/gc_status_shape.php
php bin/jit.php test/repro-maintainer/gc_status_shape.php
php bin/vm.php -r "echo gc_mem_caches(), \"\n\";"
vendor/bin/phpunit --filter "GcStatusTest|GcStatusRuntimeShrinkTest|MemoryRuntimeShrinkTest"
vendor/bin/phpunit --filter "gc_status_shape|gc_mem_caches_return|gc_status_jit" test/compliance/
'

Output:

collected,roots,runs,threshold
running=no
runs=yes
first call gc_mem_caches: 65536 (VM -r)
OK (12 tests, 39 assertions) unit
OK (12 tests, 12 assertions) compliance
./script/ci-fast.sh — green

Closes #9970
Closes #9160

Made with Cursor

…#9970, #9160)

Align gc_status() with Zend/php-src (runs, collected, threshold, roots only) via
CycleCollector and GcStatusJitHelper; shrink GcStatusRuntime LLVM bridge. Model
Zend MM cache bucket in MemoryAccounting so gc_mem_caches() returns non-zero on
first call per request.

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