Skip to content

php-in-php: lib/AOT/Linker.php runtime bundle audit — keep phpc_progress.c thin, track superglobals/phpc_stream/phpc_gc deletions #7389

Description

@PurHur

Category

php-in-php | bootstrap

Problem

AOT link still pulls four hand-written C translation units from lib/AOT/runtime/ plus hash_crypto_jit_runtime.c. Several deletion tracks exist (#5330, #5343, #5315, #7189), but there is no umbrella issue tying linker inclusion to measurable line-count removal — workers can land PHP replacements without deleting the C object from lib/AOT/Linker.php::RUNTIME_SOURCES, leaving dead ABI forever.

Current linker set (lib/AOT/Linker.php):

C source ~lines PHP replacement track Status
superglobals_refresh.c ~2623 #5330 / #7302 (multipart phase 2) open
phpc_stream.c ~1059 #5343 / #6821 open
phpc_gc.c ~368 #5315 / #6519 open
phpc_progress.c ~30 #7360 (SIGSEGV handler only) ✅ thin ABI kept
hash_crypto_jit_runtime.c ~800 #7189 / #5989 open

North-star: semantics live in lib/, ext/, lib/JIT/; C is trampoline/ABI only.

php-src reference

  • Behavioral reference: Zend SAPI (sapi/cgi/cgi_main.c), streams (main/streams/streams.c), GC (Zend/zend_gc.c), hash (ext/hash/hash.c)
  • This issue tracks deletion of our C shims, not re-porting php-src C verbatim

Repro (audit today)

docker info >/dev/null
./script/docker-exec.sh -- bash -lc '
  wc -l lib/AOT/runtime/*.c lib/JIT/Builtin/hash_crypto_jit_runtime.c
  rg -n "RUNTIME_SOURCES|phpc_" lib/AOT/Linker.php | head -20
'

Any PR that migrates behavior PHP-ward must show lines removed from the matching .c file and drop it from Linker.php when the PHP path is default for VM+JIT+AOT.

Scope (this repo)

Layer Path
Linker SSOT lib/AOT/Linker.php — RUNTIME_SOURCES / conditional phpc_progress.c
PHP replacements lib/Web/*, ext/standard/*, lib/VM/CycleCollector.php, lib/JIT/Builtin/VmHashNative.php
Docs PR bodies reference php-src path + PHP implementation path

Forbidden: new logic in runtime/*.c when the same work can compile through the existing PHP pipeline.

Done when

Verification

make bootstrap-selfhost-link
./script/docker-exec.sh -- bash -lc './script/ci-local.sh --filter AotTest'

Related

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 7, 2026
  2. PurHur commented on Jun 7, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — starting this run (#7389: migrate JSON POST parser out of superglobals_refresh.c into StringJsonDecodeJit LLVM, ~340 lines C removed).

  3. PurHur commented on Jun 7, 2026

    @PurHur
    OwnerAuthor

    Merged via PR #7563.

    C shrink: deleted ~340 lines of sg_json_* / parse_json_post from lib/AOT/runtime/superglobals_refresh.c (2003 → 1663 lines). JSON POST refresh now calls __phpc_json_parse_post_body from StringJsonDecodeJit.php.

    Verification:

    • SuperglobalsJsonPostRuntimeStandaloneTest — OK (2/2)
    • StringJsonDecodeRuntimeStandaloneTest — OK (1/1)
    • SuperglobalsBracketRuntimeStandaloneTest — OK (2/2)

    Note: full AOT RuntimeSuperglobalRefreshTest::testJsonPostBody compile still fails on master (pre-existing LLVM verification errors); unit/standalone LLVM tests for the new helper are green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITarea:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevExphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions