checkpoint: M4 complete (M4.0 + M4.A + M4.B all landed)
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.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user