aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-31 15:00:48 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:47:58 -0700
commitbb526426e75ed456a7db6afa32447e5a76ac7ca1 (patch)
tree8bfdcc7aac33275554b0216ade8cde0b80b2e698 /src/Module.zig
parent870e3843c5736def21234ca8b7159b179985505c (diff)
downloadzig-bb526426e75ed456a7db6afa32447e5a76ac7ca1.tar.gz
zig-bb526426e75ed456a7db6afa32447e5a76ac7ca1.zip
InternPool: remove memoized_decl
This is neither a type nor a value. Simplifies `addStrLit` as well as the many places that switch on `InternPool.Key`. This is a partial revert of bec29b9e498e08202679aa29a45dab2a06a69a1e.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 862025d8f9..cf0d222a2e 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -88,6 +88,9 @@ embed_table: std.StringHashMapUnmanaged(*EmbedFile) = .{},
/// Stores all Type and Value objects; periodically garbage collected.
intern_pool: InternPool = .{},
+/// This is currently only used for string literals.
+memoized_decls: std.AutoHashMapUnmanaged(InternPool.Index, Decl.Index) = .{},
+
/// The set of all the generic function instantiations. This is used so that when a generic
/// function is called twice with the same comptime parameter arguments, both calls dispatch
/// to the same function.
@@ -561,6 +564,7 @@ pub const Decl = struct {
}
mod.destroyFunc(func);
}
+ _ = mod.memoized_decls.remove(decl.val.ip_index);
if (decl.value_arena) |value_arena| {
value_arena.deinit(gpa);
decl.value_arena = null;
@@ -3285,6 +3289,7 @@ pub fn deinit(mod: *Module) void {
mod.namespaces_free_list.deinit(gpa);
mod.allocated_namespaces.deinit(gpa);
+ mod.memoized_decls.deinit(gpa);
mod.intern_pool.deinit(gpa);
}