feat: implement PHP mb_strtoupper (AOT + Magician) - #898
Open
nahime0 wants to merge 12 commits into
Open
Conversation
Declare PHP mb_strtoupper(string, ?string $encoding = null) in the shared builtin catalog, join Magician eval (UTF-8 full mapping, 8bit ASCII, iconv round-trip, catchable ValueError), and register the AOT home plus RuntimeFnId so lowering can emit a Fresh-owned helper gated by RuntimeFeatures. Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Add the feature-gated __rt_mb_strtoupper helper for AArch64 and x86_64: Unicode full-case tables, UTF-8 walker with malformed copy-through, ASCII byte encodings, and an iconv UTF-32LE round-trip. Lower RuntimeFnId::MbStrtoupper through the same optional-encoding ABI as mb_strlen. Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Add codegen, eval-parity, Magician, and type-error tests for Unicode mapping, encoding aliases, malformed UTF-8 copy-through, first-class callables, and catchable unknown-encoding ValueError. Show the builtin in the string-ops example. Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Record the encoding-aware Unicode uppercase builtin next to mb_strlen, bump the mbstring compatibility count, and note the gated runtime helper. Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
The ensure/put_utf8 labels are only called from the AArch64 emitter. Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
nahime0
marked this pull request as ready for review
September 5, 2026 10:38
|
Too many files changed for review (286 files, 100 file limit). Bypass the limit by tagging |
Short malformed UTF-8 inputs reserved fewer than 12 bytes, so ensure called concat_grow and then ret'd with the clobbered x30, hanging the walker. Save/restore the frame around that call. Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Frameless ensure/free-temps helpers now pad around nested calls, and the unknown-encoding path tears down the frame with mov/pop so the runtime alignment audit can track rsp. Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements PHP
mb_strtoupper(string $string, ?string $encoding = null): stringfor AOT and Magician/eval, following the existingmb_strlenencoding contract.Semantics (PHP 8.5 / UTF-8)
nullencoding uses Unicode full case mapping (ß→SS,é→É)8bit/binary/7bitapply ASCII-onlya-z→A-Ziconvinto UTF-32LE, uppercase, and encode back\ValueErrorChanges
ICONV_MACOSrequirementeval_builtin!implementationRuntimeFnId::MbStrtoupper, feature-gated__rt_mb_strtoupperfor AArch64 and x86_64CI follow-up
__rt_mb_strtoupper_ensurepreserves LR across__rt_concat_growdocs/php/compatibility.md(516/2030)mov rsp, rbp/pop rbpCI on this head is green (145 checks).