Skip to content

Commit 93d383f

Browse files
authored
Merge pull request llvm#23944 from slavapestov/lazier-and-more-correct-metadata
Fix some problems with IRGen lazy metadata emission
2 parents 2543b1d + 1dbca9e commit 93d383f

27 files changed

+490
-479
lines changed

include/swift/IRGen/Linking.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,6 @@ class LinkEntity {
346346
/// The pointer is a canonical TypeBase*.
347347
TypeMetadataLazyCacheVariable,
348348

349-
/// A foreign type metadata candidate.
350-
/// The pointer is a canonical TypeBase*.
351-
ForeignTypeMetadataCandidate,
352-
353349
/// A reflection metadata descriptor for a builtin or imported type.
354350
ReflectionBuiltinDescriptor,
355351

@@ -688,12 +684,6 @@ class LinkEntity {
688684
return entity;
689685
}
690686

691-
static LinkEntity forForeignTypeMetadataCandidate(CanType type) {
692-
LinkEntity entity;
693-
entity.setForType(Kind::ForeignTypeMetadataCandidate, type);
694-
return entity;
695-
}
696-
697687
static LinkEntity forClassMetadataBaseOffset(ClassDecl *decl) {
698688
LinkEntity entity;
699689
entity.setForDecl(Kind::ClassMetadataBaseOffset, decl);
@@ -1047,15 +1037,15 @@ class LinkEntity {
10471037
getKind() == Kind::ObjCResilientClassStub);
10481038
return (TypeMetadataAddress)LINKENTITY_GET_FIELD(Data, MetadataAddress);
10491039
}
1050-
bool isForeignTypeMetadataCandidate() const {
1051-
return getKind() == Kind::ForeignTypeMetadataCandidate;
1052-
}
10531040
bool isObjCClassRef() const {
10541041
return getKind() == Kind::ObjCClassRef;
10551042
}
10561043
bool isSILFunction() const {
10571044
return getKind() == Kind::SILFunction;
10581045
}
1046+
bool isNominalTypeDescriptor() const {
1047+
return getKind() == Kind::NominalTypeDescriptor;
1048+
}
10591049

10601050
/// Determine whether this entity will be weak-imported.
10611051
bool isWeakImported(ModuleDecl *module,

lib/IRGen/GenClass.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,13 +930,16 @@ void IRGenModule::emitClassDecl(ClassDecl *D) {
930930
auto &resilientLayout =
931931
classTI.getClassLayout(*this, selfType, /*forBackwardDeployment=*/false);
932932

933+
// As a matter of policy, class metadata is never emitted lazily for now.
934+
assert(!IRGen.hasLazyMetadata(D));
935+
933936
// Emit the class metadata.
934937
emitClassMetadata(*this, D, fragileLayout, resilientLayout);
938+
emitFieldDescriptor(D);
935939

936940
IRGen.addClassForEagerInitialization(D);
937941

938942
emitNestedTypeDecls(D->getMembers());
939-
emitFieldMetadataRecord(D);
940943
}
941944

942945
namespace {

0 commit comments

Comments
 (0)