aboutsummaryrefslogtreecommitdiff
path: root/src/Type.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-07-04 15:47:47 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-07-04 17:56:01 -0700
commit74346b0f79ca4bf67d61008030c7cc3565bff3f9 (patch)
tree69bdcb7800608daed4a8908406623f3bab38f0e4 /src/Type.zig
parent30ec43a6c78d9c8803becbea5a02edb8fae08af6 (diff)
downloadzig-74346b0f79ca4bf67d61008030c7cc3565bff3f9.tar.gz
zig-74346b0f79ca4bf67d61008030c7cc3565bff3f9.zip
frontend: TrackedInst stores FileIndex instead of path digest
The purpose of using path digest was to reference a file in a serializable manner. Now that there is a stable index associated with files, it is a superior way to accomplish that goal, since removes one layer of indirection, and makes TrackedInst 8 bytes instead of 20. The saved Zig Compiler State file for "hello world" goes from 1.3M to 1.2M with this change.
Diffstat (limited to 'src/Type.zig')
-rw-r--r--src/Type.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Type.zig b/src/Type.zig
index 8c70e34fce..49f1276070 100644
--- a/src/Type.zig
+++ b/src/Type.zig
@@ -3455,7 +3455,7 @@ pub fn typeDeclSrcLine(ty: Type, zcu: *const Zcu) ?u32 {
else => return null,
};
const info = tracked.resolveFull(&zcu.intern_pool);
- const file = zcu.import_table.values()[zcu.files.getIndex(info.path_digest).?];
+ const file = zcu.fileByIndex(info.file);
assert(file.zir_loaded);
const zir = file.zir;
const inst = zir.instructions.get(@intFromEnum(info.inst));