From 884d957b6c291961536c10401f60264da26cba30 Mon Sep 17 00:00:00 2001 From: mlugg Date: Tue, 26 Mar 2024 00:05:08 +0000 Subject: compiler: eliminate legacy Value representation Good riddance! Most of these changes are trivial. There's a fix for a minor bug this exposed in `Value.readFromPackedMemory`, but aside from that, it's all just things like changing `intern` calls to `toIntern`. --- src/Module.zig | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index a11194c103..4391472fa5 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -497,13 +497,6 @@ pub const Decl = struct { }; } - pub fn internValue(decl: *Decl, zcu: *Zcu) Allocator.Error!InternPool.Index { - assert(decl.has_tv); - const ip_index = try decl.val.intern(decl.typeOf(zcu), zcu); - decl.val = Value.fromInterned(ip_index); - return ip_index; - } - pub fn isFunction(decl: Decl, zcu: *const Zcu) !bool { const tv = try decl.typedValue(zcu); return tv.ty.zigTypeTag(zcu) == .Fn; @@ -3763,7 +3756,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !SemaDeclResult { }, } - decl.val = Value.fromInterned((try decl_tv.val.intern(decl_tv.ty, mod))); + decl.val = decl_tv.val; // Function linksection, align, and addrspace were already set by Sema if (!is_func) { decl.alignment = blk: { @@ -5624,8 +5617,6 @@ pub fn markDeclAlive(mod: *Module, decl: *Decl) Allocator.Error!void { if (decl.alive) return; decl.alive = true; - _ = try decl.internValue(mod); - // This is the first time we are marking this Decl alive. We must // therefore recurse into its value and mark any Decl it references // as also alive, so that any Decl referenced does not get garbage collected. -- cgit v1.2.3