Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions include/swift/Runtime/RuntimeFunctions.def
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,8 @@ FUNCTION(GetExistentialMetadata,
// swift_getExtendedExistentialTypeShape(
// const NonUniqueExtendedExistentialTypeShape *nonUnique);
FUNCTION(GetExtendedExistentialTypeShape,
swift_getExtendedExistentialTypeShape, C_CC, AlwaysAvailable,
swift_getExtendedExistentialTypeShape, C_CC,
ParameterizedExistentialAvailability,
RETURNS(TypeMetadataPtrTy),
ARGS(Int8PtrTy, Int8PtrPtrTy),
ATTRS(NoUnwind, ArgMemOnly, WillReturn),
Expand All @@ -1187,7 +1188,8 @@ FUNCTION(GetExtendedExistentialTypeShape,
// const NonUniqueExtendedExistentialTypeShape *shape,
// const void * const *generalizationArgs);
FUNCTION(GetExtendedExistentialTypeMetadata,
swift_getExtendedExistentialTypeMetadata, C_CC, AlwaysAvailable,
swift_getExtendedExistentialTypeMetadata, C_CC,
ParameterizedExistentialAvailability,
RETURNS(TypeMetadataPtrTy),
ARGS(Int8PtrTy, Int8PtrPtrTy),
ATTRS(NoUnwind, ArgMemOnly, WillReturn),
Expand All @@ -1197,7 +1199,8 @@ FUNCTION(GetExtendedExistentialTypeMetadata,
// const ExtendedExistentialTypeShape *shape,
// const void * const *generalizationArgs);
FUNCTION(GetExtendedExistentialTypeMetadataUnique,
swift_getExtendedExistentialTypeMetadata_unique, C_CC, AlwaysAvailable,
swift_getExtendedExistentialTypeMetadata_unique, C_CC,
ParameterizedExistentialAvailability,
RETURNS(TypeMetadataPtrTy),
ARGS(Int8PtrTy, Int8PtrPtrTy),
ATTRS(NoUnwind, ArgMemOnly, WillReturn),
Expand Down
8 changes: 8 additions & 0 deletions lib/IRGen/IRGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,14 @@ namespace RuntimeConstants {
return RuntimeAvailability::ConditionallyAvailable;
}

RuntimeAvailability ParameterizedExistentialAvailability(ASTContext &Context) {
auto featureAvailability = Context.getParameterizedExistentialRuntimeAvailability();
if (!isDeploymentAvailabilityContainedIn(Context, featureAvailability)) {
return RuntimeAvailability::ConditionallyAvailable;
}
return RuntimeAvailability::AlwaysAvailable;
}

} // namespace RuntimeConstants

// We don't use enough attributes to justify generalizing the
Expand Down
13 changes: 13 additions & 0 deletions test/IRGen/extended_existential_metadata_weak.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: %target-swift-frontend -emit-ir %s -target %target-swift-abi-5.5-triple | %FileCheck %s
// REQUIRES: VENDOR=apple

public protocol P<A> {
associatedtype A
}

public func f<T>(_: T.Type) {}

@available(SwiftStdlib 5.7, *)
public func g<T>(_: T.Type) { f((any P<T>).self) }

// CHECK-LABEL: declare extern_weak {{.*}} @swift_getExtendedExistentialTypeMetadata(