State struct for an sx-defined `#objc_class` now leads with an Allocator field at index 0 — captured at +alloc time, read by -dealloc to free the state through the same allocator. User fields shift to index 1+; the existing by-name lookups in emitObjcDefinedClassPropertyImps + lookupObjcDefinedStateFieldOnPointer naturally resolve them at the new indices. This step is the layout change only; the +alloc IMP still mallocs (M4.0b will rewrite it to thread context.allocator through), and -dealloc still uses free() (M4.0c). The field is allocated but uninitialised; nobody reads it yet. Storage type comes from `Context.fields[0].ty` via the new `objcStateAllocatorType` helper — same Allocator value-shape the implicit context machinery has used all along. If Context isn't registered (early-init paths), the helper falls back to omitting the field rather than synthesising a half-broken layout. IR snapshot for 142-objc-class-method-lowering updated to reflect the new struct shape and the +24-byte state allocation. Chess on iOS-sim green; 184/184 example tests pass.
627 KiB
627 KiB