Skip to content

php-in-php: JIT StringPrintRJit — route print_r() through VmVar PHP not __compiler_print_r LLVM (#1492) #9190

Description

@PurHur

Category

php-in-php · stdlib

Problem

print_r() VM logic lives in PHP (ext/standard/print_r.php, VmVar) but JIT/AOT still lower to __compiler_print_r with a parallel LLVM implementation in lib/JIT/Builtin/StringPrintRJit.php (formerly phpc_print_r.c).

Property-hook hiding (#8854), enum cases, and recursion guards must not be implemented twice (VM PHP vs LLVM).

php-src reference

Repro

<?php
class C { public int $x = 1; }
ob_start();
print_r(new C());
$s = ob_get_clean();
echo $s;
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php repro_print_r.php
php bin/jit.php repro_print_r.php'

Scope (this repo)

Layer Path
VM ext/standard/print_r.php, ext/standard/VmVar.php
JIT today lib/JIT/Builtin/StringPrintRJit.php
Target JIT invokes PHP VmVar::printR (or compiled native shim); shrink LLVM

Pairs #9188 (var_export) and #8854 (property hooks in dumps).

Done when

  • JIT print_r() output matches VM/Zend on repro
  • StringPrintRJit.php LLVM dumper removed or thin ABI only
  • Compliance guard under test/compliance/cases/stdlib/print_r*.phpt
  • PR body: php-src var.c ref + LLVM lines removed count

Related

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