authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-02-28 00:28:26-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-02-28 00:28:26-05:00
log556f22a751e47d572404992befe15c09c0f2eb0b
tree88d5964a4281f5c814717023024676539576751d
parent1b8a241f6fd1ac8d42965c6aaaf4934de565b2b2

different way of fixing previous commit

get_fn_type doesn't need the complete parameter type, it can just ensure zero bits known.

1 files changed, 4 insertions(+), 4 deletions(-)

src/analyze.cpp+4-4
...@@ -997,7 +997,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {...@@ -997,7 +997,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
997 gen_param_info->src_index = i;997 gen_param_info->src_index = i;
998 gen_param_info->gen_index = SIZE_MAX;998 gen_param_info->gen_index = SIZE_MAX;
999999
1000 ensure_complete_type(g, type_entry);1000 type_ensure_zero_bits_known(g, type_entry);
1001 if (type_has_bits(type_entry)) {1001 if (type_has_bits(type_entry)) {
1002 TypeTableEntry *gen_type;1002 TypeTableEntry *gen_type;
1003 if (handle_is_ptr(type_entry)) {1003 if (handle_is_ptr(type_entry)) {
...@@ -1670,9 +1670,6 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) {...@@ -1670,9 +1670,6 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) {
1670 if (struct_type->data.structure.is_invalid)1670 if (struct_type->data.structure.is_invalid)
1671 return;1671 return;
16721672
1673 if (struct_type->data.structure.zero_bits_loop_flag)
1674 return;
1675
1676 AstNode *decl_node = struct_type->data.structure.decl_node;1673 AstNode *decl_node = struct_type->data.structure.decl_node;
16771674
1678 if (struct_type->data.structure.embedded_in_current) {1675 if (struct_type->data.structure.embedded_in_current) {
...@@ -1685,6 +1682,7 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) {...@@ -1685,6 +1682,7 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) {
1685 return;1682 return;
1686 }1683 }
16871684
1685 assert(!struct_type->data.structure.zero_bits_loop_flag);
1688 assert(struct_type->data.structure.fields);1686 assert(struct_type->data.structure.fields);
1689 assert(decl_node->type == NodeTypeContainerDecl);1687 assert(decl_node->type == NodeTypeContainerDecl);
16901688
...@@ -2131,6 +2129,7 @@ static void resolve_enum_zero_bits(CodeGen *g, TypeTableEntry *enum_type) {...@@ -2131,6 +2129,7 @@ static void resolve_enum_zero_bits(CodeGen *g, TypeTableEntry *enum_type) {
21312129
2132 if (enum_type->data.enumeration.zero_bits_loop_flag) {2130 if (enum_type->data.enumeration.zero_bits_loop_flag) {
2133 enum_type->data.enumeration.zero_bits_known = true;2131 enum_type->data.enumeration.zero_bits_known = true;
2132 enum_type->data.enumeration.zero_bits_loop_flag = false;
2134 return;2133 return;
2135 }2134 }
21362135
...@@ -2285,6 +2284,7 @@ static void resolve_struct_zero_bits(CodeGen *g, TypeTableEntry *struct_type) {...@@ -2285,6 +2284,7 @@ static void resolve_struct_zero_bits(CodeGen *g, TypeTableEntry *struct_type) {
2285 // the alignment is pointer width, then assert that the first field is within that2284 // the alignment is pointer width, then assert that the first field is within that
2286 // alignment2285 // alignment
2287 struct_type->data.structure.zero_bits_known = true;2286 struct_type->data.structure.zero_bits_known = true;
2287 struct_type->data.structure.zero_bits_loop_flag = false;
2288 if (struct_type->data.structure.abi_alignment == 0) {2288 if (struct_type->data.structure.abi_alignment == 0) {
2289 if (struct_type->data.structure.layout == ContainerLayoutPacked) {2289 if (struct_type->data.structure.layout == ContainerLayoutPacked) {
2290 struct_type->data.structure.abi_alignment = 1;2290 struct_type->data.structure.abi_alignment = 1;