| ... | ... | @@ -177,6 +177,35 @@ pub fn toSignedness(ctype: CType, s: std.builtin.Signedness) CType { |
| 177 | 177 | }; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | pub fn isAnyChar(ctype: CType) bool { |
| 181 | return switch (ctype.index) { |
| 182 | else => false, |
| 183 | .char, .@"signed char", .@"unsigned char", .uint8_t, .int8_t => true, |
| 184 | }; |
| 185 | } |
| 186 | |
| 187 | pub fn isString(ctype: CType, pool: *const Pool) bool { |
| 188 | return info: switch (ctype.info(pool)) { |
| 189 | .basic, .fwd_decl, .aggregate, .function => false, |
| 190 | .pointer => |pointer_info| pointer_info.elem_ctype.isAnyChar(), |
| 191 | .aligned => |aligned_info| continue :info aligned_info.ctype.info(pool), |
| 192 | .array, .vector => |sequence_info| sequence_info.elem_type.isAnyChar(), |
| 193 | }; |
| 194 | } |
| 195 | |
| 196 | pub fn isNonString(ctype: CType, pool: *const Pool) bool { |
| 197 | var allow_pointer = true; |
| 198 | return info: switch (ctype.info(pool)) { |
| 199 | .basic, .fwd_decl, .aggregate, .function => false, |
| 200 | .pointer => |pointer_info| allow_pointer and pointer_info.nonstring, |
| 201 | .aligned => |aligned_info| continue :info aligned_info.ctype.info(pool), |
| 202 | .array, .vector => |sequence_info| sequence_info.nonstring or { |
| 203 | allow_pointer = false; |
| 204 | continue :info sequence_info.elem_ctype.info(pool); |
| 205 | }, |
| 206 | }; |
| 207 | } |
| 208 | |
| 180 | 209 | pub fn getStandardDefineAbbrev(ctype: CType) ?[]const u8 { |
| 181 | 210 | return switch (ctype.index) { |
| 182 | 211 | .char => "CHAR", |
| ... | ... | @@ -427,6 +456,15 @@ pub fn info(ctype: CType, pool: *const Pool) Info { |
| 427 | 456 | .len = extra.len, |
| 428 | 457 | } }; |
| 429 | 458 | }, |
| 459 | .nonstring => { |
| 460 | var child_info = info(.{ .index = @enumFromInt(item.data) }, pool); |
| 461 | switch (child_info) { |
| 462 | else => unreachable, |
| 463 | .pointer => |*pointer_info| pointer_info.nonstring = true, |
| 464 | .array, .vector => |*sequence_info| sequence_info.nonstring = true, |
| 465 | } |
| 466 | return child_info; |
| 467 | }, |
| 430 | 468 | .fwd_decl_struct_anon => { |
| 431 | 469 | const extra_trail = pool.getExtraTrail(Pool.FwdDeclAnon, item.data); |
| 432 | 470 | return .{ .fwd_decl = .{ |
| ... | ... | @@ -601,10 +639,12 @@ fn toForward(ctype: CType, pool: *Pool, allocator: std.mem.Allocator) !CType { |
| 601 | 639 | .array => |array_info| pool.getArray(allocator, .{ |
| 602 | 640 | .elem_ctype = try array_info.elem_ctype.toForward(pool, allocator), |
| 603 | 641 | .len = array_info.len, |
| 642 | .nonstring = array_info.nonstring, |
| 604 | 643 | }), |
| 605 | 644 | .vector => |vector_info| pool.getVector(allocator, .{ |
| 606 | 645 | .elem_ctype = try vector_info.elem_ctype.toForward(pool, allocator), |
| 607 | 646 | .len = vector_info.len, |
| 647 | .nonstring = vector_info.nonstring, |
| 608 | 648 | }), |
| 609 | 649 | .aggregate => |aggregate_info| switch (aggregate_info.name) { |
| 610 | 650 | .anon => ctype, |
| ... | ... | @@ -754,6 +794,7 @@ pub const Info = union(enum) { |
| 754 | 794 | elem_ctype: CType, |
| 755 | 795 | @"const": bool = false, |
| 756 | 796 | @"volatile": bool = false, |
| 797 | nonstring: bool = false, |
| 757 | 798 | |
| 758 | 799 | fn tag(pointer_info: Pointer) Pool.Tag { |
| 759 | 800 | return @enumFromInt(@intFromEnum(Pool.Tag.pointer) + |
| ... | ... | @@ -775,6 +816,7 @@ pub const Info = union(enum) { |
| 775 | 816 | pub const Sequence = struct { |
| 776 | 817 | elem_ctype: CType, |
| 777 | 818 | len: u64, |
| 819 | nonstring: bool = false, |
| 778 | 820 | }; |
| 779 | 821 | |
| 780 | 822 | pub const AggregateTag = enum { @"enum", @"struct", @"union" }; |
| ... | ... | @@ -878,12 +920,15 @@ pub const Info = union(enum) { |
| 878 | 920 | .basic => |lhs_basic_info| lhs_basic_info == rhs_info.basic, |
| 879 | 921 | .pointer => |lhs_pointer_info| lhs_pointer_info.@"const" == rhs_info.pointer.@"const" and |
| 880 | 922 | lhs_pointer_info.@"volatile" == rhs_info.pointer.@"volatile" and |
| 923 | lhs_pointer_info.nonstring == rhs_info.pointer.nonstring and |
| 881 | 924 | pool_adapter.eql(lhs_pointer_info.elem_ctype, rhs_info.pointer.elem_ctype), |
| 882 | 925 | .aligned => |lhs_aligned_info| std.meta.eql(lhs_aligned_info.alignas, rhs_info.aligned.alignas) and |
| 883 | 926 | pool_adapter.eql(lhs_aligned_info.ctype, rhs_info.aligned.ctype), |
| 884 | 927 | .array => |lhs_array_info| lhs_array_info.len == rhs_info.array.len and |
| 928 | lhs_array_info.nonstring == rhs_info.array.nonstring and |
| 885 | 929 | pool_adapter.eql(lhs_array_info.elem_ctype, rhs_info.array.elem_ctype), |
| 886 | 930 | .vector => |lhs_vector_info| lhs_vector_info.len == rhs_info.vector.len and |
| 931 | lhs_vector_info.nonstring == rhs_info.vector.nonstring and |
| 887 | 932 | pool_adapter.eql(lhs_vector_info.elem_ctype, rhs_info.vector.elem_ctype), |
| 888 | 933 | .fwd_decl => |lhs_fwd_decl_info| lhs_fwd_decl_info.tag == rhs_info.fwd_decl.tag and |
| 889 | 934 | switch (lhs_fwd_decl_info.name) { |
| ... | ... | @@ -1063,12 +1108,12 @@ pub const Pool = struct { |
| 1063 | 1108 | pub fn getPointer(pool: *Pool, allocator: std.mem.Allocator, pointer_info: Info.Pointer) !CType { |
| 1064 | 1109 | var hasher = Hasher.init; |
| 1065 | 1110 | hasher.update(pointer_info.elem_ctype.hash(pool)); |
| 1066 | | return pool.tagData( |
| 1111 | return pool.getNonString(allocator, try pool.tagData( |
| 1067 | 1112 | allocator, |
| 1068 | 1113 | hasher, |
| 1069 | 1114 | pointer_info.tag(), |
| 1070 | 1115 | @intFromEnum(pointer_info.elem_ctype.index), |
| 1071 | | ); |
| 1116 | ), pointer_info.nonstring); |
| 1072 | 1117 | } |
| 1073 | 1118 | |
| 1074 | 1119 | pub fn getAligned(pool: *Pool, allocator: std.mem.Allocator, aligned_info: Info.Aligned) !CType { |
| ... | ... | @@ -1079,24 +1124,36 @@ pub const Pool = struct { |
| 1079 | 1124 | } |
| 1080 | 1125 | |
| 1081 | 1126 | pub fn getArray(pool: *Pool, allocator: std.mem.Allocator, array_info: Info.Sequence) !CType { |
| 1082 | | return if (std.math.cast(u32, array_info.len)) |small_len| |
| 1083 | | pool.tagExtra(allocator, .array_small, SequenceSmall, .{ |
| 1127 | return pool.getNonString(allocator, if (std.math.cast(u32, array_info.len)) |small_len| |
| 1128 | try pool.tagExtra(allocator, .array_small, SequenceSmall, .{ |
| 1084 | 1129 | .elem_ctype = array_info.elem_ctype.index, |
| 1085 | 1130 | .len = small_len, |
| 1086 | 1131 | }) |
| 1087 | 1132 | else |
| 1088 | | pool.tagExtra(allocator, .array_large, SequenceLarge, .{ |
| 1133 | try pool.tagExtra(allocator, .array_large, SequenceLarge, .{ |
| 1089 | 1134 | .elem_ctype = array_info.elem_ctype.index, |
| 1090 | 1135 | .len_lo = @truncate(array_info.len >> 0), |
| 1091 | 1136 | .len_hi = @truncate(array_info.len >> 32), |
| 1092 | | }); |
| 1137 | }), array_info.nonstring); |
| 1093 | 1138 | } |
| 1094 | 1139 | |
| 1095 | 1140 | pub fn getVector(pool: *Pool, allocator: std.mem.Allocator, vector_info: Info.Sequence) !CType { |
| 1096 | | return pool.tagExtra(allocator, .vector, SequenceSmall, .{ |
| 1141 | return pool.getNonString(allocator, try pool.tagExtra(allocator, .vector, SequenceSmall, .{ |
| 1097 | 1142 | .elem_ctype = vector_info.elem_ctype.index, |
| 1098 | 1143 | .len = @intCast(vector_info.len), |
| 1099 | | }); |
| 1144 | }), vector_info.nonstring); |
| 1145 | } |
| 1146 | |
| 1147 | pub fn getNonString( |
| 1148 | pool: *Pool, |
| 1149 | allocator: std.mem.Allocator, |
| 1150 | child_ctype: CType, |
| 1151 | nonstring: bool, |
| 1152 | ) !CType { |
| 1153 | if (!nonstring) return child_ctype; |
| 1154 | var hasher = Hasher.init; |
| 1155 | hasher.update(child_ctype.hash(pool)); |
| 1156 | return pool.tagData(allocator, hasher, .nonstring, @intFromEnum(child_ctype.index)); |
| 1100 | 1157 | } |
| 1101 | 1158 | |
| 1102 | 1159 | pub fn getFwdDecl( |
| ... | ... | @@ -1314,12 +1371,14 @@ pub const Pool = struct { |
| 1314 | 1371 | else => { |
| 1315 | 1372 | const target = &mod.resolved_target.result; |
| 1316 | 1373 | const abi_align_bytes = std.zig.target.intAlignment(target, int_info.bits); |
| 1374 | const limb_ctype = try pool.fromIntInfo(allocator, .{ |
| 1375 | .signedness = .unsigned, |
| 1376 | .bits = @intCast(abi_align_bytes * 8), |
| 1377 | }, mod, kind.noParameter()); |
| 1317 | 1378 | const array_ctype = try pool.getArray(allocator, .{ |
| 1318 | 1379 | .len = @divExact(std.zig.target.intByteSize(target, int_info.bits), abi_align_bytes), |
| 1319 | | .elem_ctype = try pool.fromIntInfo(allocator, .{ |
| 1320 | | .signedness = .unsigned, |
| 1321 | | .bits = @intCast(abi_align_bytes * 8), |
| 1322 | | }, mod, kind.noParameter()), |
| 1380 | .elem_ctype = limb_ctype, |
| 1381 | .nonstring = limb_ctype.isAnyChar(), |
| 1323 | 1382 | }); |
| 1324 | 1383 | if (!kind.isParameter()) return array_ctype; |
| 1325 | 1384 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1402,28 +1461,49 @@ pub const Pool = struct { |
| 1402 | 1461 | .bits = pt.zcu.errorSetBits(), |
| 1403 | 1462 | }, mod, kind), |
| 1404 | 1463 | |
| 1405 | | .ptr_usize_type, |
| 1406 | | => return pool.getPointer(allocator, .{ |
| 1464 | .ptr_usize_type => return pool.getPointer(allocator, .{ |
| 1407 | 1465 | .elem_ctype = .usize, |
| 1408 | 1466 | }), |
| 1409 | | .ptr_const_comptime_int_type, |
| 1410 | | => return pool.getPointer(allocator, .{ |
| 1467 | .ptr_const_comptime_int_type => return pool.getPointer(allocator, .{ |
| 1411 | 1468 | .elem_ctype = .void, |
| 1412 | 1469 | .@"const" = true, |
| 1413 | 1470 | }), |
| 1414 | | .manyptr_u8_type, |
| 1415 | | => return pool.getPointer(allocator, .{ |
| 1471 | .manyptr_u8_type => return pool.getPointer(allocator, .{ |
| 1416 | 1472 | .elem_ctype = .u8, |
| 1473 | .nonstring = true, |
| 1417 | 1474 | }), |
| 1418 | | .manyptr_const_u8_type, |
| 1419 | | .manyptr_const_u8_sentinel_0_type, |
| 1420 | | => return pool.getPointer(allocator, .{ |
| 1475 | .manyptr_const_u8_type => return pool.getPointer(allocator, .{ |
| 1421 | 1476 | .elem_ctype = .u8, |
| 1422 | 1477 | .@"const" = true, |
| 1478 | .nonstring = true, |
| 1423 | 1479 | }), |
| 1424 | | .slice_const_u8_type, |
| 1425 | | .slice_const_u8_sentinel_0_type, |
| 1426 | | => { |
| 1480 | .manyptr_const_u8_sentinel_0_type => return pool.getPointer(allocator, .{ |
| 1481 | .elem_ctype = .u8, |
| 1482 | .@"const" = true, |
| 1483 | }), |
| 1484 | .slice_const_u8_type => { |
| 1485 | const target = &mod.resolved_target.result; |
| 1486 | var fields = [_]Info.Field{ |
| 1487 | .{ |
| 1488 | .name = .{ .index = .ptr }, |
| 1489 | .ctype = try pool.getPointer(allocator, .{ |
| 1490 | .elem_ctype = .u8, |
| 1491 | .@"const" = true, |
| 1492 | .nonstring = true, |
| 1493 | }), |
| 1494 | .alignas = AlignAs.fromAbiAlignment(Type.ptrAbiAlignment(target)), |
| 1495 | }, |
| 1496 | .{ |
| 1497 | .name = .{ .index = .len }, |
| 1498 | .ctype = .usize, |
| 1499 | .alignas = AlignAs.fromAbiAlignment( |
| 1500 | .fromByteUnits(std.zig.target.intAlignment(target, target.ptrBitWidth())), |
| 1501 | ), |
| 1502 | }, |
| 1503 | }; |
| 1504 | return pool.fromFields(allocator, .@"struct", &fields, kind); |
| 1505 | }, |
| 1506 | .slice_const_u8_sentinel_0_type => { |
| 1427 | 1507 | const target = &mod.resolved_target.result; |
| 1428 | 1508 | var fields = [_]Info.Field{ |
| 1429 | 1509 | .{ |
| ... | ... | @@ -1449,6 +1529,7 @@ pub const Pool = struct { |
| 1449 | 1529 | const vector_ctype = try pool.getVector(allocator, .{ |
| 1450 | 1530 | .elem_ctype = .i8, |
| 1451 | 1531 | .len = 8, |
| 1532 | .nonstring = true, |
| 1452 | 1533 | }); |
| 1453 | 1534 | if (!kind.isParameter()) return vector_ctype; |
| 1454 | 1535 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1464,6 +1545,7 @@ pub const Pool = struct { |
| 1464 | 1545 | const vector_ctype = try pool.getVector(allocator, .{ |
| 1465 | 1546 | .elem_ctype = .i8, |
| 1466 | 1547 | .len = 16, |
| 1548 | .nonstring = true, |
| 1467 | 1549 | }); |
| 1468 | 1550 | if (!kind.isParameter()) return vector_ctype; |
| 1469 | 1551 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1479,6 +1561,7 @@ pub const Pool = struct { |
| 1479 | 1561 | const vector_ctype = try pool.getVector(allocator, .{ |
| 1480 | 1562 | .elem_ctype = .i8, |
| 1481 | 1563 | .len = 32, |
| 1564 | .nonstring = true, |
| 1482 | 1565 | }); |
| 1483 | 1566 | if (!kind.isParameter()) return vector_ctype; |
| 1484 | 1567 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1494,6 +1577,7 @@ pub const Pool = struct { |
| 1494 | 1577 | const vector_ctype = try pool.getVector(allocator, .{ |
| 1495 | 1578 | .elem_ctype = .i8, |
| 1496 | 1579 | .len = 64, |
| 1580 | .nonstring = true, |
| 1497 | 1581 | }); |
| 1498 | 1582 | if (!kind.isParameter()) return vector_ctype; |
| 1499 | 1583 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1509,6 +1593,7 @@ pub const Pool = struct { |
| 1509 | 1593 | const vector_ctype = try pool.getVector(allocator, .{ |
| 1510 | 1594 | .elem_ctype = .u8, |
| 1511 | 1595 | .len = 1, |
| 1596 | .nonstring = true, |
| 1512 | 1597 | }); |
| 1513 | 1598 | if (!kind.isParameter()) return vector_ctype; |
| 1514 | 1599 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1524,6 +1609,7 @@ pub const Pool = struct { |
| 1524 | 1609 | const vector_ctype = try pool.getVector(allocator, .{ |
| 1525 | 1610 | .elem_ctype = .u8, |
| 1526 | 1611 | .len = 2, |
| 1612 | .nonstring = true, |
| 1527 | 1613 | }); |
| 1528 | 1614 | if (!kind.isParameter()) return vector_ctype; |
| 1529 | 1615 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1539,6 +1625,7 @@ pub const Pool = struct { |
| 1539 | 1625 | const vector_ctype = try pool.getVector(allocator, .{ |
| 1540 | 1626 | .elem_ctype = .u8, |
| 1541 | 1627 | .len = 4, |
| 1628 | .nonstring = true, |
| 1542 | 1629 | }); |
| 1543 | 1630 | if (!kind.isParameter()) return vector_ctype; |
| 1544 | 1631 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1554,6 +1641,7 @@ pub const Pool = struct { |
| 1554 | 1641 | const vector_ctype = try pool.getVector(allocator, .{ |
| 1555 | 1642 | .elem_ctype = .u8, |
| 1556 | 1643 | .len = 8, |
| 1644 | .nonstring = true, |
| 1557 | 1645 | }); |
| 1558 | 1646 | if (!kind.isParameter()) return vector_ctype; |
| 1559 | 1647 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1569,6 +1657,7 @@ pub const Pool = struct { |
| 1569 | 1657 | const vector_ctype = try pool.getVector(allocator, .{ |
| 1570 | 1658 | .elem_ctype = .u8, |
| 1571 | 1659 | .len = 16, |
| 1660 | .nonstring = true, |
| 1572 | 1661 | }); |
| 1573 | 1662 | if (!kind.isParameter()) return vector_ctype; |
| 1574 | 1663 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1584,6 +1673,7 @@ pub const Pool = struct { |
| 1584 | 1673 | const vector_ctype = try pool.getVector(allocator, .{ |
| 1585 | 1674 | .elem_ctype = .u8, |
| 1586 | 1675 | .len = 32, |
| 1676 | .nonstring = true, |
| 1587 | 1677 | }); |
| 1588 | 1678 | if (!kind.isParameter()) return vector_ctype; |
| 1589 | 1679 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1599,6 +1689,7 @@ pub const Pool = struct { |
| 1599 | 1689 | const vector_ctype = try pool.getVector(allocator, .{ |
| 1600 | 1690 | .elem_ctype = .u8, |
| 1601 | 1691 | .len = 64, |
| 1692 | .nonstring = true, |
| 1602 | 1693 | }); |
| 1603 | 1694 | if (!kind.isParameter()) return vector_ctype; |
| 1604 | 1695 | var fields = [_]Info.Field{ |
| ... | ... | @@ -2225,6 +2316,11 @@ pub const Pool = struct { |
| 2225 | 2316 | .function => false, |
| 2226 | 2317 | }, |
| 2227 | 2318 | .@"volatile" = ptr_info.flags.is_volatile, |
| 2319 | .nonstring = elem_ctype.isAnyChar() and switch (ptr_info.sentinel) { |
| 2320 | .none => true, |
| 2321 | .zero_u8 => false, |
| 2322 | else => |sentinel| Value.fromInterned(sentinel).orderAgainstZero(zcu).compare(.neq), |
| 2323 | }, |
| 2228 | 2324 | }); |
| 2229 | 2325 | }, |
| 2230 | 2326 | .slice => { |
| ... | ... | @@ -2269,6 +2365,11 @@ pub const Pool = struct { |
| 2269 | 2365 | const array_ctype = try pool.getArray(allocator, .{ |
| 2270 | 2366 | .elem_ctype = elem_ctype, |
| 2271 | 2367 | .len = len, |
| 2368 | .nonstring = elem_ctype.isAnyChar() and switch (array_info.sentinel) { |
| 2369 | .none => true, |
| 2370 | .zero_u8 => false, |
| 2371 | else => |sentinel| Value.fromInterned(sentinel).orderAgainstZero(zcu).compare(.neq), |
| 2372 | }, |
| 2272 | 2373 | }); |
| 2273 | 2374 | if (!kind.isParameter()) return array_ctype; |
| 2274 | 2375 | var fields = [_]Info.Field{ |
| ... | ... | @@ -2295,6 +2396,7 @@ pub const Pool = struct { |
| 2295 | 2396 | const vector_ctype = try pool.getVector(allocator, .{ |
| 2296 | 2397 | .elem_ctype = elem_ctype, |
| 2297 | 2398 | .len = vector_info.len, |
| 2399 | .nonstring = elem_ctype.isAnyChar(), |
| 2298 | 2400 | }); |
| 2299 | 2401 | if (!kind.isParameter()) return vector_ctype; |
| 2300 | 2402 | var fields = [_]Info.Field{ |
| ... | ... | @@ -2773,9 +2875,17 @@ pub const Pool = struct { |
| 2773 | 2875 | const ctype: CType = .fromPoolIndex(gop.index); |
| 2774 | 2876 | if (!gop.found_existing) switch (source_info) { |
| 2775 | 2877 | .basic => unreachable, |
| 2776 | | .pointer => |pointer_info| pool.items.appendAssumeCapacity(.{ |
| 2777 | | .tag = tag, |
| 2778 | | .data = @intFromEnum(pool_adapter.copy(pointer_info.elem_ctype).index), |
| 2878 | .pointer => |pointer_info| pool.items.appendAssumeCapacity(switch (pointer_info.nonstring) { |
| 2879 | false => .{ |
| 2880 | .tag = tag, |
| 2881 | .data = @intFromEnum(pool_adapter.copy(pointer_info.elem_ctype).index), |
| 2882 | }, |
| 2883 | true => .{ |
| 2884 | .tag = .nonstring, |
| 2885 | .data = @intFromEnum(pool_adapter.copy(.{ .index = @enumFromInt( |
| 2886 | source_pool.items.items(.data)[source_ctype.toPoolIndex().?], |
| 2887 | ) }).index), |
| 2888 | }, |
| 2779 | 2889 | }), |
| 2780 | 2890 | .aligned => |aligned_info| pool.items.appendAssumeCapacity(.{ |
| 2781 | 2891 | .tag = tag, |
| ... | ... | @@ -2784,19 +2894,27 @@ pub const Pool = struct { |
| 2784 | 2894 | .flags = .{ .alignas = aligned_info.alignas }, |
| 2785 | 2895 | }, 0), |
| 2786 | 2896 | }), |
| 2787 | | .array, .vector => |sequence_info| pool.items.appendAssumeCapacity(.{ |
| 2788 | | .tag = tag, |
| 2789 | | .data = switch (tag) { |
| 2790 | | .array_small, .vector => try pool.addExtra(allocator, SequenceSmall, .{ |
| 2791 | | .elem_ctype = pool_adapter.copy(sequence_info.elem_ctype).index, |
| 2792 | | .len = @intCast(sequence_info.len), |
| 2793 | | }, 0), |
| 2794 | | .array_large => try pool.addExtra(allocator, SequenceLarge, .{ |
| 2795 | | .elem_ctype = pool_adapter.copy(sequence_info.elem_ctype).index, |
| 2796 | | .len_lo = @truncate(sequence_info.len >> 0), |
| 2797 | | .len_hi = @truncate(sequence_info.len >> 32), |
| 2798 | | }, 0), |
| 2799 | | else => unreachable, |
| 2897 | .array, .vector => |sequence_info| pool.items.appendAssumeCapacity(switch (sequence_info.nonstring) { |
| 2898 | false => .{ |
| 2899 | .tag = tag, |
| 2900 | .data = switch (tag) { |
| 2901 | .array_small, .vector => try pool.addExtra(allocator, SequenceSmall, .{ |
| 2902 | .elem_ctype = pool_adapter.copy(sequence_info.elem_ctype).index, |
| 2903 | .len = @intCast(sequence_info.len), |
| 2904 | }, 0), |
| 2905 | .array_large => try pool.addExtra(allocator, SequenceLarge, .{ |
| 2906 | .elem_ctype = pool_adapter.copy(sequence_info.elem_ctype).index, |
| 2907 | .len_lo = @truncate(sequence_info.len >> 0), |
| 2908 | .len_hi = @truncate(sequence_info.len >> 32), |
| 2909 | }, 0), |
| 2910 | else => unreachable, |
| 2911 | }, |
| 2912 | }, |
| 2913 | true => .{ |
| 2914 | .tag = .nonstring, |
| 2915 | .data = @intFromEnum(pool_adapter.copy(.{ .index = @enumFromInt( |
| 2916 | source_pool.items.items(.data)[source_ctype.toPoolIndex().?], |
| 2917 | ) }).index), |
| 2800 | 2918 | }, |
| 2801 | 2919 | }), |
| 2802 | 2920 | .fwd_decl => |fwd_decl_info| switch (fwd_decl_info.name) { |
| ... | ... | @@ -3068,6 +3186,7 @@ pub const Pool = struct { |
| 3068 | 3186 | array_small, |
| 3069 | 3187 | array_large, |
| 3070 | 3188 | vector, |
| 3189 | nonstring, |
| 3071 | 3190 | fwd_decl_struct_anon, |
| 3072 | 3191 | fwd_decl_union_anon, |
| 3073 | 3192 | fwd_decl_struct, |
| ... | ... | @@ -3283,4 +3402,5 @@ const CType = @This(); |
| 3283 | 3402 | const InternPool = @import("../../InternPool.zig"); |
| 3284 | 3403 | const Module = @import("../../Package/Module.zig"); |
| 3285 | 3404 | const Type = @import("../../Type.zig"); |
| 3405 | const Value = @import("../../Value.zig"); |
| 3286 | 3406 | const Zcu = @import("../../Zcu.zig"); |