Skip to content

php-in-php: JIT EvalHelper — route eval() LLVM through VmEval PHP not inline compile path (#1492) #10248

Description

@PurHur

Category

php-in-php · language

Problem

eval() JIT lowering in lib/JIT/EvalHelper.php (~69 LOC) inlines compile-time literal eval via IncludeHelper::compileInlinedBlock and falls back to VmEval for dynamic strings. Mixed LLVM/inline paths duplicate ext/standard/VmEval.php semantics (#4652).

Goal: single PHP SSOT for eval return value, scope, and error handling — thin JIT trampoline only.

php-src reference

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_export(eval(\"return 1+2;\"));" 2>&1
php bin/jit.php -r "var_export(eval(\"return 1+2;\"));" 2>&1
php bin/jit.php -r "\$code=\"return 3;\"; var_export(eval(\$code));" 2>&1
wc -l lib/JIT/EvalHelper.php ext/standard/VmEval.php
'

Scope (PHP-in-PHP)

Path Work
lib/JIT/EvalHelper.php Always delegate to VmEval / runtime eval entry
ext/standard/VmEval.php Own literal + dynamic eval; return false + exception parity
lib/JIT/IncludeHelper.php Remove eval-specific inline block shortcut when PHP path handles literals

Done when

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