Skip to content

php-in-php: delete phpc_json_decode.c, LLVM json_decode via StringJsonDecodeJit (#6202) - #7078

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-json-decode-6202
Jun 6, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-json-decode-6202

Conversation

@PurHur

@PurHur PurHur commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Delete lib/AOT/runtime/phpc_json_decode.c (649 C lines removed from lib/AOT/Linker.php).
  • Add lib/JIT/Builtin/StringJsonDecodeJit.php — LLVM bodies for __compiler_json_decode, __compiler_json_validate, __compiler_json_last_error, __compiler_json_last_error_msg (mirrors former C parser; php-src ref: ext/json/php_json.c).
  • Wire via StringJsonDecode::ensureLinked() in Type/String_.php + JitJsonDecode.php (same pattern as StringUnserialize / php-in-php: unserialize() parser — delete phpc_unserialize.c, VmUnserialize PHP path for VM+JIT+AOT #5991).

C/runtime shrink

Removed Lines
lib/AOT/runtime/phpc_json_decode.c 649

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit test/unit/JIT/StringJsonDecodeRuntimeStandaloneTest.php
vendor/bin/phpunit test/compliance/JITTest.php --filter json_decode_jit
vendor/bin/phpunit test/unit/JsonValidateBuiltinTest.php'
StringJsonDecodeRuntimeStandaloneTest.php  OK (1 test, 8 assertions)
JITTest.php --filter json_decode_jit         OK (1 test, 1 assertion)
JsonValidateBuiltinTest.php                  OK (5 tests, 6 assertions)

Note: bin/compile.php / AotTest json_decode_assoc segfault on this harness for all scripts including master echo ok (pre-existing env issue, exit 139). JIT path is green.

Closes #6202

Made with Cursor

…DecodeJit (#6202)

Move __compiler_json_decode/__compiler_json_validate and json_last_error*
from lib/AOT/runtime/phpc_json_decode.c into lib/JIT/Builtin/StringJsonDecodeJit.php
so VM/JIT/AOT share one PHP-owned parser path. Removes 649 lines of C from Linker.

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

Development

Successfully merging this pull request may close these issues.

php-in-php: json_decode() — delete phpc_json_decode.c (~649 lines), VM+JIT+AOT from ext/standard/VmJson*.php

1 participant