Skip to content

php-in-php: JIT ExceptionThrowRuntime — route throw/Object throw through VmException PHP not LLVM unwind (#1492) #9679

Description

@PurHur

Category

php-in-php · compile/runtime bridge

Problem

lib/JIT/Builtin/ExceptionThrowRuntime.php (~349 lines) implements throw/unwind setup in LLVM (exception object globals, bridge to ExceptionJitHelper). VM throw semantics live in lib/VM.php + VmException paths; JIT duplicates unwind tables instead of reusing compiled PHP helpers.

Sibling #9663 tracks ExceptionHandlerJitRuntime + try/catch; this issue is the throw expression / Object.throw fast path only.

php-src reference

Repro

<?php
try {
    throw new RuntimeException('probe');
} catch (RuntimeException $e) {
    echo $e->getMessage(), "\n";
}
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro/maintainer_throw_probe.php
php bin/jit.php test/repro/maintainer_throw_probe.php
'

VM prints probe; JIT must match without growing ExceptionThrowRuntime LLVM.

Scope (this repo)

Piece Path
PHP SSOT lib/VM/VmException.php (or extract throw helper used by VM + JIT)
JIT ExceptionThrowRuntime::implement() → emit call into ExceptionThrowJitHelper compiled unit
Shrink delete LLVM throw object materialization from ExceptionThrowRuntime.php
Tests existing test/compliance/cases/language/throw_*.phpt, test/unit/JitExceptionTest.php

No new runtime/*.c exception tables.

Done when

  • JIT throw path calls compiled PHP helper; repro matches VM
  • ExceptionThrowRuntime LLVM implement() removed or ≤50-line trampoline
  • PR body cites php-src paths + lines removed from LLVM runtime
  • ./script/ci-fast.sh --filter throw green on JIT fixtures

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter JitException'

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