ffi 3.2 C1: migrate uikit.sx Foundation utility cluster to #objc_class
First of five Phase-3.2 migration clusters. Foundation utility
classes (NSValue, NSNumber, NSDictionary, NSMutableDictionary, NSSet)
in `library/modules/platform/uikit.sx` move from the explicit
`#objc_call(T)(recv, "selector:", args)` form to declarative
`#foreign #objc_class("Cls") { ... }` blocks with `recv.method(args)`
dispatch.
Classes declared (all near the top of uikit.sx, after the CGRect
struct):
- NSValue → CGRectValue (instance)
- NSNumber → numberWithBool (class), doubleValue +
unsignedLongValue (instance)
- NSDictionary → objectForKey (instance)
- NSMutableDictionary → dictionary (class), setObject_forKey (instance)
- NSSet → anyObject (instance)
Each call site casts the `*void` receiver to the typed foreign-class
pointer before dispatch — the existing `*void` shape is preserved
in the struct fields and outer parameter types; only the dispatch-
local copy is typed. This keeps the diff scoped to call-site
rewrites without rippling type changes through every consumer.
The four `objc_getClass(...)` calls that previously resolved
NSMutableDictionary / NSNumber at runtime are gone — Phase 3.1's
`__sx_objc_class_init` constructor populates the cached class slot
for each declared `#objc_class` at module load via
`OBJC_CLASSLIST_REFERENCES_<Cls>`.
166/166 example tests; chess clean on macOS + Android via
`tools/verify-step.sh` (iOS sim skipped — no booted simulator in
this run; previous full run was green at HEAD~6).
This commit is contained in:
@@ -543,8 +543,18 @@ one fixture. Both `.txt` and `.ir` snapshots locked — a change to
|
||||
`deriveObjcSelector` produces one diff that surfaces every affected
|
||||
case at once via the `OBJC_METH_VAR_NAME_*` constants in the IR.
|
||||
|
||||
Open work, in roughly the order they make sense:
|
||||
- **Phase 3 step 3.2 — C1..C5** — uikit.sx migration, one cluster
|
||||
Phase 3.2 C1 landed: Foundation utility cluster in uikit.sx
|
||||
migrated to declarative `#objc_class` bodies. Five classes declared
|
||||
near the top of the file (NSValue, NSNumber, NSDictionary,
|
||||
NSMutableDictionary, NSSet). Call sites rewritten from
|
||||
`#objc_call(T)(recv, "sel:", args)` to `recv.method(args)` /
|
||||
`Cls.method(args)`. Receivers cast from `*void` to the typed
|
||||
foreign-class pointer at the dispatch site. The `objc_getClass(...)`
|
||||
calls for these classes are gone — the class slot is now populated
|
||||
by emit_llvm's `__sx_objc_class_init` constructor (Phase 3.1).
|
||||
|
||||
Open work:
|
||||
- **Phase 3 step 3.2 — C2..C5** — uikit.sx migration, one cluster
|
||||
per commit, chess regression after each.
|
||||
test for the default-mangling table. Escape hatch for selectors
|
||||
that don't fit the underscore-split rule (e.g. `tableView_
|
||||
|
||||
Reference in New Issue
Block a user