Skip to content

php-in-php: JIT HttpResponseCode — route http_response_code() through VmHttpResponse PHP not LLVM globals (#1492) #9344

Description

@PurHur

Category

php-in-php · php-src-strict

Problem

http_response_code() JIT/AOT lowering uses lib/JIT/Builtin/HttpResponseCode.php (~375 lines) with LLVM module globals (__phpc_http_response_status, __phpc_http_response_code_apply) and hand-rolled boxing. VM semantics already live in ext/standard/VmHttpResponse.php / http_response_code.php (PHP).

Duplicate LLVM state diverges from VM fixes (#9306 return-int regression, 0 no-op setter) and blocks shrinking the native bridge.

php-src reference

Repro (JIT divergence)

<?php
http_response_code(404);
var_dump(http_response_code());
var_dump(is_int(http_response_code()));
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro.php
php bin/vm.php repro.php
php bin/jit.php repro.php
'
Mode Expected
VM int(404), is_int true
JIT same as VM after migration

Scope (this repo)

Layer Work
JIT Replace HttpResponseCode::implement() LLVM globals with call into VmHttpResponse / shared PHP helper
Delete/shrink lib/JIT/Builtin/HttpResponseCode.php LLVM bodies; keep thin trampoline if needed
AOT same entry as JIT
Tests extend test/compliance/cases/stdlib/http_response_code*.phpt for JIT

PHP-in-PHP: route through existing ext/standard PHP; delete LLVM global/status apply table.

Done when

  • JIT + AOT repro matches VM/php-src on int returns and http_response_code(0) no-op
  • HttpResponseCode.php LLVM lowered by >50% (lines or symbols deleted — note in PR)
  • ./script/ci-fast.sh --filter http_response_code 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-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions