Skip to content

php-in-php: JIT sscanf/vfscanf — route through VmSscanf PHP not __compiler_sscanf libc LLVM (#1492) #9134

Description

@PurHur

Category

php-in-php · php-src-strict

Problem

VM sscanf() / fscanf() / vfscanf() parse via ext/standard/VmSscanf.php (PHP, #3190). JIT/AOT register LLVM helpers __compiler_sscanf, __compiler_sscanf_array, __compiler_sscanf_ex, __compiler_vfscanf in lib/JIT/Builtin/Type.php with libc sscanf formatting — duplicating VM semantics and blocking self-host surface shrink.

Distinct from #4512 (by-reference array element assignment parity) and #8835 (enum format operand TypeError): this issue is JIT routing to the PHP parser.

php-src reference

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "\$n=0; sscanf(\"42\", \"%d\", \$n); var_export(\$n); echo PHP_EOL;"
php bin/jit.php -r "\$n=0; sscanf(\"42\", \"%d\", \$n); var_export(\$n); echo PHP_EOL;"
# JIT lowers via __compiler_sscanf (libc path in Type.php)'

Scope

Layer Path
JIT lib/JIT/Builtin/StringSscanfJit.php (if present), lib/JIT/Builtin/Type.php
VM ext/standard/VmSscanf.php — SSOT
No new C runtime

Done when

  • JIT/AOT sscanf/vfscanf match VM + Zend on compliance / test/repro/maintainer_sscanf_*.php
  • Default JIT build does not require libc sscanf LLVM for these builtins
  • PR notes __compiler_sscanf* symbols removed or gated

Ref: #1492, #4512, #8835

Activity

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 / JITenhancementNew 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