Skip to content

php-in-php: JIT readonly pending exception — delete phpc_readonly_raise.c (~77 lines), lib/JIT/ReadonlyBridge.php #5374

Description

@PurHur

Category

php-in-php

Problem

Readonly property violations in native JIT code use a second C pending buffer (lib/AOT/runtime/phpc_readonly_raise.c, ~77 lines): __compiler_jit_raise_logic_exception() records the message; AOT mains call phpc_jit_abort_if_pending_logic_exception(). This duplicates the Error pending pattern in phpc_error_raise.c and should live in PHP with a thin ABI.

php-src reference

Repro (failure today)

<?php
readonly class R {
    public function __construct(public int $x) {}
}
$r = new R(1);
$r->x = 2;
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/jit.php repro.php 2>&1 | head -5
'
Runtime Expected
Zend PHP 8.x Uncaught Error: Cannot modify readonly property R::$x
JIT/AOT today C buffer in phpc_readonly_raise.c → PHP throw or AOT stderr fatal

Scope (this repo)

Module Path
Delete C lib/AOT/runtime/phpc_readonly_raise.c (~77 lines)
PHP bridge lib/JIT/ReadonlyBridge.php (or shared pending-exception helper with #5371)
JIT readonly store sites in lib/JIT/Builtin/Type/Object_.php
Tests test/compliance/cases/language/readonly_jit.phpt (or extend existing readonly suite)

Done when

  • phpc_readonly_raise.c deleted from tree and link
  • JIT + standalone AOT match Zend Error message for readonly writes
  • PR notes ~77 lines removed from lib/AOT/runtime/
  • ./script/ci-fast.sh --filter readonly green

Links

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 / JITarea:vmVirtual machineenhancementNew 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