From d3425fa2877765d869bf3e655afd42b55d78d8fc Mon Sep 17 00:00:00 2001 From: agra Date: Mon, 15 Jun 2026 06:25:16 +0300 Subject: [PATCH] =?UTF-8?q?docs(ffi-linkage):=20checkpoint=20=E2=80=94=20P?= =?UTF-8?q?hase=206.4+6.5=20done;=20PHASE=206=20COMPLETE=20(library/=20#fo?= =?UTF-8?q?reign-free);=20next=20Phase=207?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- current/CHECKPOINT-EXTERN-EXPORT.md | 54 ++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/current/CHECKPOINT-EXTERN-EXPORT.md b/current/CHECKPOINT-EXTERN-EXPORT.md index ed816aa..758e674 100644 --- a/current/CHECKPOINT-EXTERN-EXPORT.md +++ b/current/CHECKPOINT-EXTERN-EXPORT.md @@ -5,7 +5,22 @@ Companion to `current/PLAN-EXTERN-EXPORT.md` — one merged plan: **Part A** add every commit, one step at a time per the cadence rule. ## Last completed step -**Phase 6.3 — migrate `std/` `#foreign`→`extern`** (`refactor` commit `59f90d2`). +**Phase 6.5 — migrate `gpu/` `#foreign`→`extern`; `library/` now `#foreign`-free** +(`refactor` commit `32a7628`). **PHASE 6 COMPLETE.** Final batch: gpu/gles3.sx +(eglGetProcAddress + 1 comment) + gpu/metal.sx (MTLCreateSystemDefaultDevice), bare +fn markers → `extern`. Verified byte-identical `sx ir` on importers 1610 (gles3) + +1606 (metal). **Zero `#foreign` remains anywhere under `library/`** — verified by +`grep -rln '#foreign' library/` → no matches. Suite green (647 corpus / 444 unit, 0 +failed). + +### Prior: Phase 6.4 — migrate `ffi/` `#foreign`→`extern` (`refactor` commit `666a2e2`). +objc/objc_block/raylib/sdl3/wasm (~51 sites): fn markers + objc.sx's 2 import runtime +classes (prefix→postfix `extern`). objc + objc_block validated by the 50 marked 13xx +corpus examples (incl. import classes 1300/1301 + defined classes 1339/1349); +raylib/ffi-sdl3/wasm verified by byte-identical `sx ir` probes pre/post. Empty snapshot +diff; suite green. + +### Prior: Phase 6.3 — migrate `std/` `#foreign`→`extern` (`refactor` commit `59f90d2`). Pure source rename across 11 std modules (~60 sites): cli/core/fmt/fs/log/net.kqueue/process/socket/thread/time/trace. All fn-decl markers — bare `#foreign;`, `#foreign libc;`/`#foreign tlib;` (LIB ref), and @@ -194,19 +209,24 @@ AOT), 1227 (export fn rename, AOT), 1348 (objc extern class), 1349 (objc export (jni extern class), 1174/1175 (interplay diagnostics). ## Next step -**PART B — Phase 6.4 (migrate `library/modules/ffi/` `#foreign`→`extern`/`export`, -~50 sites).** Phase 6.1 (sqlite) + 6.2 (platform) + 6.3 (std) COMPLETE. +**PART B — Phase 7 (migrate `examples/` + `issues/` `#foreign`→`extern`/`export`).** +**PHASE 6 COMPLETE — `library/` is `#foreign`-free.** -- **Phase 6.4** (`refactor`, snapshot diff must be EMPTY): rewrite - `library/modules/ffi/` (objc/objc_block/raylib/sdl3/opengl/stb/…) `#foreign`→`extern`. - ⚠ Like platform (NOT std), `ffi/objc.sx` has Obj-C **runtime classes** — use the - postfix shape (`#objc_class("X") extern {` for imports, `… export {` for defined), - and check each site's shape per-file before bulk-replacing. Verify corpus coverage - per module: raylib/stb/sdl3 examples (15xx/12xx) compile on host → corpus validates; - any host-uncompiled module (check importers) needs an `sx ir` probe like 6.2. -- **Remaining Phase 6 batches:** 6.5 remaining `library/`+`vendors/` (math/, other - vendors, anything still holding `#foreign`). Then **Phase 7** migrates examples + - issues the same way. +- **Phase 7** (`refactor` batches, snapshot diff must be EMPTY per batch): migrate the + corpus + issue repros. Batches (PLAN-EXTERN-EXPORT Phase 7): 7.1 `examples/12xx-ffi-*` + (plain C), 7.2 `examples/13xx-ffi-objc-*`, 7.3 `examples/14xx-ffi-jni-*`, 7.4 + `issues/*` repros + stragglers. ⚠ Same shape rules as Phase 6: fn/global markers → + `extern …` (blanket keyword swap is safe for fn-only files); runtime classes → + postfix (`#objc_class/#jni_class("X") extern {` import, `… export {` defined). Check + each file's shapes first. Most examples ARE marker'd → the corpus validates the empty + snapshot diff directly; a non-empty diff ⇒ STOP and coalesce, don't regen. + - **Decision needed for 7.4:** the `issues/*.md` writeups contain `#foreign` in prose + repros — Decision 6 (historical carve-out, STILL OPEN) governs whether those get + migrated or kept as provenance. Migrate `issues/*.sx` repros (live tree); defer the + `.md` prose pending Decision 6. Also: some examples are diagnostic tests that + deliberately reference `#foreign` (e.g. 1174 foreign-postfix-conflict, 1620 lib-ref) + — those must KEEP `#foreign` until the Phase 8 cutover (they test the keyword's + behavior). Identify and exclude them from the 7.x bulk rename. - **6.2 verification note (carry forward):** the `platform/` runtime modules (uikit/android/android_jni) are NOT compiled by any marker'd host corpus test — verify future platform-adjacent migrations via direct `sx ir` on importers (1610/1606 compile @@ -333,6 +353,14 @@ Part A ratified (bare / postfix / `⇒ callconv(.c)` / lib-separate). Part B: deleted at cutover). Affects only diagnostic wording — IR/behavior identical either way. ## Log +- (6.5 gpu) **PHASE 6 COMPLETE.** Migrated `gpu/gles3.sx` + `gpu/metal.sx` (3 sites); + `library/` now `#foreign`-free (`grep -rln '#foreign' library/` → 0). Verified + byte-identical `sx ir` on importers 1610/1606. Suite green (647/444). `refactor` + `32a7628`. +- (6.4 ffi) Migrated `ffi/` objc/objc_block/raylib/sdl3/wasm (~51 sites): fn markers + + objc.sx's 2 import classes (prefix→postfix `extern`). objc/objc_block validated by 50 + marked 13xx examples; raylib/ffi-sdl3/wasm by `sx ir` probes pre/post. Empty snapshot + diff; suite green (647/444). `refactor` `666a2e2`. - (6.3 std) Migrated 11 `std/` modules (~60 sites): cli/core/fmt/fs/log/net.kqueue/ process/socket/thread/time/trace. All fn-decl markers (bare / `libc`|`tlib` LIB ref / `libc "csym"` rename) → `extern …` + 2 comment mentions; no class forms. Host-corpus-