diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-05-03 19:12:53 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-10 20:40:04 -0700 |
| commit | ca3cf93b21bc77535fbaa7ca6aa411654dcfe069 (patch) | |
| tree | 2bec1cb13da757280595ef217556c1eeddf77414 /src/Module.zig | |
| parent | 836d8a1f64cb811641e621799429c54f222717eb (diff) | |
| download | zig-ca3cf93b21bc77535fbaa7ca6aa411654dcfe069.tar.gz zig-ca3cf93b21bc77535fbaa7ca6aa411654dcfe069.zip | |
stage2: move most simple values to InternPool
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/Module.zig b/src/Module.zig index 77c20fbcc6..5c84b123c1 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -4847,31 +4847,37 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool { decl.owns_tv = false; var queue_linker_work = false; var is_extern = false; - switch (decl_tv.val.tag()) { - .variable => { - const variable = decl_tv.val.castTag(.variable).?.data; - if (variable.owner_decl == decl_index) { - decl.owns_tv = true; - queue_linker_work = true; - - const copied_init = try variable.init.copy(decl_arena_allocator); - variable.init = copied_init; - } - }, - .extern_fn => { - const extern_fn = decl_tv.val.castTag(.extern_fn).?.data; - if (extern_fn.owner_decl == decl_index) { - decl.owns_tv = true; - queue_linker_work = true; - is_extern = true; - } - }, - + switch (decl_tv.val.ip_index) { .generic_poison => unreachable, - .unreachable_value => unreachable, + .none => switch (decl_tv.val.tag()) { + .variable => { + const variable = decl_tv.val.castTag(.variable).?.data; + if (variable.owner_decl == decl_index) { + decl.owns_tv = true; + queue_linker_work = true; + + const copied_init = try variable.init.copy(decl_arena_allocator); + variable.init = copied_init; + } + }, + .extern_fn => { + const extern_fn = decl_tv.val.castTag(.extern_fn).?.data; + if (extern_fn.owner_decl == decl_index) { + decl.owns_tv = true; + queue_linker_work = true; + is_extern = true; + } + }, + + .unreachable_value => unreachable, - .function => {}, + .function => {}, + else => { + log.debug("send global const to linker: {*} ({s})", .{ decl, decl.name }); + queue_linker_work = true; + }, + }, else => { log.debug("send global const to linker: {*} ({s})", .{ decl, decl.name }); queue_linker_work = true; |
