Skip to content

feat(core): align AOT and eval Core builtin support - #893

Draft
nahime0 wants to merge 439 commits into
mainfrom
feat/core-align
Draft

feat(core): align AOT and eval Core builtin support#893
nahime0 wants to merge 439 commits into
mainfrom
feat/core-align

Conversation

@nahime0

@nahime0 nahime0 commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

Aligns the Core builtin contract and its AOT and Magician implementations, including the callable, ownership, and runtime-state regressions found during review. Rebased onto main at 217ff6caa without merging the PR.

The internal Core inventory is 59/59 on both backends. This is not a claim of complete PHP compatibility: the generated PHP 8.5 comparison is 57/62 functions. The inventory excludes clone, get_error_handler(), and get_exception_handler(); the comparison counts die and exit separately as language constructs.

Changes

  • Shared contracts, typed EIR lowering, and target-aware runtime support for Core introspection, handlers, and GC controls.
  • Class introspection through direct calls, statically selected CUF/CUFA, FCC, named arguments, and spread arguments. Mixed array extraction no longer corrupts later object introspection.
  • Shared resource identity and ownership, last-owner retirement, explicit-close propagation, descriptor-reuse protection, and preservation of standard streams during web request reset.
  • Error-handler suspension and exception-safe restoration, ordinary-warning dispatch, reporting masks, nullable error_reporting() queries, and unhandled user-error termination.
  • Native visibility of declarations from the current eval context, shared resource inventory, array-valued constant snapshots, and thin-eval catalog constants including PHP_INT_SIZE.
  • Reflection fixes for protected visibility, trait properties, declaration order, and enum method spelling.
  • Backtrace composition across native and eval boundaries, preserving eval markers, options, and limits.
  • Integration with main's PCNTL callback lifetime, argument planning, and distinct eval status codes.
  • Focused regression tests, examples, and regenerated builtin documentation.

Deliberate bounds

  • 59/59 measures implemented contract entries, not unrestricted PHP semantics. Class-introspection callable targets remain subject to the documented static-target limits.
  • Native constant/function inventories append declarations from the current function's eval context; this is not a new process-global registry across unrelated eval contexts.
  • Resource inventory visibility is shared, but eval fclose() still operates on eval-managed streams. Synchronizing native locals into eval also retains them until the next synchronization or context release.
  • Constant categories use the documented Core/user grouping. disable_functions is unsupported, so get_defined_functions() accepts the flag without changing the inventory.
  • get_required_files() remains PHP's alias of get_included_files().
  • GC compatibility fields such as threshold, buffer_size, and full do not claim Zend collector-buffer parity.

Validation

Before local testing was stopped at the user's request, all 69 Core codegen tests and 23 shared-contract tests passed after the rebase. Focused checks also passed for the Core/PCNTL context ownership interaction, distinct eval status codes, five-target bridge exports, SysV runtime call alignment, and target-aware E_ALL. The remaining PCNTL executable checks were interrupted rather than reported as passed. No complete local suite was run.

Generated documentation and builtin-to-EIR boundary audits passed against the combined contract. The PR CI supplies the complete executable target matrix and iOS compile/emitter checks; the user is monitoring that run. No merge is performed by this work.

@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown

Too many files changed for review (2167 files, 100 file limit).

@github-actions github-actions Bot added area:builtins Touches PHP builtin declarations or emitters. area:codegen Touches target-aware assembly or backend lowering. area:magician Touches eval, include execution, or elephc-magician. scope:multi-area Touches more compiler areas than the automatic area-label cap. size:xl Very large pull request that needs deliberate review planning. target:linux-x86_64 Contains behavior specific to the Linux x86_64 target. type:feature Introduces new user-visible behavior or capabilities. area:web Touches --web mode, its prelude, or elephc-web. and removed area:codegen Touches target-aware assembly or backend lowering. labels Sep 4, 2026
@nahime0
nahime0 requested review from Guikingone and removed request for Guikingone September 7, 2026 09:45
@nahime0

nahime0 commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

Sorry @Guikingone, I've found some issues and must postpone your review on this one

@nahime0
nahime0 marked this pull request as draft September 7, 2026 10:10
@nahime0 nahime0 changed the title feat(core): complete AOT and eval builtin parity feat(core): align AOT and eval Core builtin support Sep 7, 2026
@github-actions github-actions Bot added area:runtime Touches runtime helpers, GC, ownership, or bridge runtimes. area:codegen Touches target-aware assembly or backend lowering. and removed area:builtins Touches PHP builtin declarations or emitters. area:runtime Touches runtime helpers, GC, ownership, or bridge runtimes. area:codegen Touches target-aware assembly or backend lowering. labels Sep 8, 2026
@nahime0
nahime0 force-pushed the feat/core-align branch 3 times, most recently from b4ed6ad to fa8a7ee Compare September 10, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:codegen Touches target-aware assembly or backend lowering. area:magician Touches eval, include execution, or elephc-magician. area:web Touches --web mode, its prelude, or elephc-web. scope:multi-area Touches more compiler areas than the automatic area-label cap. size:xl Very large pull request that needs deliberate review planning. target:linux-x86_64 Contains behavior specific to the Linux x86_64 target. type:feature Introduces new user-visible behavior or capabilities.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant