Skip to content

php-in-php: JIT LateStaticBindingHelper — route static:: class resolution through VmLateStatic PHP not ~152-line LLVM (#1492) #10247

Description

@PurHur

Category

php-in-php · language

Problem

Late static binding (static::class, static::method(), new static) uses lib/JIT/LateStaticBindingHelper.php (~152 LOC) with a module-global phpc_late_static_class_id LLVM global and standalone-JIT special cases (#4792).

VM resolves called scope via PHP frame metadata (get_called_scope parity). LLVM path duplicates this and is fragile for self-host/AOT.

php-src reference

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "class B{public static function c():string{return static::class;}} class D extends B{} echo D::c();" 2>&1
php bin/jit.php -r "class B{public static function c():string{return static::class;}} class D extends B{} echo D::c();" 2>&1
wc -l lib/JIT/LateStaticBindingHelper.php
'
Engine D::c() via static::class
Zend 'D'
VM -r 'D' ✅ (verify)
JIT verify matches; refactor to PHP trampoline

Scope (PHP-in-PHP)

Path Work
lib/JIT/LateStaticBindingHelper.php Trampoline to VM called_scope resolver
lib/VM/LateStaticBinding.php SSOT for scope id → class name
lib/JIT/LateStaticBindingHelper.php Remove phpc_late_static_class_id global when PHP path sufficient

Done when

  • JIT static::class, static::method(), new static match VM on repro + compliance cases
  • LLVM global/class-id path deleted or gated to legacy AOT only with comment
  • ./script/ci-fast.sh --filter LateStatic green

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-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions