Skip to content

php-in-php: JIT NonObjectPropertyFetchHelper + EmptyObjectPropertyHelper — route property fetch LLVM through Vm PHP not ~250-line monolith (#1492) #10268

Closed

Description

@PurHur

Category

php-in-php · php-src-strict VM SSOT

Problem

Two JIT helpers duplicate VM property-access semantics in LLVM:

Helper Lines Semantics
lib/JIT/NonObjectPropertyFetchHelper.php ~51 Read $scalar->prop → E_WARNING + null; null deref → Error (#5276, #7431)
lib/JIT/EmptyObjectPropertyHelper.php ~201 empty($obj->prop) on typed/uninitialized slots (#6787, #3298)

VM implements these in lib/VM/PropertyAccess.php, TypedPropertyCheck, and IssetEmptySupport. JIT inlines __compiler_trigger_error calls and object-layout probes, drifting from VM on PHP 8+ Error vs Warning edges.

php-src reference

Repro

<?php
// Non-object read
$x = 1;
try { var_dump($x->a); } catch (Throwable $e) { echo $e::class, "\n"; }

// empty() on uninitialized typed property
class C { public int $i; }
$c = new C();
var_dump(empty($c->i)); // true
$c->i = 0;
var_dump(empty($c->i)); // true
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php repro.php
php bin/jit.php repro.php
'

Scope

Path Work
JIT shrink Route both helpers through VmPropertyFetch / VmEmptyIsset PHP
VM SSOT Consolidate shared guards (reuse #10170 IssetHelper patterns)
Tests test/compliance/cases/language/non_object_property_fetch.phpt, empty_typed_property.phpt

Target: delete ≥200 combined LLVM lines; zero new runtime/*.c error tables.

Done when

Related

Activity

  1. added
    enhancementNew feature or request
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 20, 2026
  2. PurHur commented on Jun 23, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — batch (issues #10268)

  3. PurHur commented on Jun 23, 2026

    @PurHur
    OwnerAuthor

    Merged via #10904.

    Verification

    • php vendor/bin/phpunit test/unit/NonObjectPropertyFetchRuntimeShrinkTest.php test/unit/EmptyObjectPropertyRuntimeShrinkTest.php — OK (6 tests)
    • make bootstrap-selfhost-vm-driver-execute-probe — OK
    • null_property_read_warning.phpt + null_property_read_error_jit.phpt — VM+JIT green

    LLVM shrink: ~190 lines removed from NonObjectPropertyFetchHelper / EmptyObjectPropertyHelper; PHP SSOT in NonObjectPropertyFetchJitHelper, VmEmpty.

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