Skip to content

Commit

Permalink
Merge pull request #23944 from slavapestov/lazier-and-more-correct-me…
Browse files Browse the repository at this point in the history
…tadata

Fix some problems with IRGen lazy metadata emission
  • Loading branch information
slavapestov authored Apr 12, 2019
2 parents 2543b1d + 1dbca9e commit 93d383f
Show file tree
Hide file tree
Showing 27 changed files with 490 additions and 479 deletions.
16 changes: 3 additions & 13 deletions include/swift/IRGen/Linking.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,6 @@ class LinkEntity {
/// The pointer is a canonical TypeBase*.
TypeMetadataLazyCacheVariable,

/// A foreign type metadata candidate.
/// The pointer is a canonical TypeBase*.
ForeignTypeMetadataCandidate,

/// A reflection metadata descriptor for a builtin or imported type.
ReflectionBuiltinDescriptor,

Expand Down Expand Up @@ -688,12 +684,6 @@ class LinkEntity {
return entity;
}

static LinkEntity forForeignTypeMetadataCandidate(CanType type) {
LinkEntity entity;
entity.setForType(Kind::ForeignTypeMetadataCandidate, type);
return entity;
}

static LinkEntity forClassMetadataBaseOffset(ClassDecl *decl) {
LinkEntity entity;
entity.setForDecl(Kind::ClassMetadataBaseOffset, decl);
Expand Down Expand Up @@ -1047,15 +1037,15 @@ class LinkEntity {
getKind() == Kind::ObjCResilientClassStub);
return (TypeMetadataAddress)LINKENTITY_GET_FIELD(Data, MetadataAddress);
}
bool isForeignTypeMetadataCandidate() const {
return getKind() == Kind::ForeignTypeMetadataCandidate;
}
bool isObjCClassRef() const {
return getKind() == Kind::ObjCClassRef;
}
bool isSILFunction() const {
return getKind() == Kind::SILFunction;
}
bool isNominalTypeDescriptor() const {
return getKind() == Kind::NominalTypeDescriptor;
}

/// Determine whether this entity will be weak-imported.
bool isWeakImported(ModuleDecl *module,
Expand Down
5 changes: 4 additions & 1 deletion lib/IRGen/GenClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,13 +930,16 @@ void IRGenModule::emitClassDecl(ClassDecl *D) {
auto &resilientLayout =
classTI.getClassLayout(*this, selfType, /*forBackwardDeployment=*/false);

// As a matter of policy, class metadata is never emitted lazily for now.
assert(!IRGen.hasLazyMetadata(D));

// Emit the class metadata.
emitClassMetadata(*this, D, fragileLayout, resilientLayout);
emitFieldDescriptor(D);

IRGen.addClassForEagerInitialization(D);

emitNestedTypeDecls(D->getMembers());
emitFieldMetadataRecord(D);
}

namespace {
Expand Down
Loading

0 comments on commit 93d383f

Please sign in to comment.