aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-06-03 15:46:16 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:51:10 -0700
commit2a6b91874ae970c0fba63f8c1357da5a57feec27 (patch)
treeccc245020664b0908c3e674295d3e1ca6e01bd10 /src/Module.zig
parentab86b2024883f67c0fa06108f66e4e88b98c3163 (diff)
downloadzig-2a6b91874ae970c0fba63f8c1357da5a57feec27.tar.gz
zig-2a6b91874ae970c0fba63f8c1357da5a57feec27.zip
stage2: pass most test cases under InternPool
All but 2 test cases now pass (tested on x86_64 Linux, native only). The remaining two signify an issue requiring a larger refactor, which I will do in a separate commit. Notable changes: * Fix uninitialized memory when allocating objects from free lists * Implement TypedValue printing for pointers * Fix some TypedValue printing logic * Work around non-existence of InternPool.remove implementation
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Module.zig b/src/Module.zig
index c1d6b8157a..cb3e8884e3 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -4374,7 +4374,8 @@ pub fn semaFile(mod: *Module, file: *File) SemaError!void {
.index = struct_index.toOptional(),
.namespace = new_namespace_index.toOptional(),
} });
- errdefer mod.intern_pool.remove(struct_ty);
+ // TODO: figure out InternPool removals for incremental compilation
+ //errdefer mod.intern_pool.remove(struct_ty);
new_namespace.ty = struct_ty.toType();
file.root_decl = new_decl_index.toOptional();
@@ -5682,7 +5683,10 @@ fn markOutdatedDecl(mod: *Module, decl_index: Decl.Index) !void {
}
pub fn createNamespace(mod: *Module, initialization: Namespace) !Namespace.Index {
- if (mod.namespaces_free_list.popOrNull()) |index| return index;
+ if (mod.namespaces_free_list.popOrNull()) |index| {
+ mod.allocated_namespaces.at(@enumToInt(index)).* = initialization;
+ return index;
+ }
const ptr = try mod.allocated_namespaces.addOne(mod.gpa);
ptr.* = initialization;
return @intToEnum(Namespace.Index, mod.allocated_namespaces.len - 1);