authorgravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2019-01-06 17:53:34+01:00
committergravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2019-01-06 17:53:34+01:00
log55e95daf543a27961fe9ca7a998d3cbd25d2973b
tree04f8aabb79f53cabc5165e83858034221632a81e
parente410b1f915974fe3daeebae324e8c4e4b42090dd

Fixed issue where TypeInfo would use types from a prev CodeGen instance

When doing multible codegen passes (such as building compiler_rt and then something else) the TypeInfo cache code would point to types from the prev code gen (such as the prev 'bool' type), giving us errors like "expected type 'bool', but found type 'bool'" This disabling of caching might have a performance hit, but correctness is better than speed, so let's have this for now, until someone optimizes this correctly (probably in stage2)

1 files changed, 5 insertions(+), 9 deletions(-)

src/ir.cpp+5-9
......@@ -16882,16 +16882,12 @@ static void ensure_field_index(ZigType *type, const char *field_name, size_t ind
1688216882
1688316883static ZigType *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, ZigType *root) {
1688416884 Error err;
16885 static ConstExprValue *type_info_var = nullptr; // TODO oops this global variable made it past code review
16886 static ZigType *type_info_type = nullptr; // TODO oops this global variable made it past code review
16887 if (type_info_var == nullptr) {
16888 type_info_var = get_builtin_value(ira->codegen, "TypeInfo");
16889 assert(type_info_var->type->id == ZigTypeIdMetaType);
16885 ConstExprValue *type_info_var = get_builtin_value(ira->codegen, "TypeInfo"); // TODO oops this global variable made it past code review
16886 assert(type_info_var->type->id == ZigTypeIdMetaType);
16887 assertNoError(ensure_complete_type(ira->codegen, type_info_var->data.x_type));
1689016888
16891 assertNoError(ensure_complete_type(ira->codegen, type_info_var->data.x_type));
16892 type_info_type = type_info_var->data.x_type;
16893 assert(type_info_type->id == ZigTypeIdUnion);
16894 }
16889 ZigType *type_info_type = type_info_var->data.x_type; // TODO oops this global variable made it past code review
16890 assert(type_info_type->id == ZigTypeIdUnion);
1689516891
1689616892 if (type_name == nullptr && root == nullptr)
1689716893 return type_info_type;