@@ -84,15 +84,13 @@ string_literal_bytes: std.ArrayListUnmanaged(u8) = .{},
84
84
/// The set of all the generic function instantiations. This is used so that when a generic
85
85
/// function is called twice with the same comptime parameter arguments, both calls dispatch
86
86
/// to the same function.
87
- /// TODO: remove functions from this set when they are destroyed.
88
87
monomorphed_funcs : MonomorphedFuncsSet = .{},
89
88
/// The set of all comptime function calls that have been cached so that future calls
90
89
/// with the same parameters will get the same return value.
91
90
memoized_calls : MemoizedCallSet = .{},
92
91
/// Contains the values from `@setAlignStack`. A sparse table is used here
93
92
/// instead of a field of `Fn` because usage of `@setAlignStack` is rare, while
94
93
/// functions are many.
95
- /// TODO: remove functions from this set when they are destroyed.
96
94
align_stack_fns : std .AutoHashMapUnmanaged (* const Fn , SetAlignStack ) = .{},
97
95
98
96
/// We optimize memory usage for a compilation with no compile errors by storing the
@@ -560,6 +558,8 @@ pub const Decl = struct {
560
558
gpa .destroy (extern_fn );
561
559
}
562
560
if (decl .getFunction ()) | func | {
561
+ _ = mod .align_stack_fns .remove (func );
562
+ _ = mod .monomorphed_funcs .remove (func );
563
563
func .deinit (gpa );
564
564
gpa .destroy (func );
565
565
}
@@ -4094,6 +4094,12 @@ pub fn ensureDeclAnalyzed(mod: *Module, decl_index: Decl.Index) SemaError!void {
4094
4094
// The exports this Decl performs will be re-discovered, so we remove them here
4095
4095
// prior to re-analysis.
4096
4096
mod .deleteDeclExports (decl_index );
4097
+
4098
+ // Similarly, `@setAlignStack` invocations will be re-discovered.
4099
+ if (decl .getFunction ()) | func | {
4100
+ _ = mod .align_stack_fns .remove (func );
4101
+ }
4102
+
4097
4103
// Dependencies will be re-discovered, so we remove them here prior to re-analysis.
4098
4104
for (decl .dependencies .keys ()) | dep_index | {
4099
4105
const dep = mod .declPtr (dep_index );
0 commit comments