Skip to content

Commit 333f614

Browse files
committed
[IRGen] NFC: Update structure of ClassContextDescriptor representation
1 parent 9288b71 commit 333f614

File tree

4 files changed

+29
-24
lines changed

4 files changed

+29
-24
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ IRGenModule::getAddrOfParentContextDescriptor(DeclContext *from) {
809809
return getAddrOfLLVMVariableOrGOTEquivalent(
810810
LinkEntity::forNominalTypeDescriptor(nominal),
811811
Alignment(4),
812-
NominalTypeDescriptorTy,
812+
TypeContextDescriptorTy,
813813
shouldBeIndirect);
814814
}
815815
}
@@ -2495,8 +2495,8 @@ getTypeEntityInfo(IRGenModule &IGM, CanType conformingType) {
24952495
// are represented by referencing the nominal type descriptor.
24962496
typeKind = TypeMetadataRecordKind::DirectNominalTypeDescriptor;
24972497
entity = LinkEntity::forNominalTypeDescriptor(nom);
2498-
defaultTy = IGM.NominalTypeDescriptorTy;
2499-
defaultPtrTy = IGM.NominalTypeDescriptorPtrTy;
2498+
defaultTy = IGM.TypeContextDescriptorTy;
2499+
defaultPtrTy = IGM.TypeContextDescriptorPtrTy;
25002500
}
25012501

25022502
return {typeKind, *entity, defaultTy, defaultPtrTy};
@@ -3305,7 +3305,7 @@ llvm::Constant *IRGenModule::getAddrOfTypeContextDescriptor(NominalTypeDecl *D,
33053305
auto entity = LinkEntity::forNominalTypeDescriptor(D);
33063306
return getAddrOfLLVMVariable(entity, Alignment(4),
33073307
definition,
3308-
NominalTypeDescriptorTy,
3308+
TypeContextDescriptorTy,
33093309
DebugTypeInfo());
33103310
}
33113311

lib/IRGen/GenMeta.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3030,7 +3030,7 @@ IRGenModule::getAddrOfSharedContextDescriptor(LinkEntity entity,
30303030

30313031
return getAddrOfLLVMVariable(entity, Alignment(4),
30323032
definition,
3033-
NominalTypeDescriptorTy,
3033+
TypeContextDescriptorTy,
30343034
DebugTypeInfo());
30353035
}
30363036

lib/IRGen/IRGenModule.cpp

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -307,25 +307,30 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
307307
ProtocolConformanceDescriptorPtrTy
308308
= ProtocolConformanceDescriptorTy->getPointerTo(DefaultAS);
309309

310-
NominalTypeDescriptorTy
310+
TypeContextDescriptorTy
311311
= llvm::StructType::create(LLVMContext, "swift.type_descriptor");
312-
NominalTypeDescriptorPtrTy
313-
= NominalTypeDescriptorTy->getPointerTo(DefaultAS);
312+
TypeContextDescriptorPtrTy
313+
= TypeContextDescriptorTy->getPointerTo(DefaultAS);
314314

315-
ClassNominalTypeDescriptorTy =
315+
ClassContextDescriptorTy =
316316
llvm::StructType::get(LLVMContext, {
317-
Int32Ty,
318-
Int32Ty,
319-
Int32Ty,
320-
Int32Ty,
321-
Int32Ty,
322-
Int32Ty,
323-
Int32Ty,
324-
Int32Ty,
325-
Int32Ty,
326-
Int16Ty,
327-
Int16Ty,
328-
Int32Ty,
317+
Int32Ty, // context flags
318+
Int32Ty, // parent
319+
Int32Ty, // name
320+
Int32Ty, // kind
321+
Int32Ty, // accessor function
322+
Int32Ty, // num fields
323+
Int32Ty, // field offset vector
324+
Int32Ty, // is_reflectable flag
325+
Int32Ty, // (Generics Descriptor) argument offset
326+
Int32Ty, // (Generics Descriptor) num params
327+
Int32Ty, // (Generics Descriptor) num requirements
328+
Int32Ty, // (Generics Descriptor) num key arguments
329+
Int32Ty, // (Generics Descriptor) num extra arguments
330+
Int32Ty, // (VTable Descriptor) offset
331+
Int32Ty, // (VTable Descriptor) size
332+
Int32Ty, // (Methods Descriptor) accessor
333+
Int32Ty, // (Methods Descriptor) flags
329334
}, /*packed=*/true);
330335

331336
MethodDescriptorStructTy

lib/IRGen/IRGenModule.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,9 @@ class IRGenModule {
530530
llvm::PointerType *ProtocolRecordPtrTy;
531531
llvm::StructType *ProtocolConformanceDescriptorTy;
532532
llvm::PointerType *ProtocolConformanceDescriptorPtrTy;
533-
llvm::StructType *NominalTypeDescriptorTy;
534-
llvm::PointerType *NominalTypeDescriptorPtrTy;
535-
llvm::StructType *ClassNominalTypeDescriptorTy;
533+
llvm::StructType *TypeContextDescriptorTy;
534+
llvm::PointerType *TypeContextDescriptorPtrTy;
535+
llvm::StructType *ClassContextDescriptorTy;
536536
llvm::StructType *MethodDescriptorStructTy; /// %swift.method_descriptor
537537
llvm::StructType *TypeMetadataRecordTy;
538538
llvm::PointerType *TypeMetadataRecordPtrTy;

0 commit comments

Comments
 (0)