@@ -1778,36 +1778,14 @@ const TypeLayoutEntry &IRGenModule::getTypeLayoutEntry(SILType T) {
1778
1778
return Types.getTypeLayoutEntry (T);
1779
1779
}
1780
1780
1781
- // / Return whether FrameLowering should always set the "extended frame
1782
- // / present" bit in FP, or set it based on a symbol in the runtime.
1783
- static bool isSwiftAsyncContextIsDynamicallySet (llvm::Triple TT) {
1784
- // Older OS versions (particularly system unwinders) are confused by the
1785
- // Swift extended frame, so when building code that might be run on them we
1786
- // must dynamically query the concurrency library to determine whether
1787
- // extended frames should be flagged as present.
1788
- unsigned Major, Minor, Micro;
1789
- TT.getOSVersion (Major, Minor, Micro);
1790
- switch (TT.getOS ()) {
1791
- default :
1792
- return false ;
1793
- case llvm::Triple::IOS:
1794
- case llvm::Triple::TvOS:
1795
- return Major < 15 ;
1796
- case llvm::Triple::WatchOS:
1797
- return Major < 8 ;
1798
- case llvm::Triple::MacOSX:
1799
- case llvm::Triple::Darwin:
1800
- return Major < 12 ;
1801
- }
1802
- }
1803
1781
1804
1782
void IRGenModule::emitSwiftAsyncExtendedFrameInfoWeakRef () {
1805
1783
if (!hasSwiftAsyncFunctionDef || extendedFramePointerFlagsWeakRef)
1806
1784
return ;
1807
1785
if (IRGen.Opts .SwiftAsyncFramePointer !=
1808
1786
SwiftAsyncFramePointerKind::Auto)
1809
1787
return ;
1810
- if (! isSwiftAsyncContextIsDynamicallySet (Triple ))
1788
+ if (isConcurrencyAvailable ( ))
1811
1789
return ;
1812
1790
1813
1791
// Emit a weak reference to the `swift_async_extendedFramePointerFlags` symbol
@@ -1819,3 +1797,10 @@ void IRGenModule::emitSwiftAsyncExtendedFrameInfoWeakRef() {
1819
1797
llvm::GlobalValue::ExternalWeakLinkage, nullptr ,
1820
1798
symbolName);
1821
1799
}
1800
+
1801
+ bool IRGenModule::isConcurrencyAvailable () {
1802
+ auto &ctx = getSwiftModule ()->getASTContext ();
1803
+ auto deploymentAvailability =
1804
+ AvailabilityContext::forDeploymentTarget (ctx);
1805
+ return deploymentAvailability.isContainedIn (ctx.getConcurrencyAvailability ());
1806
+ }
0 commit comments