Skip to content

php-in-php: json_decode() JIT/AOT — delete phpc_json_decode.c (~649 lines), native VmJson (pairs #4795) #5302

Description

@PurHur

Category

php-in-php | bootstrap | stdlib

Problem

#4795 tracks bootstrap-native JSON without host ext/json. Today lib/AOT/runtime/phpc_json_decode.c (~649 lines) implements a parallel JSON parser in C for JIT/AOT while VM may delegate to host json_decode(). Self-host (M5) requires JSON in compiled PHP (ext/standard/VmJson.php or equivalent), not a growing C decoder.

php-src reference

Repro (failure today)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_dump(json_decode(\"{\\\"a\\\":1}\", true));"
test -f lib/AOT/runtime/phpc_json_decode.c && wc -l lib/AOT/runtime/phpc_json_decode.c
'
Runtime Today
VM works (often host delegation)
AOT bootstrap depends on C phpc_json_decode.c / host json
C file ~649 lines still in tree

Target: one PHP implementation compiled through the pipeline; delete C.

Scope (this repo)

Module Path
PHP parser/decoder new or extend ext/standard/VmJson.php, json_decode.php
JIT/AOT lowering lib/JIT/Builtin/ or ext JIT classes — no C fallback
Bootstrap gate make bootstrap-selfhost-link / php script/bootstrap-inventory.php --check
Delete C lib/AOT/runtime/phpc_json_decode.c (~649 lines)

Done when

Related

Links

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 3, 2026
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