Repository navigation
JIT: Enum::cases() lowering (#4068) - #4112
Merged
Merged
Conversation
Register suit::cases-style static methods that build a packed array of enum case objects from compile-time backing constants, and handle ->name / ->value on those objects in property fetch. MCJIT execute for user enums still segfaults (#3518); EnumCasesJitCompileTest guards the lowering via LLVM module verify. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jun 1, 2026
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.
Summary
Enum::cases()as a per-enum LLVM function (suit::cases) that returns a packed list of enum case objects built from compile-time case constants.__value__);->name/->valueare handled in JIT property fetch.Zend/zend_enum.c(zend_enum_list_cases).Closes #4068
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php vendor/bin/phpunit test/unit/EnumCasesJitCompileTest.php'Output:
LLVM module contains
suit::casesand passescompileCommon()verify.VM compliance (unchanged):
Blocker (not merged)
MCJIT execute still segfaults for scripts that declare user enums (#3518 — same on
masterforenum E: string {}with no body).JITTestenum_casesremains skipped until execute is stable. Compile-time lowering is complete and guarded byEnumCasesJitCompileTest.Issue repro via
bin/jit.phphits this execute crash after successful compile (previously failed at compile with undefinedcases()).Made with Cursor