mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[metadata prespecialization] Target only >=5.2.
Compatibility with earlier swift runtimes would require modifying the runtime compatibility libraries to adjust the behavior of checkMetadataState by way of typeForMangledNode or even typeForMangledName. For now, simply require that a version of swift whose runtime knows about prespecialized metadata is being targeted.
This commit is contained in:
@@ -614,6 +614,14 @@ public:
|
|||||||
/// swift_getTypeByMangledNameInContextInMetadataState.
|
/// swift_getTypeByMangledNameInContextInMetadataState.
|
||||||
AvailabilityContext getTypesInAbstractMetadataStateAvailability();
|
AvailabilityContext getTypesInAbstractMetadataStateAvailability();
|
||||||
|
|
||||||
|
/// Get the runtime availability of support for prespecialized generic
|
||||||
|
/// metadata.
|
||||||
|
AvailabilityContext getPrespecializedGenericMetadataAvailability();
|
||||||
|
|
||||||
|
/// Get the runtime availability of features introduced in the Swift 5.2
|
||||||
|
/// compiler for the target platform.
|
||||||
|
AvailabilityContext getSwift52Availability();
|
||||||
|
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// Diagnostics Helper functions
|
// Diagnostics Helper functions
|
||||||
|
|||||||
@@ -239,6 +239,14 @@ AvailabilityContext ASTContext::getSwift51Availability() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AvailabilityContext ASTContext::getTypesInAbstractMetadataStateAvailability() {
|
AvailabilityContext ASTContext::getTypesInAbstractMetadataStateAvailability() {
|
||||||
|
return getSwift52Availability();
|
||||||
|
}
|
||||||
|
|
||||||
|
AvailabilityContext ASTContext::getPrespecializedGenericMetadataAvailability() {
|
||||||
|
return getSwift52Availability();
|
||||||
|
}
|
||||||
|
|
||||||
|
AvailabilityContext ASTContext::getSwift52Availability() {
|
||||||
auto target = LangOpts.Target;
|
auto target = LangOpts.Target;
|
||||||
|
|
||||||
if (target.isMacOSX() ) {
|
if (target.isMacOSX() ) {
|
||||||
|
|||||||
@@ -1329,6 +1329,15 @@ void IRGenModule::error(SourceLoc loc, const Twine &message) {
|
|||||||
|
|
||||||
bool IRGenModule::useDllStorage() { return ::useDllStorage(Triple); }
|
bool IRGenModule::useDllStorage() { return ::useDllStorage(Triple); }
|
||||||
|
|
||||||
|
bool IRGenModule::shouldPrespecializeGenericMetadata() {
|
||||||
|
auto &context = getSwiftModule()->getASTContext();
|
||||||
|
auto deploymentAvailability =
|
||||||
|
AvailabilityContext::forDeploymentTarget(context);
|
||||||
|
return IRGen.Opts.PrespecializeGenericMetadata &&
|
||||||
|
deploymentAvailability.isContainedIn(
|
||||||
|
context.getPrespecializedGenericMetadataAvailability());
|
||||||
|
}
|
||||||
|
|
||||||
void IRGenerator::addGenModule(SourceFile *SF, IRGenModule *IGM) {
|
void IRGenerator::addGenModule(SourceFile *SF, IRGenModule *IGM) {
|
||||||
assert(GenModules.count(SF) == 0);
|
assert(GenModules.count(SF) == 0);
|
||||||
GenModules[SF] = IGM;
|
GenModules[SF] = IGM;
|
||||||
|
|||||||
@@ -744,6 +744,8 @@ public:
|
|||||||
void error(SourceLoc loc, const Twine &message);
|
void error(SourceLoc loc, const Twine &message);
|
||||||
|
|
||||||
bool useDllStorage();
|
bool useDllStorage();
|
||||||
|
|
||||||
|
bool shouldPrespecializeGenericMetadata();
|
||||||
|
|
||||||
Size getAtomicBoolSize() const { return AtomicBoolSize; }
|
Size getAtomicBoolSize() const { return AtomicBoolSize; }
|
||||||
Alignment getAtomicBoolAlignment() const { return AtomicBoolAlign; }
|
Alignment getAtomicBoolAlignment() const { return AtomicBoolAlign; }
|
||||||
|
|||||||
Reference in New Issue
Block a user