| ... | @@ -817,8 +817,10 @@ pub const CType = extern union { | ... | @@ -817,8 +817,10 @@ pub const CType = extern union { |
| 817 | .Struct, .Union => |zig_tag| if (ty.isTupleOrAnonStruct()) { | 817 | .Struct, .Union => |zig_tag| if (ty.isTupleOrAnonStruct()) { |
| 818 | if (lookup.isMutable()) { | 818 | if (lookup.isMutable()) { |
| 819 | for (0..ty.structFieldCount()) |field_i| { | 819 | for (0..ty.structFieldCount()) |field_i| { |
| 820 | if (ty.structFieldIsComptime(field_i)) continue; | 820 | const field_ty = ty.structFieldType(field_i); |
| 821 | _ = try lookup.typeToIndex(ty.structFieldType(field_i), switch (kind) { | 821 | if (ty.structFieldIsComptime(field_i) or |
| | 822 | !field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| | 823 | _ = try lookup.typeToIndex(field_ty, switch (kind) { |
| 822 | .forward, .complete, .parameter => .complete, | 824 | .forward, .complete, .parameter => .complete, |
| 823 | .global => .global, | 825 | .global => .global, |
| 824 | }); | 826 | }); |
| ... | @@ -842,16 +844,13 @@ pub const CType = extern union { | ... | @@ -842,16 +844,13 @@ pub const CType = extern union { |
| 842 | .Union => ty.cast(Type.Payload.Union).?.data.fields.count(), | 844 | .Union => ty.cast(Type.Payload.Union).?.data.fields.count(), |
| 843 | else => unreachable, | 845 | else => unreachable, |
| 844 | }) |field_i| { | 846 | }) |field_i| { |
| 845 | if (zig_tag == .Struct and ty.structFieldIsComptime(field_i)) | 847 | const field_ty = ty.structFieldType(field_i); |
| 846 | continue; | 848 | if (!field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 847 | _ = try lookup.typeToIndex( | 849 | _ = try lookup.typeToIndex(field_ty, switch (kind) { |
| 848 | ty.structFieldType(field_i), | 850 | .forward => unreachable, |
| 849 | switch (kind) { | 851 | .complete, .parameter => .complete, |
| 850 | .forward => unreachable, | 852 | .global => .global, |
| 851 | .complete, .parameter => .complete, | 853 | }); |
| 852 | .global => .global, | | |
| 853 | }, | | |
| 854 | ); | | |
| 855 | } | 854 | } |
| 856 | _ = try lookup.typeToIndex(ty, .forward); | 855 | _ = try lookup.typeToIndex(ty, .forward); |
| 857 | } | 856 | } |
| ... | @@ -953,9 +952,9 @@ pub const CType = extern union { | ... | @@ -953,9 +952,9 @@ pub const CType = extern union { |
| 953 | .forward => .forward, | 952 | .forward => .forward, |
| 954 | .complete, .parameter, .global => .complete, | 953 | .complete, .parameter, .global => .complete, |
| 955 | }); | 954 | }); |
| 956 | for (info.param_types, 0..) |param_ty, param_i| { | 955 | for (info.param_types) |param_type| { |
| 957 | if (info.paramIsComptime(param_i)) continue; | 956 | if (!param_type.hasRuntimeBitsIgnoreComptime()) continue; |
| 958 | _ = try lookup.typeToIndex(param_ty, switch (kind) { | 957 | _ = try lookup.typeToIndex(param_type, switch (kind) { |
| 959 | .forward => .forward, | 958 | .forward => .forward, |
| 960 | .complete, .parameter, .global => unreachable, | 959 | .complete, .parameter, .global => unreachable, |
| 961 | }); | 960 | }); |
| ... | @@ -1118,28 +1117,28 @@ pub const CType = extern union { | ... | @@ -1118,28 +1117,28 @@ pub const CType = extern union { |
| 1118 | | 1117 | |
| 1119 | var c_fields_len: usize = 0; | 1118 | var c_fields_len: usize = 0; |
| 1120 | for (0..fields_len) |field_i| { | 1119 | for (0..fields_len) |field_i| { |
| 1121 | if (ty.structFieldIsComptime(field_i)) continue; | 1120 | const field_ty = ty.structFieldType(field_i); |
| | 1121 | if (ty.structFieldIsComptime(field_i) or |
| | 1122 | !field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 1122 | c_fields_len += 1; | 1123 | c_fields_len += 1; |
| 1123 | } | 1124 | } |
| 1124 | | 1125 | |
| 1125 | const fields_pl = try arena.alloc(Payload.Fields.Field, c_fields_len); | 1126 | const fields_pl = try arena.alloc(Payload.Fields.Field, c_fields_len); |
| 1126 | var c_field_i: usize = 0; | 1127 | var c_field_i: usize = 0; |
| 1127 | for (0..fields_len) |field_i| { | 1128 | for (0..fields_len) |field_i| { |
| 1128 | if (ty.structFieldIsComptime(field_i)) continue; | 1129 | const field_ty = ty.structFieldType(field_i); |
| | 1130 | if (ty.structFieldIsComptime(field_i) or |
| | 1131 | !field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 1129 | | 1132 | |
| 1130 | fields_pl[c_field_i] = .{ | 1133 | fields_pl[c_field_i] = .{ |
| 1131 | .name = try if (ty.isSimpleTuple()) | 1134 | .name = try if (ty.isSimpleTuple()) |
| 1132 | std.fmt.allocPrintZ(arena, "f{}", .{field_i}) | 1135 | std.fmt.allocPrintZ(arena, "f{}", .{field_i}) |
| 1133 | else | 1136 | else |
| 1134 | arena.dupeZ(u8, ty.structFieldName(field_i)), | 1137 | arena.dupeZ(u8, ty.structFieldName(field_i)), |
| 1135 | .type = store.set.typeToIndex( | 1138 | .type = store.set.typeToIndex(field_ty, target, switch (kind) { |
| 1136 | ty.structFieldType(field_i), | 1139 | .forward, .complete, .parameter => .complete, |
| 1137 | target, | 1140 | .global => .global, |
| 1138 | switch (kind) { | 1141 | }).?, |
| 1139 | .forward, .complete, .parameter => .complete, | | |
| 1140 | .global => .global, | | |
| 1141 | }, | | |
| 1142 | ).?, | | |
| 1143 | .alignas = ty.structFieldAlign(field_i, target), | 1142 | .alignas = ty.structFieldAlign(field_i, target), |
| 1144 | }; | 1143 | }; |
| 1145 | c_field_i += 1; | 1144 | c_field_i += 1; |
| ... | @@ -1211,16 +1210,16 @@ pub const CType = extern union { | ... | @@ -1211,16 +1210,16 @@ pub const CType = extern union { |
| 1211 | }; | 1210 | }; |
| 1212 | | 1211 | |
| 1213 | var c_params_len: usize = 0; | 1212 | var c_params_len: usize = 0; |
| 1214 | for (0..info.param_types.len) |param_i| { | 1213 | for (info.param_types) |param_type| { |
| 1215 | if (info.paramIsComptime(param_i)) continue; | 1214 | if (!param_type.hasRuntimeBitsIgnoreComptime()) continue; |
| 1216 | c_params_len += 1; | 1215 | c_params_len += 1; |
| 1217 | } | 1216 | } |
| 1218 | | 1217 | |
| 1219 | const params_pl = try arena.alloc(Index, c_params_len); | 1218 | const params_pl = try arena.alloc(Index, c_params_len); |
| 1220 | var c_param_i: usize = 0; | 1219 | var c_param_i: usize = 0; |
| 1221 | for (info.param_types, 0..) |param_ty, param_i| { | 1220 | for (info.param_types) |param_type| { |
| 1222 | if (info.paramIsComptime(param_i)) continue; | 1221 | if (!param_type.hasRuntimeBitsIgnoreComptime()) continue; |
| 1223 | params_pl[c_param_i] = store.set.typeToIndex(param_ty, target, recurse_kind).?; | 1222 | params_pl[c_param_i] = store.set.typeToIndex(param_type, target, recurse_kind).?; |
| 1224 | c_param_i += 1; | 1223 | c_param_i += 1; |
| 1225 | } | 1224 | } |
| 1226 | | 1225 | |
| ... | @@ -1294,7 +1293,9 @@ pub const CType = extern union { | ... | @@ -1294,7 +1293,9 @@ pub const CType = extern union { |
| 1294 | | 1293 | |
| 1295 | var c_field_i: usize = 0; | 1294 | var c_field_i: usize = 0; |
| 1296 | for (0..ty.structFieldCount()) |field_i| { | 1295 | for (0..ty.structFieldCount()) |field_i| { |
| 1297 | if (ty.structFieldIsComptime(field_i)) continue; | 1296 | const field_ty = ty.structFieldType(field_i); |
| | 1297 | if (ty.structFieldIsComptime(field_i) or |
| | 1298 | !field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 1298 | | 1299 | |
| 1299 | const c_field = &c_fields[c_field_i]; | 1300 | const c_field = &c_fields[c_field_i]; |
| 1300 | c_field_i += 1; | 1301 | c_field_i += 1; |
| ... | @@ -1344,10 +1345,9 @@ pub const CType = extern union { | ... | @@ -1344,10 +1345,9 @@ pub const CType = extern union { |
| 1344 | if (info.param_types.len != data.param_types.len or | 1345 | if (info.param_types.len != data.param_types.len or |
| 1345 | !self.eqlRecurse(info.return_type, data.return_type, recurse_kind)) | 1346 | !self.eqlRecurse(info.return_type, data.return_type, recurse_kind)) |
| 1346 | return false; | 1347 | return false; |
| 1347 | for (info.param_types, data.param_types, 0..) |param_ty, param_cty, param_i| { | 1348 | for (info.param_types, data.param_types) |param_ty, param_cty| { |
| 1348 | if (info.paramIsComptime(param_i)) continue; | 1349 | if (!param_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 1349 | if (!self.eqlRecurse(param_ty, param_cty, recurse_kind)) | 1350 | if (!self.eqlRecurse(param_ty, param_cty, recurse_kind)) return false; |
| 1350 | return false; | | |
| 1351 | } | 1351 | } |
| 1352 | return true; | 1352 | return true; |
| 1353 | }, | 1353 | }, |
| ... | @@ -1389,7 +1389,9 @@ pub const CType = extern union { | ... | @@ -1389,7 +1389,9 @@ pub const CType = extern union { |
| 1389 | std.fmt.count("f{}", .{std.math.maxInt(usize)}) | 1389 | std.fmt.count("f{}", .{std.math.maxInt(usize)}) |
| 1390 | ]u8 = undefined; | 1390 | ]u8 = undefined; |
| 1391 | for (0..ty.structFieldCount()) |field_i| { | 1391 | for (0..ty.structFieldCount()) |field_i| { |
| 1392 | if (ty.structFieldIsComptime(field_i)) continue; | 1392 | const field_ty = ty.structFieldType(field_i); |
| | 1393 | if (ty.structFieldIsComptime(field_i) or |
| | 1394 | !field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 1393 | | 1395 | |
| 1394 | self.updateHasherRecurse( | 1396 | self.updateHasherRecurse( |
| 1395 | hasher, | 1397 | hasher, |
| ... | @@ -1423,9 +1425,9 @@ pub const CType = extern union { | ... | @@ -1423,9 +1425,9 @@ pub const CType = extern union { |
| 1423 | }; | 1425 | }; |
| 1424 | | 1426 | |
| 1425 | self.updateHasherRecurse(hasher, info.return_type, recurse_kind); | 1427 | self.updateHasherRecurse(hasher, info.return_type, recurse_kind); |
| 1426 | for (info.param_types, 0..) |param_ty, param_i| { | 1428 | for (info.param_types) |param_type| { |
| 1427 | if (info.paramIsComptime(param_i)) continue; | 1429 | if (!param_type.hasRuntimeBitsIgnoreComptime()) continue; |
| 1428 | self.updateHasherRecurse(hasher, param_ty, recurse_kind); | 1430 | self.updateHasherRecurse(hasher, param_type, recurse_kind); |
| 1429 | } | 1431 | } |
| 1430 | }, | 1432 | }, |
| 1431 | | 1433 | |