Skip to content

php-in-php: JIT SessionCreateIdRuntime — route session_create_id() through VmSession PHP not LLVM (#1492) #9500

Description

@PurHur

Category

php-in-php · stdlib · php-src-strict

Problem

session_create_id() JIT uses lib/JIT/Builtin/SessionCreateIdRuntime.php (~287 lines LLVM) with hex table + entropy logic duplicated from VM, although ext/standard/VmSession.php already implements php-src semantics (php_session_create_id).

Workers should route JIT/AOT through compiled PHP helpers (same pattern as #9495 SessionStorageRuntime, #9411 SessionGcRuntime).

php-src reference

Repro (parity guard during migration)

<?php
$id = session_create_id();
var_export(is_string($id));
echo "\n";
var_export(strlen($id) >= 22 && strlen($id) <= 32);
echo "\n";
$id2 = session_create_id('phpc-');
var_export(str_starts_with($id2, 'phpc-'));
echo "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
wc -l lib/JIT/Builtin/SessionCreateIdRuntime.php
php bin/vm.php repro.php
php bin/jit.php repro.php
'
Check VM (SSOT) JIT today (gap)
returns string OK must match after migration
length in php-src range OK must match
optional $prefix verify VM must match

Scope (PHP-in-PHP first)

Path Work
ext/standard/SessionCreateIdJitHelper.php (new) wrap VmSession::createId()
lib/JIT/Builtin/SessionCreateIdRuntime.php thin bridge; delete hex/entropy LLVM
lib/JIT/Builtin/Type.php / session batch register helper link
Tests test/compliance/cases/stdlib/session_create_id_jit.phpt

Forbidden: new session ID logic in runtime/*.c.

Done when (php-src-strict)

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