@@ -1744,36 +1744,14 @@ const TypeLayoutEntry &IRGenModule::getTypeLayoutEntry(SILType T) {
1744
1744
return Types.getTypeLayoutEntry (T);
1745
1745
}
1746
1746
1747
- // / Return whether FrameLowering should always set the "extended frame
1748
- // / present" bit in FP, or set it based on a symbol in the runtime.
1749
- static bool isSwiftAsyncContextIsDynamicallySet (llvm::Triple TT) {
1750
- // Older OS versions (particularly system unwinders) are confused by the
1751
- // Swift extended frame, so when building code that might be run on them we
1752
- // must dynamically query the concurrency library to determine whether
1753
- // extended frames should be flagged as present.
1754
- unsigned Major, Minor, Micro;
1755
- TT.getOSVersion (Major, Minor, Micro);
1756
- switch (TT.getOS ()) {
1757
- default :
1758
- return false ;
1759
- case llvm::Triple::IOS:
1760
- case llvm::Triple::TvOS:
1761
- return Major < 15 ;
1762
- case llvm::Triple::WatchOS:
1763
- return Major < 8 ;
1764
- case llvm::Triple::MacOSX:
1765
- case llvm::Triple::Darwin:
1766
- return Major < 12 ;
1767
- }
1768
- }
1769
1747
1770
1748
void IRGenModule::emitSwiftAsyncExtendedFrameInfoWeakRef () {
1771
1749
if (!hasSwiftAsyncFunctionDef || extendedFramePointerFlagsWeakRef)
1772
1750
return ;
1773
1751
if (IRGen.Opts .SwiftAsyncFramePointer !=
1774
1752
SwiftAsyncFramePointerKind::Auto)
1775
1753
return ;
1776
- if (! isSwiftAsyncContextIsDynamicallySet (Triple ))
1754
+ if (isConcurrencyAvailable ( ))
1777
1755
return ;
1778
1756
1779
1757
// Emit a weak reference to the `swift_async_extendedFramePointerFlags` symbol
@@ -1785,3 +1763,10 @@ void IRGenModule::emitSwiftAsyncExtendedFrameInfoWeakRef() {
1785
1763
llvm::GlobalValue::ExternalWeakLinkage, nullptr ,
1786
1764
symbolName);
1787
1765
}
1766
+
1767
+ bool IRGenModule::isConcurrencyAvailable () {
1768
+ auto &ctx = getSwiftModule ()->getASTContext ();
1769
+ auto deploymentAvailability =
1770
+ AvailabilityContext::forDeploymentTarget (ctx);
1771
+ return deploymentAvailability.isContainedIn (ctx.getConcurrencyAvailability ());
1772
+ }
0 commit comments