aboutsummaryrefslogtreecommitdiff
path: root/src/link/Plan9.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-02 15:01:45 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:40:03 -0700
commit9aec2758cc29d27c31dcb0b4bb040484a885ef23 (patch)
treec171c40656f3b8f70375b4afca94a87784bb2dda /src/link/Plan9.zig
parent1e7dcaa3ae57294ab5998b44a8c13ccc5019e7ea (diff)
downloadzig-9aec2758cc29d27c31dcb0b4bb040484a885ef23.tar.gz
zig-9aec2758cc29d27c31dcb0b4bb040484a885ef23.zip
stage2: start the InternPool transition
Instead of doing everything at once which is a hopelessly large task, this introduces a piecemeal transition that can be done in small increments at a time. This is a minimal changeset that keeps the compiler compiling. It only uses the InternPool for a small set of types. Behavior tests are not passing. Air.Inst.Ref and Zir.Inst.Ref are separated into different enums but compile-time verified to have the same fields in the same order. The large set of changes is mainly to deal with the fact that most Type and Value methods now require a Module to be passed in, so that the InternPool object can be accessed.
Diffstat (limited to 'src/link/Plan9.zig')
-rw-r--r--src/link/Plan9.zig9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig
index 6d74e17dfd..7a389a789d 100644
--- a/src/link/Plan9.zig
+++ b/src/link/Plan9.zig
@@ -432,8 +432,9 @@ pub fn updateDecl(self: *Plan9, module: *Module, decl_index: Module.Decl.Index)
}
/// called at the end of update{Decl,Func}
fn updateFinish(self: *Plan9, decl_index: Module.Decl.Index) !void {
- const decl = self.base.options.module.?.declPtr(decl_index);
- const is_fn = (decl.ty.zigTypeTag() == .Fn);
+ const mod = self.base.options.module.?;
+ const decl = mod.declPtr(decl_index);
+ const is_fn = (decl.ty.zigTypeTag(mod) == .Fn);
log.debug("update the symbol table and got for decl {*} ({s})", .{ decl, decl.name });
const sym_t: aout.Sym.Type = if (is_fn) .t else .d;
@@ -704,7 +705,7 @@ pub fn flushModule(self: *Plan9, comp: *Compilation, prog_node: *std.Progress.No
log.debug("relocating the address of '{s}' + {d} into '{s}' + {d}", .{ target_decl.name, addend, source_decl.name, offset });
const code = blk: {
- const is_fn = source_decl.ty.zigTypeTag() == .Fn;
+ const is_fn = source_decl.ty.zigTypeTag(mod) == .Fn;
if (is_fn) {
const table = self.fn_decl_table.get(source_decl.getFileScope()).?.functions;
const output = table.get(source_decl_index).?;
@@ -1031,7 +1032,7 @@ pub fn getDeclVAddr(
) !u64 {
const mod = self.base.options.module.?;
const decl = mod.declPtr(decl_index);
- if (decl.ty.zigTypeTag() == .Fn) {
+ if (decl.ty.zigTypeTag(mod) == .Fn) {
var start = self.bases.text;
var it_file = self.fn_decl_table.iterator();
while (it_file.next()) |fentry| {