Skip to content

Stdlib: extract() and compact() JIT/AOT parity (#275 follow-up) #476

@PurHur

Description

@PurHur

Problem

#275 closed with VM-only extract() / compact() in ext/standard/extract_.php, compact_.php, VmScope.php. docs/capabilities.md shows:

Function VM JIT AOT
extract yes no no
compact yes no no

JIT stubs throw LogicException('not implemented for JIT in this compiler build'). Template-heavy apps may use explicit locals today (#471 layout pattern), but frameworks expect extract($data) before include.

Goal

JIT + AOT fast paths (or VM callout) for:

  • extract(array $vars, int $flags = EXTR_SKIP) — string keys only, EXTR_SKIP minimum
  • compact('a', 'b', …) — literal string name list (existing VM restriction)

Implementation hints

Area Files Notes
JIT builtins lib/JIT/Builtin/ new handlers or extend VmScope callout Import keys into active LLVM scope
AOT runtime helper shared with VM Symbol php_compiler_extract
Tests test/compliance/cases/extract_template.phpt extract + echo variable
Matrix script/capability-matrix.php --check Flip JIT/AOT columns to yes

Acceptance criteria

docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
  php bin/jit.php -r '$t=["name"=>"Dev"]; extract($t); echo $name;'

Prints Dev without LogicException.

Verification (local / Docker only)

./script/ci-local.sh --filter extract

Dependencies

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions