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