Module: move memoized data to the intern pool
This avoids memory management bugs with the previous implementation.
This commit is contained in:
committed by
Andrew Kelley
parent
d40b83de45
commit
3b6ca1d35b
@@ -1090,6 +1090,7 @@ pub const DeclGen = struct {
|
||||
};
|
||||
|
||||
switch (mod.intern_pool.indexToKey(val.ip_index)) {
|
||||
// types, not values
|
||||
.int_type,
|
||||
.ptr_type,
|
||||
.array_type,
|
||||
@@ -1106,7 +1107,10 @@ pub const DeclGen = struct {
|
||||
.func_type,
|
||||
.error_set_type,
|
||||
.inferred_error_set_type,
|
||||
=> unreachable, // types, not values
|
||||
// memoization, not values
|
||||
.memoized_decl,
|
||||
.memoized_call,
|
||||
=> unreachable,
|
||||
|
||||
.undef, .runtime_value => unreachable, // handled above
|
||||
.simple_value => |simple_value| switch (simple_value) {
|
||||
|
||||
@@ -3793,6 +3793,9 @@ pub const DeclGen = struct {
|
||||
return llvm_union_ty.constNamedStruct(&fields, fields_len);
|
||||
}
|
||||
},
|
||||
.memoized_decl,
|
||||
.memoized_call,
|
||||
=> unreachable,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -830,6 +830,9 @@ pub const DeclGen = struct {
|
||||
|
||||
try self.addUndef(layout.padding);
|
||||
},
|
||||
.memoized_decl,
|
||||
.memoized_call,
|
||||
=> unreachable,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user