| author | |
| committer | |
| log | fb192df4f2d12dda5019e14bf6cab2693432cb36 |
| tree | 4965e60a86a7d46b38f9618884153e5e6b0b5a2e |
| parent | 7580879e8bed9b0c670df110dbdaed76b2c3baf5 |
4 files changed, 102 insertions(+), 79 deletions(-)
lib/zig.h+7-11| ... | ... | @@ -130,22 +130,18 @@ typedef char bool; |
| 130 | 130 | #define zig_restrict |
| 131 | 131 | #endif |
| 132 | 132 | |
| 133 | #if __STDC_VERSION__ >= 201112L | |
| 134 | #define zig_align(alignment) _Alignas(alignment) | |
| 135 | #elif zig_has_attribute(aligned) | |
| 136 | #define zig_align(alignment) __attribute__((aligned(alignment))) | |
| 133 | #if zig_has_attribute(aligned) | |
| 134 | #define zig_under_align(alignment) __attribute__((aligned(alignment))) | |
| 137 | 135 | #elif _MSC_VER |
| 138 | #define zig_align(alignment) __declspec(align(alignment)) | |
| 136 | #define zig_under_align(alignment) __declspec(align(alignment)) | |
| 139 | 137 | #else |
| 140 | #define zig_align zig_align_unavailable | |
| 138 | #define zig_under_align zig_align_unavailable | |
| 141 | 139 | #endif |
| 142 | 140 | |
| 143 | #if zig_has_attribute(aligned) | |
| 144 | #define zig_under_align(alignment) __attribute__((aligned(alignment))) | |
| 145 | #elif _MSC_VER | |
| 146 | #define zig_under_align(alignment) zig_align(alignment) | |
| 141 | #if __STDC_VERSION__ >= 201112L | |
| 142 | #define zig_align(alignment) _Alignas(alignment) | |
| 147 | 143 | #else |
| 148 | #define zig_align zig_align_unavailable | |
| 144 | #define zig_align(alignment) zig_under_align(alignment) | |
| 149 | 145 | #endif |
| 150 | 146 | |
| 151 | 147 | #if zig_has_attribute(aligned) |
src/Sema.zig+5-2| ... | ... | @@ -36125,7 +36125,7 @@ fn resolveUnionLayout(sema: *Sema, ty: Type) CompileError!void { |
| 36125 | 36125 | // alignment is greater. |
| 36126 | 36126 | var size: u64 = 0; |
| 36127 | 36127 | var padding: u32 = 0; |
| 36128 | if (tag_align.compare(.gte, max_align)) { | |
| 36128 | if (tag_align.order(max_align).compare(.gte)) { | |
| 36129 | 36129 | // {Tag, Payload} |
| 36130 | 36130 | size += tag_size; |
| 36131 | 36131 | size = max_align.forward(size); |
| ... | ... | @@ -36136,7 +36136,10 @@ fn resolveUnionLayout(sema: *Sema, ty: Type) CompileError!void { |
| 36136 | 36136 | } else { |
| 36137 | 36137 | // {Payload, Tag} |
| 36138 | 36138 | size += max_size; |
| 36139 | size = tag_align.forward(size); | |
| 36139 | size = switch (mod.getTarget().ofmt) { | |
| 36140 | .c => max_align, | |
| 36141 | else => tag_align, | |
| 36142 | }.forward(size); | |
| 36140 | 36143 | size += tag_size; |
| 36141 | 36144 | const prev_size = size; |
| 36142 | 36145 | size = max_align.forward(size); |
src/codegen/c.zig+42-37| ... | ... | @@ -2475,14 +2475,20 @@ pub fn genTypeDecl( |
| 2475 | 2475 | .basic, .pointer, .array, .vector, .function => {}, |
| 2476 | 2476 | .aligned => |aligned_info| { |
| 2477 | 2477 | if (!found_existing) { |
| 2478 | try writer.writeAll("typedef "); | |
| 2479 | try writer.print("{}", .{ | |
| 2480 | try renderTypePrefix(pass, global_ctype_pool, zcu, writer, aligned_info.ctype, .suffix, .{}), | |
| 2481 | }); | |
| 2482 | try renderAlignedTypeName(writer, global_ctype); | |
| 2483 | try renderTypeSuffix(pass, global_ctype_pool, zcu, writer, aligned_info.ctype, .suffix, .{}); | |
| 2484 | 2478 | std.debug.assert(aligned_info.alignas.abiOrder().compare(.lt)); |
| 2485 | try writer.print(" zig_under_align({d});\n", .{aligned_info.alignas.toByteUnits()}); | |
| 2479 | try writer.print("typedef zig_under_align({d}) ", .{aligned_info.alignas.toByteUnits()}); | |
| 2480 | try writer.print("{}", .{try renderTypePrefix( | |
| 2481 | .flush, | |
| 2482 | global_ctype_pool, | |
| 2483 | zcu, | |
| 2484 | writer, | |
| 2485 | aligned_info.ctype, | |
| 2486 | .suffix, | |
| 2487 | .{}, | |
| 2488 | )}); | |
| 2489 | try renderAlignedTypeName(writer, global_ctype); | |
| 2490 | try renderTypeSuffix(.flush, global_ctype_pool, zcu, writer, aligned_info.ctype, .suffix, .{}); | |
| 2491 | try writer.writeAll(";\n"); | |
| 2486 | 2492 | } |
| 2487 | 2493 | switch (pass) { |
| 2488 | 2494 | .decl, .anon => { |
| ... | ... | @@ -5032,15 +5038,18 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5032 | 5038 | const result = result: { |
| 5033 | 5039 | const writer = f.object.writer(); |
| 5034 | 5040 | const inst_ty = f.typeOfIndex(inst); |
| 5035 | const local = if (inst_ty.hasRuntimeBitsIgnoreComptime(zcu)) local: { | |
| 5036 | const local = try f.allocLocal(inst, inst_ty); | |
| 5041 | const inst_local = if (inst_ty.hasRuntimeBitsIgnoreComptime(zcu)) local: { | |
| 5042 | const inst_local = try f.allocLocalValue(.{ | |
| 5043 | .ctype = try f.ctypeFromType(inst_ty, .complete), | |
| 5044 | .alignas = CType.AlignAs.fromAbiAlignment(inst_ty.abiAlignment(zcu)), | |
| 5045 | }); | |
| 5037 | 5046 | if (f.wantSafety()) { |
| 5038 | try f.writeCValue(writer, local, .Other); | |
| 5047 | try f.writeCValue(writer, inst_local, .Other); | |
| 5039 | 5048 | try writer.writeAll(" = "); |
| 5040 | 5049 | try f.writeCValue(writer, .{ .undef = inst_ty }, .Other); |
| 5041 | 5050 | try writer.writeAll(";\n"); |
| 5042 | 5051 | } |
| 5043 | break :local local; | |
| 5052 | break :local inst_local; | |
| 5044 | 5053 | } else .none; |
| 5045 | 5054 | |
| 5046 | 5055 | const locals_begin = @as(LocalIndex, @intCast(f.locals.items.len)); |
| ... | ... | @@ -5063,9 +5072,12 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5063 | 5072 | if (is_reg) { |
| 5064 | 5073 | const output_ty = if (output == .none) inst_ty else f.typeOf(output).childType(zcu); |
| 5065 | 5074 | try writer.writeAll("register "); |
| 5066 | const local_value = try f.allocLocal(inst, output_ty); | |
| 5067 | try f.allocs.put(gpa, local_value.new_local, false); | |
| 5068 | try f.object.dg.renderTypeAndName(writer, output_ty, local_value, .{}, .none, .complete); | |
| 5075 | const output_local = try f.allocLocalValue(.{ | |
| 5076 | .ctype = try f.ctypeFromType(output_ty, .complete), | |
| 5077 | .alignas = CType.AlignAs.fromAbiAlignment(output_ty.abiAlignment(zcu)), | |
| 5078 | }); | |
| 5079 | try f.allocs.put(gpa, output_local.new_local, false); | |
| 5080 | try f.object.dg.renderTypeAndName(writer, output_ty, output_local, .{}, .none, .complete); | |
| 5069 | 5081 | try writer.writeAll(" __asm(\""); |
| 5070 | 5082 | try writer.writeAll(constraint["={".len .. constraint.len - "}".len]); |
| 5071 | 5083 | try writer.writeAll("\")"); |
| ... | ... | @@ -5095,9 +5107,12 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5095 | 5107 | if (asmInputNeedsLocal(f, constraint, input_val)) { |
| 5096 | 5108 | const input_ty = f.typeOf(input); |
| 5097 | 5109 | if (is_reg) try writer.writeAll("register "); |
| 5098 | const local_value = try f.allocLocal(inst, input_ty); | |
| 5099 | try f.allocs.put(gpa, local_value.new_local, false); | |
| 5100 | try f.object.dg.renderTypeAndName(writer, input_ty, local_value, Const, .none, .complete); | |
| 5110 | const input_local = try f.allocLocalValue(.{ | |
| 5111 | .ctype = try f.ctypeFromType(input_ty, .complete), | |
| 5112 | .alignas = CType.AlignAs.fromAbiAlignment(input_ty.abiAlignment(zcu)), | |
| 5113 | }); | |
| 5114 | try f.allocs.put(gpa, input_local.new_local, false); | |
| 5115 | try f.object.dg.renderTypeAndName(writer, input_ty, input_local, Const, .none, .complete); | |
| 5101 | 5116 | if (is_reg) { |
| 5102 | 5117 | try writer.writeAll(" __asm(\""); |
| 5103 | 5118 | try writer.writeAll(constraint["{".len .. constraint.len - "}".len]); |
| ... | ... | @@ -5190,7 +5205,7 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5190 | 5205 | try f.writeCValue(writer, .{ .local = locals_index }, .Other); |
| 5191 | 5206 | locals_index += 1; |
| 5192 | 5207 | } else if (output == .none) { |
| 5193 | try f.writeCValue(writer, local, .FunctionArgument); | |
| 5208 | try f.writeCValue(writer, inst_local, .FunctionArgument); | |
| 5194 | 5209 | } else { |
| 5195 | 5210 | try f.writeCValueDeref(writer, try f.resolveInst(output)); |
| 5196 | 5211 | } |
| ... | ... | @@ -5246,7 +5261,7 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5246 | 5261 | const is_reg = constraint[1] == '{'; |
| 5247 | 5262 | if (is_reg) { |
| 5248 | 5263 | try f.writeCValueDeref(writer, if (output == .none) |
| 5249 | .{ .local_ref = local.new_local } | |
| 5264 | .{ .local_ref = inst_local.new_local } | |
| 5250 | 5265 | else |
| 5251 | 5266 | try f.resolveInst(output)); |
| 5252 | 5267 | try writer.writeAll(" = "); |
| ... | ... | @@ -5256,7 +5271,7 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5256 | 5271 | } |
| 5257 | 5272 | } |
| 5258 | 5273 | |
| 5259 | break :result if (f.liveness.isUnused(inst)) .none else local; | |
| 5274 | break :result if (f.liveness.isUnused(inst)) .none else inst_local; | |
| 5260 | 5275 | }; |
| 5261 | 5276 | |
| 5262 | 5277 | var bt = iterateBigTomb(f, inst); |
| ... | ... | @@ -6690,25 +6705,15 @@ fn airMemcpy(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6690 | 6705 | try writeSliceOrPtr(f, writer, src_ptr, src_ty); |
| 6691 | 6706 | try writer.writeAll(", "); |
| 6692 | 6707 | switch (dest_ty.ptrSize(zcu)) { |
| 6693 | .Slice => { | |
| 6694 | const elem_ty = dest_ty.childType(zcu); | |
| 6695 | const elem_abi_size = elem_ty.abiSize(zcu); | |
| 6696 | try f.writeCValueMember(writer, dest_ptr, .{ .identifier = "len" }); | |
| 6697 | if (elem_abi_size > 1) { | |
| 6698 | try writer.print(" * {d});\n", .{elem_abi_size}); | |
| 6699 | } else { | |
| 6700 | try writer.writeAll(");\n"); | |
| 6701 | } | |
| 6702 | }, | |
| 6703 | .One => { | |
| 6704 | const array_ty = dest_ty.childType(zcu); | |
| 6705 | const elem_ty = array_ty.childType(zcu); | |
| 6706 | const elem_abi_size = elem_ty.abiSize(zcu); | |
| 6707 | const len = array_ty.arrayLen(zcu) * elem_abi_size; | |
| 6708 | try writer.print("{d});\n", .{len}); | |
| 6709 | }, | |
| 6708 | .One => try writer.print("{}", .{ | |
| 6709 | try f.fmtIntLiteral(try zcu.intValue(Type.usize, dest_ty.childType(zcu).arrayLen(zcu))), | |
| 6710 | }), | |
| 6710 | 6711 | .Many, .C => unreachable, |
| 6712 | .Slice => try f.writeCValueMember(writer, dest_ptr, .{ .identifier = "len" }), | |
| 6711 | 6713 | } |
| 6714 | try writer.writeAll(" * sizeof("); | |
| 6715 | try f.renderType(writer, dest_ty.elemType2(zcu)); | |
| 6716 | try writer.writeAll("));\n"); | |
| 6712 | 6717 | |
| 6713 | 6718 | try reap(f, inst, &.{ bin_op.lhs, bin_op.rhs }); |
| 6714 | 6719 | return .none; |
src/codegen/c/Type.zig+48-29| ... | ... | @@ -734,6 +734,8 @@ pub const Info = union(enum) { |
| 734 | 734 | aggregate: Aggregate, |
| 735 | 735 | function: Function, |
| 736 | 736 | |
| 737 | const Tag = @typeInfo(Info).Union.tag_type.?; | |
| 738 | ||
| 737 | 739 | pub const Pointer = struct { |
| 738 | 740 | elem_ctype: CType, |
| 739 | 741 | @"const": bool = false, |
| ... | ... | @@ -761,7 +763,7 @@ pub const Info = union(enum) { |
| 761 | 763 | len: u64, |
| 762 | 764 | }; |
| 763 | 765 | |
| 764 | pub const Tag = enum { @"enum", @"struct", @"union" }; | |
| 766 | pub const AggregateTag = enum { @"enum", @"struct", @"union" }; | |
| 765 | 767 | |
| 766 | 768 | pub const Field = struct { |
| 767 | 769 | name: String, |
| ... | ... | @@ -820,7 +822,7 @@ pub const Info = union(enum) { |
| 820 | 822 | }; |
| 821 | 823 | |
| 822 | 824 | pub const FwdDecl = struct { |
| 823 | tag: Tag, | |
| 825 | tag: AggregateTag, | |
| 824 | 826 | name: union(enum) { |
| 825 | 827 | anon: Field.Slice, |
| 826 | 828 | owner_decl: DeclIndex, |
| ... | ... | @@ -828,7 +830,7 @@ pub const Info = union(enum) { |
| 828 | 830 | }; |
| 829 | 831 | |
| 830 | 832 | pub const Aggregate = struct { |
| 831 | tag: Tag, | |
| 833 | tag: AggregateTag, | |
| 832 | 834 | @"packed": bool = false, |
| 833 | 835 | name: union(enum) { |
| 834 | 836 | anon: struct { |
| ... | ... | @@ -853,9 +855,8 @@ pub const Info = union(enum) { |
| 853 | 855 | rhs_pool: *const Pool, |
| 854 | 856 | pool_adapter: anytype, |
| 855 | 857 | ) bool { |
| 856 | const InfoTag = @typeInfo(Info).Union.tag_type.?; | |
| 857 | 858 | const rhs_info = rhs_ctype.info(rhs_pool); |
| 858 | if (@as(InfoTag, lhs_info) != @as(InfoTag, rhs_info)) return false; | |
| 859 | if (@as(Info.Tag, lhs_info) != @as(Info.Tag, rhs_info)) return false; | |
| 859 | 860 | return switch (lhs_info) { |
| 860 | 861 | .basic => |lhs_basic_info| lhs_basic_info == rhs_info.basic, |
| 861 | 862 | .pointer => |lhs_pointer_info| lhs_pointer_info.@"const" == rhs_info.pointer.@"const" and |
| ... | ... | @@ -1012,7 +1013,7 @@ pub const Pool = struct { |
| 1012 | 1013 | pool: *Pool, |
| 1013 | 1014 | allocator: std.mem.Allocator, |
| 1014 | 1015 | fwd_decl_info: struct { |
| 1015 | tag: Info.Tag, | |
| 1016 | tag: Info.AggregateTag, | |
| 1016 | 1017 | name: union(enum) { |
| 1017 | 1018 | anon: []const Info.Field, |
| 1018 | 1019 | owner_decl: DeclIndex, |
| ... | ... | @@ -1070,7 +1071,7 @@ pub const Pool = struct { |
| 1070 | 1071 | pool: *Pool, |
| 1071 | 1072 | allocator: std.mem.Allocator, |
| 1072 | 1073 | aggregate_info: struct { |
| 1073 | tag: Info.Tag, | |
| 1074 | tag: Info.AggregateTag, | |
| 1074 | 1075 | @"packed": bool = false, |
| 1075 | 1076 | name: union(enum) { |
| 1076 | 1077 | anon: struct { |
| ... | ... | @@ -1175,7 +1176,7 @@ pub const Pool = struct { |
| 1175 | 1176 | pub fn fromFields( |
| 1176 | 1177 | pool: *Pool, |
| 1177 | 1178 | allocator: std.mem.Allocator, |
| 1178 | tag: Info.Tag, | |
| 1179 | tag: Info.AggregateTag, | |
| 1179 | 1180 | fields: []Info.Field, |
| 1180 | 1181 | kind: Kind, |
| 1181 | 1182 | ) !CType { |
| ... | ... | @@ -1390,8 +1391,8 @@ pub const Pool = struct { |
| 1390 | 1391 | else => |ip_index| switch (ip.indexToKey(ip_index)) { |
| 1391 | 1392 | .int_type => |int_info| return pool.fromIntInfo(allocator, int_info, mod, kind), |
| 1392 | 1393 | .ptr_type => |ptr_info| switch (ptr_info.flags.size) { |
| 1393 | .One, .Many, .C => return pool.getPointer(allocator, .{ | |
| 1394 | .elem_ctype = elem_ctype: { | |
| 1394 | .One, .Many, .C => { | |
| 1395 | const elem_ctype = elem_ctype: { | |
| 1395 | 1396 | if (ptr_info.packed_offset.host_size > 0 and |
| 1396 | 1397 | ptr_info.flags.vector_index == .none) |
| 1397 | 1398 | break :elem_ctype try pool.fromIntInfo(allocator, .{ |
| ... | ... | @@ -1412,13 +1413,31 @@ pub const Pool = struct { |
| 1412 | 1413 | .abi = Type.fromInterned(ptr_info.child).abiAlignment(zcu), |
| 1413 | 1414 | }), |
| 1414 | 1415 | }; |
| 1415 | if (elem.alignas.abiOrder().compare(.gte)) | |
| 1416 | break :elem_ctype elem.ctype; | |
| 1417 | break :elem_ctype try pool.getAligned(allocator, elem); | |
| 1418 | }, | |
| 1419 | .@"const" = ptr_info.flags.is_const, | |
| 1420 | .@"volatile" = ptr_info.flags.is_volatile, | |
| 1421 | }), | |
| 1416 | break :elem_ctype if (elem.alignas.abiOrder().compare(.gte)) | |
| 1417 | elem.ctype | |
| 1418 | else | |
| 1419 | try pool.getAligned(allocator, elem); | |
| 1420 | }; | |
| 1421 | const elem_tag: Info.Tag = switch (elem_ctype.info(pool)) { | |
| 1422 | .aligned => |aligned_info| aligned_info.ctype.info(pool), | |
| 1423 | else => |elem_tag| elem_tag, | |
| 1424 | }; | |
| 1425 | return pool.getPointer(allocator, .{ | |
| 1426 | .elem_ctype = elem_ctype, | |
| 1427 | .@"const" = switch (elem_tag) { | |
| 1428 | .basic, | |
| 1429 | .pointer, | |
| 1430 | .aligned, | |
| 1431 | .array, | |
| 1432 | .vector, | |
| 1433 | .fwd_decl, | |
| 1434 | .aggregate, | |
| 1435 | => ptr_info.flags.is_const, | |
| 1436 | .function => false, | |
| 1437 | }, | |
| 1438 | .@"volatile" = ptr_info.flags.is_volatile, | |
| 1439 | }); | |
| 1440 | }, | |
| 1422 | 1441 | .Slice => { |
| 1423 | 1442 | const target = &mod.resolved_target.result; |
| 1424 | 1443 | var fields = [_]Info.Field{ |
| ... | ... | @@ -1589,7 +1608,7 @@ pub const Pool = struct { |
| 1589 | 1608 | loaded_struct.field_types.len * @typeInfo(Field).Struct.fields.len, |
| 1590 | 1609 | ); |
| 1591 | 1610 | var hasher = Hasher.init; |
| 1592 | var tag: Tag = .aggregate_struct; | |
| 1611 | var tag: Pool.Tag = .aggregate_struct; | |
| 1593 | 1612 | var field_it = loaded_struct.iterateRuntimeOrder(ip); |
| 1594 | 1613 | while (field_it.next()) |field_index| { |
| 1595 | 1614 | const field_type = Type.fromInterned( |
| ... | ... | @@ -1729,7 +1748,7 @@ pub const Pool = struct { |
| 1729 | 1748 | loaded_union.field_types.len * @typeInfo(Field).Struct.fields.len, |
| 1730 | 1749 | ); |
| 1731 | 1750 | var hasher = Hasher.init; |
| 1732 | var tag: Tag = .aggregate_union; | |
| 1751 | var tag: Pool.Tag = .aggregate_union; | |
| 1733 | 1752 | var payload_align: Alignment = .@"1"; |
| 1734 | 1753 | for (0..loaded_union.field_types.len) |field_index| { |
| 1735 | 1754 | const field_type = Type.fromInterned( |
| ... | ... | @@ -2093,7 +2112,7 @@ pub const Pool = struct { |
| 2093 | 2112 | inline for (@typeInfo(Extra).Struct.fields) |field| { |
| 2094 | 2113 | const value = @field(extra, field.name); |
| 2095 | 2114 | hasher.update(switch (field.type) { |
| 2096 | Tag, String, CType => unreachable, | |
| 2115 | Pool.Tag, String, CType => unreachable, | |
| 2097 | 2116 | CType.Index => (CType{ .index = value }).hash(pool), |
| 2098 | 2117 | String.Index => (String{ .index = value }).slice(pool), |
| 2099 | 2118 | else => value, |
| ... | ... | @@ -2102,7 +2121,7 @@ pub const Pool = struct { |
| 2102 | 2121 | } |
| 2103 | 2122 | fn update(hasher: *Hasher, data: anytype) void { |
| 2104 | 2123 | switch (@TypeOf(data)) { |
| 2105 | Tag => @compileError("pass tag to final"), | |
| 2124 | Pool.Tag => @compileError("pass tag to final"), | |
| 2106 | 2125 | CType, CType.Index => @compileError("hash ctype.hash(pool) instead"), |
| 2107 | 2126 | String, String.Index => @compileError("hash string.slice(pool) instead"), |
| 2108 | 2127 | u32, DeclIndex, Aligned.Flags => hasher.impl.update(std.mem.asBytes(&data)), |
| ... | ... | @@ -2111,7 +2130,7 @@ pub const Pool = struct { |
| 2111 | 2130 | } |
| 2112 | 2131 | } |
| 2113 | 2132 | |
| 2114 | fn final(hasher: Hasher, tag: Tag) Map.Hash { | |
| 2133 | fn final(hasher: Hasher, tag: Pool.Tag) Map.Hash { | |
| 2115 | 2134 | var impl = hasher.impl; |
| 2116 | 2135 | impl.update(std.mem.asBytes(&tag)); |
| 2117 | 2136 | return @truncate(impl.final()); |
| ... | ... | @@ -2122,11 +2141,11 @@ pub const Pool = struct { |
| 2122 | 2141 | pool: *Pool, |
| 2123 | 2142 | allocator: std.mem.Allocator, |
| 2124 | 2143 | hasher: Hasher, |
| 2125 | tag: Tag, | |
| 2144 | tag: Pool.Tag, | |
| 2126 | 2145 | data: u32, |
| 2127 | 2146 | ) !CType { |
| 2128 | 2147 | try pool.ensureUnusedCapacity(allocator, 1); |
| 2129 | const Key = struct { hash: Map.Hash, tag: Tag, data: u32 }; | |
| 2148 | const Key = struct { hash: Map.Hash, tag: Pool.Tag, data: u32 }; | |
| 2130 | 2149 | const CTypeAdapter = struct { |
| 2131 | 2150 | pool: *const Pool, |
| 2132 | 2151 | pub fn hash(_: @This(), key: Key) Map.Hash { |
| ... | ... | @@ -2148,7 +2167,7 @@ pub const Pool = struct { |
| 2148 | 2167 | fn tagExtra( |
| 2149 | 2168 | pool: *Pool, |
| 2150 | 2169 | allocator: std.mem.Allocator, |
| 2151 | tag: Tag, | |
| 2170 | tag: Pool.Tag, | |
| 2152 | 2171 | comptime Extra: type, |
| 2153 | 2172 | extra: Extra, |
| 2154 | 2173 | ) !CType { |
| ... | ... | @@ -2166,7 +2185,7 @@ pub const Pool = struct { |
| 2166 | 2185 | pool: *Pool, |
| 2167 | 2186 | allocator: std.mem.Allocator, |
| 2168 | 2187 | hasher: Hasher, |
| 2169 | tag: Tag, | |
| 2188 | tag: Pool.Tag, | |
| 2170 | 2189 | extra_index: ExtraIndex, |
| 2171 | 2190 | ) !CType { |
| 2172 | 2191 | try pool.ensureUnusedCapacity(allocator, 1); |
| ... | ... | @@ -2176,10 +2195,10 @@ pub const Pool = struct { |
| 2176 | 2195 | fn tagTrailingExtraAssumeCapacity( |
| 2177 | 2196 | pool: *Pool, |
| 2178 | 2197 | hasher: Hasher, |
| 2179 | tag: Tag, | |
| 2198 | tag: Pool.Tag, | |
| 2180 | 2199 | extra_index: ExtraIndex, |
| 2181 | 2200 | ) CType { |
| 2182 | const Key = struct { hash: Map.Hash, tag: Tag, extra: []const u32 }; | |
| 2201 | const Key = struct { hash: Map.Hash, tag: Pool.Tag, extra: []const u32 }; | |
| 2183 | 2202 | const CTypeAdapter = struct { |
| 2184 | 2203 | pool: *const Pool, |
| 2185 | 2204 | pub fn hash(_: @This(), key: Key) Map.Hash { |
| ... | ... | @@ -2239,7 +2258,7 @@ pub const Pool = struct { |
| 2239 | 2258 | } |
| 2240 | 2259 | |
| 2241 | 2260 | const Item = struct { |
| 2242 | tag: Tag, | |
| 2261 | tag: Pool.Tag, | |
| 2243 | 2262 | data: u32, |
| 2244 | 2263 | }; |
| 2245 | 2264 |