From e5ba06b66cfb4f156022c0b7c5175353781ad011 Mon Sep 17 00:00:00 2001 From: agra Date: Tue, 26 May 2026 23:10:41 +0300 Subject: [PATCH] checkpoint: M4 complete (M4.0 + M4.A + M4.B all landed) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 12 commits this session shipped the entire M4 milestone. sx-defined Obj-C classes now honor `context.allocator` end-to-end, route through NSObject's retain/release at the source-language level, and emit correct ARC ops in property setters/getters/dealloc per the Apple ABI contract. 189/189 example tests pass; chess on iOS-sim green throughout. Ready for M5 (closure↔block bridge) or M1.1.b (Class(T) phantom typing) next session. --- current/CHECKPOINT-FFI.md | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/current/CHECKPOINT-FFI.md b/current/CHECKPOINT-FFI.md index 51c0ea0..d2774d8 100644 --- a/current/CHECKPOINT-FFI.md +++ b/current/CHECKPOINT-FFI.md @@ -260,13 +260,25 @@ plus 2 codegen fixes surfaced along the way.** - Smoke test [examples/ffi-objc-arc-01-autoreleasepool.sx](../examples/ffi-objc-arc-01-autoreleasepool.sx) exercises the retain/release + autoreleasepool round-trip. -**M4.B remaining** (compiler-internal property ARC ops; not yet -landed): -- `objcPropertyKind(field)` helper + `ensureArcRuntimeDecls`. -- Setter wiring strong/weak/copy ops. -- Getter via objc_loadWeakRetained for weak properties. -- Dealloc property-aware cleanup (release strong/copy, destroyWeak - weak) before freeing state struct. +**M4.B — property ARC ops** (4 commits, done): +- `objcPropertyKind(field)` + `ensureArcRuntimeDecls` helpers. The + kind helper validates `#property(...)` modifiers and emits loud + diagnostics for: unknown modifier names, conflicting modifiers, + weak/copy on non-object fields, `#property(strong)` on `*void`. +- Setter emits ARC ops per kind: strong → retain new + release old; + weak → `objc_storeWeak`; copy → `[val copy]` + release old; assign + → bare store. +- Getter weak path → `objc_loadWeakRetained` + `objc_autorelease` + for race-safe reads. Strong/copy/assign keep the bare load. +- Dealloc walks `#property` ivars BEFORE freeing the state struct: + release strong/copy ivars, destroyWeak weak ivars. Order: property + cleanup → state free → [super dealloc]. + +Smoke tests `ffi-objc-arc-02-strong-property` (TrackingAllocator +midpoint + balance) and `ffi-objc-arc-03-weak-property` (auto-nil +after target dealloc) both pass. + +189/189 example tests pass; chess on iOS-sim green throughout M4. **Previous-session wins still in this checkpoint:** - M4.0 / M4.A built on top of these earlier commits this session: