Skip to content

Language: eval() — JIT/AOT lowering in caller scope (phase 2 of #4410 / #3358) #4652

Description

@PurHur

Category

language

Problem

VM eval() works after #3358 (ext/standard/VmEval.php, ext/standard/eval_.php). JIT/AOT still throw LogicException: eval() is VM-only in this compiler build (eval_.php::call()).

Scripts compiled with bin/jit.php or bin/compile.php that call eval() fail at runtime even when the eval string is statically known. Self-host bootstrap paths that rely on dynamic compilation need native-tier parity or an explicit Zend-compatible fatal.

php-src reference

Repro (failure today)

Save as repro_eval_jit.php:

<?php
$x = 1;
eval('$x = $x + 41;');
echo $x, "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php repro_eval_jit.php          # prints 42
php bin/jit.php repro_eval_jit.php         # LogicException: eval() is VM-only
php bin/compile.php repro_eval_jit.php /tmp/eval-test && /tmp/eval-test  # same
php repro_eval_jit.php                   # Zend: 42
'

Parse-error repro:

<?php
try {
    eval('syntax error here');
} catch (Throwable $e) {
    echo get_class($e), "\n";
}

VM must match Zend ParseError class/message; JIT/AOT must not segfault.

Scope (this repo)

Area Files Notes
JIT ext/standard/eval_.phpcall() Invoke runtime compile helper or defer to VmEval bridge
AOT lib/AOT/runtime/ Same runtime compile entry as VM
Shared ext/standard/VmEval.php Reuse compile+execute in caller scope
Tests test/compliance/cases/language/eval_jit.phpt, AOT fixture
Policy lib/JIT/SelfHostBuiltinPolicy.php Mark eval native or document VM-only with compile-time warning

Done when

Links

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 / JITarea:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions