Skip to content

Language: PHP 8 attributes reflection JIT/AOT (phase 2, post-#1354 VM) #2467

@PurHur

Description

@PurHur

Problem

#1354 ✅ and #1936 ✅ closed VM v1: attributes parse, lint, and compile; runtime ignores #[Attr] metadata in native paths. docs/capabilities-syntax.md still documents attributes as VM-only / reflection deferred.

Self-host and framework-style code may call ReflectionClass::getAttributes() / ReflectionMethod::getAttributes() — today that path is unsupported or stubbed in JIT/AOT binaries.

Goal (v1 subset)

Layer Target
VM Store attribute metadata on declared class/method/property nodes
JIT/AOT Emit const attribute name/arg blobs for spine-smoke units
Reflection Read path for getAttributes() on declared items — not full newInstance() with arbitrary constructors

Implementation hints

Piece Path Notes
Compiler lib/Compiler.php Attach attribute list to class/method IR (#1354 hooks)
VM lib/VM.php, reflection helpers Backing store for ReflectionAttribute
JIT lib/JIT.php Const metadata blobs; defer dynamic instantiation
AOT lib/AOT/ Link metadata section
Tests test/compliance/cases/attribute_reflection_*.phpt Zend subset
Capabilities php script/capability-syntax.php Flip syntax row when JIT/AOT green

Out of scope (v1)

Acceptance criteria

  • Compliance PHPT: declared class attribute round-trips via ReflectionClass::getAttributes() on VM
  • JIT compliance test green when @group llvm and LLVM present
  • php script/capability-syntax.php updates attributes row
  • php script/bootstrap-inventory.php --check still clean or documented delta

Verification (local / Docker only)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter Attribute'
./script/ci-fast.sh --filter Attribute
make test-harness   # when JIT touched

No GitHub Actions (#394 ✅).

Dependencies

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions