Skip to content

feat: centralize mbstring support across native and eval backends - #952

Draft
nahime0 wants to merge 11 commits into
mainfrom
feat/mbstring
Draft

feat: centralize mbstring support across native and eval backends#952
nahime0 wants to merge 11 commits into
mainfrom
feat/mbstring

Conversation

@nahime0

@nahime0 nahime0 commented Sep 10, 2026

Copy link
Copy Markdown
Member

Problem and result

Centralizes the mbstring implementation across the builtin contract, native AOT lowering, Magician eval, web/configuration paths, and the five supported targets. It adds the elephc-mbstring bridge, managed Oniguruma support, generated encoding and Unicode data, callback and reference adapters, tests, examples, and generated builtin documentation.

WIP status

This draft currently binds 63 of PHP 8.5.10's 65 public mbstring functions and all 9 constants. mb_convert_variables and mb_send_mail are still absent. Five-target adapter assembly is implemented, with the complete target matrix left for CI verification.

Known gaps:

  • the retained_owners callback GC regression still fails with one extra string owner per callback invocation
  • frontend typing and lowering for some closure and method callback cases remain incomplete
  • older compatibility gaps remain described in .plans/mbstring-extension.md

Validation

Focused local checks completed before integrating the latest main:

  • cargo build -p elephc
  • callback context validation test, 1 passed
  • native and eval callback effect regression passed
  • eval scope and global alias regressions, 12 passed
  • native ArgumentCountError, eval callback error, and generic callable arity regressions passed
  • five-target mbregex adapter assembly gates passed

Post-integration generation and integrity checks:

  • builtin exporter build passed and emitted 1,135 registry records
  • generated builtin catalog audit passed: 1,035 public catalog entries, 1,035 user pages, 1,029 internals, 0 errors
  • documentation compatibility passed: 2,192 pages
  • EIR builtin boundary audit passed: 691 registry-backed AOT entries, 0 structural errors
  • staged git diff --check passed, with no unresolved merge entries

Follow-up checks for the first CI findings:

  • cargo test -p elephc-builtin-contract --features curl, 49 passed
  • cargo build --bin elephc passed after completing the mbstring bridge descriptor

STEP1 CI preparation checks:

  • all 51 elephc-mbstring test targets compiled with cargo test -p elephc-mbstring --tests --no-run
  • workflow YAML parsing and shell syntax checks passed
  • assembly comment checks passed for the two Mach-O branch fixes
  • the example manifest and lock passed TOML and five-target validation
  • offline native package listing found both PCRE2 and Oniguruma installed

Integration status

  • STEP1 on 13457798d: all three Build & Archive jobs passed, and 129 downstream test jobs started.
  • STEP2: the branch was rebased linearly onto main b9b05c427 and published at 79ad2639f; its tree matches the independently reviewed merge-tree result. Fresh CI is running on the rebased head.

The complete supported-target and Rust test matrix is delegated to pull request CI on the integrated head.

Known failing validation: test_mbstring_regex_callback_retained_owners.

Related work: #895, #898, #899, #900, #902.

@github-actions github-actions Bot added area:magician Touches eval, include execution, or elephc-magician. area:runtime Touches runtime helpers, GC, ownership, or bridge runtimes. area:tooling-ci Touches CI, development tooling, Docker, or repository scripts. 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-aarch64 Contains behavior specific to the Linux AArch64 target. target:windows-x86_64 Contains behavior specific to the Windows x86_64 target. type:feature Introduces new user-visible behavior or capabilities. and removed target:linux-aarch64 Contains behavior specific to the Linux AArch64 target. labels Sep 10, 2026
@nahime0
nahime0 force-pushed the feat/mbstring branch 2 times, most recently from b79ffa2 to 9ae2b99 Compare September 11, 2026 10:54
Preserve native callable return ownership, balance eval scope synchronization, and retain callback metadata through borrowed values.
Update focused runtime regressions and CI fixtures for the corrected behavior.
Balance eval and native ownership transfers, preserve property array COW, and use target-local mbstring assembly labels. Split timeout-prone aggregate cases while retaining their original coverage.

Validated with warning-free builds, focused ownership and CI regressions, all-target mbstring assembly, and the seven builtin documentation gates.
Preserve boxed array and reflection ownership across AOT and eval boundaries.

Balance callback, by-reference, constructor, and exception cleanup while keeping runtime symbol emission target-aware.

Add focused GC, property, managed-native, and cross-target regression coverage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:magician Touches eval, include execution, or elephc-magician. area:runtime Touches runtime helpers, GC, ownership, or bridge runtimes. area:tooling-ci Touches CI, development tooling, Docker, or repository scripts. 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:windows-x86_64 Contains behavior specific to the Windows 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