Skip to content

php-in-php: JIT ReflectionBuiltinHelper — route reflection builtin LLVM through VmReflection PHP not ~336-line monolith (#1492) #10222

Description

@PurHur

Category

php-in-php · JIT lowering migration

Problem

lib/JIT/ReflectionBuiltinHelper.php (~336 lines) duplicates compile-time class literal checks and runtime reflection plumbing in LLVM:

VM path: ext/standard/VmReflection.php already implements reflection in PHP. JIT LLVM re-implements subsets → drift vs VM (readonly #5221, asymmetric #5060, enum cases #9537).

php-src reference

Repro (JIT vs VM drift)

Save as test/repro/maintainer_reflection_class_is_readonly.php (from #5221):

<?php
readonly class R {}
$rr = new ReflectionClass(R::class);
echo method_exists($rr, 'isReadOnly') ? 'method:yes' : 'method:no', "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro/maintainer_reflection_class_is_readonly.php 2>&1 | head -4
php bin/jit.php test/repro/maintainer_reflection_class_is_readonly.php 2>&1 | head -4
'

After migration, JIT must call same VmReflection entrypoints — fixing #5221 once applies to both.

Scope (PHP-in-PHP)

Layer Path
VM SSOT ext/standard/VmReflection.php — keep expanding real semantics
JIT lib/JIT/ReflectionBuiltinHelper.php → thin calls into JitReflection* wrappers over VM
Builtin lib/JIT/ReflectionBuiltinHelper.php delete inline LLVM after parity
Tests Existing reflection compliance PHPTs must pass JIT

No new C runtime logic.

Done when

Related

#5221 · #4384 · #5060 · #1492

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-2:languagePhase 2 – language featuresphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions