Skip to content

Stdlib: locale_lookup() JIT lowering via VmLocale helper (#32118) - #32174

Merged
PurHur merged 2 commits into
masterfrom
agent/advanced-stdlib-32118-locale-lookup-jit
Aug 18, 2026
Merged

Stdlib: locale_lookup() JIT lowering via VmLocale helper (#32118)#32174
PurHur merged 2 commits into
masterfrom
agent/advanced-stdlib-32118-locale-lookup-jit

Conversation

@PurHur

@PurHur PurHur commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace locale_lookup() JIT RuntimeException (JIT lowering not implemented; use VM) with RFC 4647 lowering that matches VM/VmLocale::lookup() (php-src ext/intl/locale/locale_methods.c).
  • Compile-time fold when the language-tag list + locale/canonicalize/default are literals; otherwise NestedJIT LocaleLookupJitHelper::lookupArgv() via __phpc_jit_locale_lookup.
  • Same helper for Locale::lookup() (functionProxies['locale::lookup']). php-src-strict; no php-compiler-strict shortcut.

Closes #32118

Test plan

  • ./script/phpunit.sh --filter 'LocaleLookupJitShrinkTest|LocaleLookupJitCompileTest|LocaleLookupJit32118'
    • OK (7 tests, 24 assertions) — VM + JIT compliance .phpt result path, LLVM compile-only fold, helper SSOT
  • ./script/docker-exec.sh -- bash -lc 'php test/repro/issue_32118_locale_lookup_jit.php'
    • lookup_pos=de / lookup_named=de / lookup_vars=de / lookup_fallback=en_US
  • ./script/docker-exec.sh -- bash -lc 'php test/repro/issue_25198_locale_lookup_named.php'
    • named args + unknown $langtag match VM/Reflection stubs
  • php script/bootstrap-inventory.php --checkOK 7581/7581
  • Host AOT of advertised locale_lookup (this image: extension_loaded('intl')=0; AOT fixture SKIPIFs)

Not covered: check-selfhost-spine-coverage-sync is already red on master for 6 unrelated ldap/stream-include files (not this diff). Capability-matrix/syntax --check also drifted on master before this change; not regenerated.

php-src: ext/intl/locale/locale_methods.c, ext/intl/php_intl.stub.php
PHP: ext/intl/JitLocaleLookup.php, ext/intl/LocaleLookupJitHelper.php, lib/JIT/Builtin/LocaleLookupRuntime.php

Made with Cursor

PurHur and others added 2 commits August 18, 2026 11:52
Replace the JIT-not-implemented throw with compile-time RFC 4647 fold
and a NestedJIT helper so locale_lookup()/Locale::lookup() match VM/php-src.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 2c92f6b into master Aug 18, 2026
0 of 2 checks passed
@PurHur
PurHur deleted the agent/advanced-stdlib-32118-locale-lookup-jit branch August 18, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: locale_lookup() JIT path throws instead of matching php-src locale lookup (ext/intl/locale/locale_methods.c)

1 participant