diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-05-23 19:10:36 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-10 20:47:54 -0700 |
| commit | 01ca841f1227cc3e17169c45318c8d4757a5c0d2 (patch) | |
| tree | 431768f9bac787fd2568de48fa1d178e98df51df /src/Module.zig | |
| parent | 1b64eed107f54220f85a5158699225b59899a20a (diff) | |
| download | zig-01ca841f1227cc3e17169c45318c8d4757a5c0d2.tar.gz zig-01ca841f1227cc3e17169c45318c8d4757a5c0d2.zip | |
Sema: improve the types_to_resolve mechanism
Store `InternPool.Index` as the key instead which means that an AIR
instruction no longer needs to be burned to store the type, and also
that we can use AutoArrayHashMap instead of an ArrayList, which avoids
storing duplicates into the set, potentially saving CPU time.
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Module.zig b/src/Module.zig index f4bf487128..8174778f48 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -5773,9 +5773,8 @@ pub fn analyzeFnBody(mod: *Module, func: *Fn, arena: Allocator) SemaError!Air { // Similarly, resolve any queued up types that were requested to be resolved for // the backends. - for (sema.types_to_resolve.items) |inst_ref| { - const ty = sema.getTmpAir().getRefType(inst_ref); - sema.resolveTypeFully(ty) catch |err| switch (err) { + for (sema.types_to_resolve.keys()) |ty| { + sema.resolveTypeFully(ty.toType()) catch |err| switch (err) { error.NeededSourceLocation => unreachable, error.GenericPoison => unreachable, error.ComptimeReturn => unreachable, |
