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.
This commit is contained in:
Andrew Kelley
2023-05-23 19:10:36 -07:00
parent 1b64eed107
commit 01ca841f12
2 changed files with 11 additions and 10 deletions

View File

@@ -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,