authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-03-03 19:06:54+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-03-03 22:16:49+02:00
log69bd2c243e23fa2d4df2ec50802bd4b453211bfd
tree5c20c8cad724fc759437e39ddd5a0bed00d781f1
parent7691013d10525ded6e02228cf89db94719bac1c5

stage2: remove opaque type workaround from `Type.ptrAlignment`


2 files changed, 5 insertions(+), 11 deletions(-)

src/Sema.zig+3-3
...@@ -16852,7 +16852,7 @@ fn beginComptimePtrLoad(...@@ -16852,7 +16852,7 @@ fn beginComptimePtrLoad(
16852 };16852 };
16853 return ComptimePtrLoadKit{16853 return ComptimePtrLoadKit{
16854 .root_val = parent.root_val,16854 .root_val = parent.root_val,
16855 .root_ty = parent.ty,16855 .root_ty = parent.root_ty,
16856 .val = try parent.val.elemValue(sema.arena, elem_ptr.index),16856 .val = try parent.val.elemValue(sema.arena, elem_ptr.index),
16857 .ty = elem_ty,16857 .ty = elem_ty,
16858 .byte_offset = byte_offset,16858 .byte_offset = byte_offset,
...@@ -16868,7 +16868,7 @@ fn beginComptimePtrLoad(...@@ -16868,7 +16868,7 @@ fn beginComptimePtrLoad(
16868 }16868 }
16869 return ComptimePtrLoadKit{16869 return ComptimePtrLoadKit{
16870 .root_val = parent.root_val,16870 .root_val = parent.root_val,
16871 .root_ty = parent.ty,16871 .root_ty = parent.root_ty,
16872 .val = parent.val,16872 .val = parent.val,
16873 .ty = parent.ty,16873 .ty = parent.ty,
16874 .byte_offset = parent.byte_offset,16874 .byte_offset = parent.byte_offset,
...@@ -16896,7 +16896,7 @@ fn beginComptimePtrLoad(...@@ -16896,7 +16896,7 @@ fn beginComptimePtrLoad(
16896 };16896 };
16897 return ComptimePtrLoadKit{16897 return ComptimePtrLoadKit{
16898 .root_val = parent.root_val,16898 .root_val = parent.root_val,
16899 .root_ty = parent.ty,16899 .root_ty = parent.root_ty,
16900 .val = try parent.val.fieldValue(sema.arena, field_index),16900 .val = try parent.val.fieldValue(sema.arena, field_index),
16901 .ty = parent.ty.structFieldType(field_index),16901 .ty = parent.ty.structFieldType(field_index),
16902 .byte_offset = byte_offset,16902 .byte_offset = byte_offset,
src/type.zig+2-8
...@@ -2170,11 +2170,7 @@ pub const Type = extern union {...@@ -2170,11 +2170,7 @@ pub const Type = extern union {
2170 .optional_single_mut_pointer,2170 .optional_single_mut_pointer,
2171 => {2171 => {
2172 const child_type = self.cast(Payload.ElemType).?.data;2172 const child_type = self.cast(Payload.ElemType).?.data;
2173 if (child_type.zigTypeTag() == .Opaque) {2173 return child_type.abiAlignment(target);
2174 return 1;
2175 } else {
2176 return child_type.abiAlignment(target);
2177 }
2178 },2174 },
21792175
2180 .manyptr_u8,2176 .manyptr_u8,
...@@ -2188,8 +2184,6 @@ pub const Type = extern union {...@@ -2188,8 +2184,6 @@ pub const Type = extern union {
2188 const ptr_info = self.castTag(.pointer).?.data;2184 const ptr_info = self.castTag(.pointer).?.data;
2189 if (ptr_info.@"align" != 0) {2185 if (ptr_info.@"align" != 0) {
2190 return ptr_info.@"align";2186 return ptr_info.@"align";
2191 } else if (ptr_info.pointee_type.zigTypeTag() == .Opaque) {
2192 return 1;
2193 } else {2187 } else {
2194 return ptr_info.pointee_type.abiAlignment(target);2188 return ptr_info.pointee_type.abiAlignment(target);
2195 }2189 }
...@@ -2246,6 +2240,7 @@ pub const Type = extern union {...@@ -2246,6 +2240,7 @@ pub const Type = extern union {
2246 .export_options,2240 .export_options,
2247 .extern_options,2241 .extern_options,
2248 .@"opaque",2242 .@"opaque",
2243 .anyopaque,
2249 => return 1,2244 => return 1,
22502245
2251 .fn_noreturn_no_args, // represents machine code; not a pointer2246 .fn_noreturn_no_args, // represents machine code; not a pointer
...@@ -2419,7 +2414,6 @@ pub const Type = extern union {...@@ -2419,7 +2414,6 @@ pub const Type = extern union {
24192414
2420 .empty_struct,2415 .empty_struct,
2421 .void,2416 .void,
2422 .anyopaque,
2423 .empty_struct_literal,2417 .empty_struct_literal,
2424 .type,2418 .type,
2425 .comptime_int,2419 .comptime_int,