Skip to content

Commit be870fd

Browse files
committed
IRGen: Emit capture descriptors in their own section
Now that reflection metadata is in TEXT, we can have relative references to capture descriptors from closure context metadata.
1 parent 51ae5a8 commit be870fd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/IRGen/GenReflection.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,8 @@ class CaptureDescriptorBuilder : public ReflectionMetadataBuilder {
689689
/*isConstant*/ true,
690690
llvm::GlobalValue::PrivateLinkage,
691691
init,
692-
"capture_descriptor");
692+
"\x01l__swift3_capture_descriptor");
693+
var->setSection(IGM.getCaptureDescriptorMetadataSectionName());
693694
var->setAlignment(IGM.getPointerAlignment().getValue());
694695

695696
auto replacer = llvm::ConstantExpr::getBitCast(var, IGM.Int8PtrTy);
@@ -731,6 +732,10 @@ std::string IRGenModule::getAssociatedTypeMetadataSectionName() {
731732
return getReflectionSectionName(*this, "assocty");
732733
}
733734

735+
std::string IRGenModule::getCaptureDescriptorMetadataSectionName() {
736+
return getReflectionSectionName(*this, "capture");
737+
}
738+
734739
std::string IRGenModule::getReflectionStringsSectionName() {
735740
return getReflectionSectionName(*this, "reflstr");
736741
}

lib/IRGen/IRGenModule.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ class IRGenModule {
632632
std::string getBuiltinTypeMetadataSectionName();
633633
std::string getFieldTypeMetadataSectionName();
634634
std::string getAssociatedTypeMetadataSectionName();
635+
std::string getCaptureDescriptorMetadataSectionName();
635636
std::string getReflectionStringsSectionName();
636637
std::string getReflectionTypeRefSectionName();
637638

0 commit comments

Comments
 (0)