ffi 3.2 C3: migrate uikit.sx RunLoop + display-timing cluster

Third cluster: NSRunLoop and CADisplayLink move to declarative
`#objc_class` blocks.

Classes declared:

- NSRunLoop     → currentRunLoop (class)
- CADisplayLink → displayLinkWithTarget_selector (class),
                  addToRunLoop_forMode (instance),
                  targetTimestamp (instance), duration (instance)

The display-link instance is created with the new typed call shape:

    link := CADisplayLink.displayLinkWithTarget_selector(plat.gl_view, sel_tick);
    plat.display_link = xx link;  // keep the *void slot in the
                                   // platform struct for ABI parity
    runloop := NSRunLoop.currentRunLoop();
    link.addToRunLoop_forMode(runloop, mode_ns);

The `sxTick:` callback's `link: *void` param is cast to
`*CADisplayLink` at function entry so the body's `link.duration()` /
`link.targetTimestamp()` calls type-check.

Two now-redundant `objc_getClass(...)` lookups for CADisplayLink /
NSRunLoop are gone — the class slots come from the declarative
declarations via `__sx_objc_class_init`.

166/166 tests; chess builds clean on macOS / iOS / Android.
This commit is contained in:
agra
2026-05-25 17:15:27 +03:00
parent 17775b27a4
commit 2a7c8e0a6f
2 changed files with 36 additions and 12 deletions

View File

@@ -560,9 +560,17 @@ declared as `#foreign #objc_class` blocks. The 4-keyword
`addObserver:selector:name:object:` selector derives cleanly from
the underscore-separated sx name (`addObserver_selector_name_object`).
Phase 3.2 C3 landed: RunLoop + display-timing cluster. NSRunLoop
(`currentRunLoop`) and CADisplayLink
(`displayLinkWithTarget_selector`, `addToRunLoop_forMode`,
`targetTimestamp`, `duration`) declared as `#foreign #objc_class`
blocks. The `link` parameter on the `sxTick:` callback is now cast
to `*CADisplayLink` at function entry so subsequent method calls
type-check.
Open work:
- **Phase 3 step 3.2 — C3..C5** — uikit.sx migration, one cluster
per commit, chess regression after each.
- **Phase 3 step 3.2 — C4..C5** — uikit.sx migration, two clusters
remaining (UIKit chrome, view tree + GL).
test for the default-mangling table. Escape hatch for selectors
that don't fit the underscore-split rule (e.g. `tableView_
numberOfRowsInSection_` with an asymmetric keyword count).