ios + ir cleanup

- ios: --target ios/ios-sim shorthands, iOS SDK auto-discovery,
  #framework directive + BuildOptions.add_framework hook,
  .app bundle + Info.plist + codesign (ad-hoc and real),
  --codesign-identity/--provisioning-profile/--entitlements flags,
  modules/std/{objc,uikit}.sx, dynamic class registration,
  typed objc_msgSend cast pattern, UIApplicationMain handoff,
  UIWindow scene attach. Runs on iPhone hardware.
- ir: silent .s64 defaults → loud diagnostics,
  resolveReturnType infers from body, sub-byte int sizes match LLVM,
  tuple type interning includes names, compile errors exit 1
- issue-NNNN convention: resolved bugs rename to focused features
- 50 regression tests passing
This commit is contained in:
agra
2026-05-17 13:19:08 +03:00
parent 69934592d8
commit 1c32d54e01
57 changed files with 978 additions and 106 deletions

View File

@@ -407,6 +407,15 @@ pub const TypeTable = struct {
/// Compute the ABI size in bytes for a type, matching LLVM's struct layout rules.
/// This is the authoritative size computation used for closure env sizing and
/// verified against LLVMABISizeOfType.
fn intAbiBytes(w: u16) usize {
// LLVM ABI size for iN: round w up to the next power of 2, then /8.
// Sub-byte widths (i1, i2, ..., i7) are 1 byte.
if (w <= 8) return 1;
if (w <= 16) return 2;
if (w <= 32) return 4;
return 8;
}
pub fn typeSizeBytes(self: *const TypeTable, ty: TypeId) usize {
const ptr_size: usize = self.pointer_size;
if (ty == .void) return 0;
@@ -494,6 +503,10 @@ pub const TypeTable = struct {
if (e.backing_type) |bt| return self.typeSizeBytes(bt);
return 8;
},
// LLVM rounds arbitrary-width integers up to the next power-of-2
// width before computing ABI size (i12 → 2 bytes, i24 → 4 bytes).
.signed => |w| intAbiBytes(w),
.unsigned => |w| intAbiBytes(w),
else => 8,
};
}
@@ -544,6 +557,8 @@ pub const TypeTable = struct {
}
break :blk max_a;
},
.signed => |w| intAbiBytes(w),
.unsigned => |w| intAbiBytes(w),
else => 8,
};
}
@@ -650,6 +665,7 @@ fn hashTypeInfo(h: *std.hash.Wyhash, info: TypeInfo) void {
.protocol => |p| h.update(std.mem.asBytes(&p.name)),
.tuple => |t| {
for (t.fields) |f| h.update(std.mem.asBytes(&f));
if (t.names) |ns| for (ns) |n| h.update(std.mem.asBytes(&n));
},
}
}
@@ -697,6 +713,12 @@ fn typeInfoEql(a: TypeInfo, b: TypeInfo) bool {
for (t.fields, u.fields) |tf, uf| {
if (tf != uf) return false;
}
if ((t.names == null) != (u.names == null)) return false;
if (t.names) |tn| {
const un = u.names.?;
if (tn.len != un.len) return false;
for (tn, un) |tna, una| if (tna != una) return false;
}
return true;
},
};