Fix fulfillments for type metadata and witness table packs

A lot of the fixes here are adjustments to compensate in the
fulfillment and metadata-path subsystems for the recent pack
substitutions representation change.  I think these adjustments
really make the case for why the change was the right one to make:
the code was clearly not considering the possibility of packs
in these positions, and the need to handle packs makes everything
work out much more cleanly.

There's still some work that needs to happen around type packs;
in particular, we're not caching them or fulfilling them as a
whole, and we do have the setup to do that properly now.
This commit is contained in:
John McCall
2023-03-10 01:17:55 -05:00
parent de73859d0f
commit 0e932329c3
16 changed files with 395 additions and 52 deletions

View File

@@ -121,6 +121,15 @@ namespace irgen {
unsigned reqtIndex,
llvm::Value *metadata);
/// Given a reference to nominal type metadata of the given type,
/// derive a reference to the type metadata pack stored in the nth
/// requirement slot. The type must have generic arguments.
llvm::Value *emitArgumentMetadataPackRef(IRGenFunction &IGF,
NominalTypeDecl *theDecl,
const GenericTypeRequirements &reqts,
unsigned reqtIndex,
llvm::Value *metadata);
/// Given a reference to nominal type metadata of the given type,
/// derive a reference to a protocol witness table stored in the nth
/// requirement slot. The type must have generic arguments.
@@ -130,6 +139,15 @@ namespace irgen {
unsigned reqtIndex,
llvm::Value *metadata);
/// Given a reference to nominal type metadata of the given type,
/// derive a reference to a protocol witness table pack stored in the nth
/// requirement slot. The type must have generic arguments.
llvm::Value *emitArgumentWitnessTablePackRef(IRGenFunction &IGF,
NominalTypeDecl *theDecl,
const GenericTypeRequirements &reqts,
unsigned reqtIndex,
llvm::Value *metadata);
/// Given a reference to nominal type metadata of the given type,
/// derive a reference to a the pack shape stored in the nth
/// requirement slot. The type must have generic arguments.