Skip to content

php-in-php: JIT AssertOptionsRuntime — route assert_options() through VmAssert PHP not ~476-line LLVM (#1492) #9513

Description

@PurHur

Category

php-in-php · php-src-strict runtime semantics via PHP SSOT

Problem

assert_options() JIT lowering lives in lib/JIT/Builtin/AssertOptionsRuntime.php (~476 LLVM lines) plus AssertIniRuntime.php globals (~88 lines). The VM already has PHP handlers in ext/standard/ (see assert_options.php, assert.php, issue #3316).

JIT/AOT should call the same PHP implementation through a thin JIT helper bridge (pattern: LastErrorRuntime → VmErrorLast, IniRuntime → VmIni), not duplicate assert INI state in LLVM globals.

php-src reference

Repro (parity baseline — VM must stay green)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "
var_dump(assert_options(ASSERT_ACTIVE));
assert_options(ASSERT_ACTIVE, 1);
var_dump(assert_options(ASSERT_ACTIVE));
"'

JIT gap today: compiling assert_options() in a JIT unit uses LLVM AssertOptionsRuntime instead of PHP.

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/jit.php -r "var_dump(assert_options(ASSERT_ACTIVE));"'

Scope (this repo)

Path Work
ext/standard/VmAssert.php (or extend existing assert VM class) SSOT for assert_options get/set
lib/JIT/Builtin/AssertOptionsRuntime.php Replace LLVM bodies with JitHelper call into PHP
lib/JIT/Builtin/AssertIniRuntime.php Delete or shrink to thin ABI; INI state owned by PHP
lib/JIT/BuiltinRegistry.php Wire helper registration
Tests JIT PHPT for assert_options round-trip

Done when

  • JIT/AOT assert_options() delegates to PHP SSOT — delete or substantially shrink AssertOptionsRuntime LLVM (target: thin trampoline only)
  • VM repro unchanged (php-src-strict)
  • assert_options(ASSERT_CALLBACK, $fn) callback identity preserved across JIT calls
  • PR body notes lines removed from AssertOptionsRuntime.php / AssertIniRuntime.php
  • No new logic in runtime/*.c

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-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions