To help this test run in production environments, I've reduced the
requirements of the test. It used to require that the compiler was
running on an armv7k or arm64_32 watchOS device, which I don't think is
a test configuration that gets hit all that often.
The new requirements are that you're on watchOS or the simulator, and
can produce arm64_32 code. The test only verifies that the emitted asm
is valid, not that it runs, so we don't need to be running on the
specific hardware. Additionally, the test only checks the output of
arm64_32, not of armvk7, so we only require the 64-bit arm backend.
It would be better if we could check for available SDKs though. The test
only requires an SDK, it doesn't need to be run on the simulator or the
watch.
The optimizer got smarter and stopped emitting a stack frame for the
empty `someAsyncFunction`, so the test started failing. Adding an opaque
function call to the function body forces the function to get set up
properly, so the test starts passing again.
rdar97790231
Introduce a few changes to the logic for watchOS concurrency
back-deployment with respect to the async frame pointer.
* Only apply the change to watchOS device targets, not simulator targets
* Only introduce the override when no specific
`-swift-async-frame-pointer=<value>` option is provided on the
command line
* Only override the default when deploying to watchOS < 8, and
* Use "never" for the default rather than "always".
This represents a different but safer trade-off than before. Setting
the async bit in the frame pointer can cause older APIs (such as
backtrace APIs in the OS) to crash when they encounter such frame
pointers. So, with this change we never set the bit when back-deploying
for watchOS device, to avoid said crashes.
The trade-off here is that a back-deployed watchOS app will never have
the async frame pointer bit set, so async backtraces will be
unavailable even when running on watchOS 8 or newer.
The asm definition of `swift_async_extendedFramePointerFlags` prevents
the use of bitcode with the back-deployment libraries, so remove the
definition and use of this symbol from watchOS binaries entirely.
Instead, always force the async frame bit to be set. This trades off
backtraces on older OS's for debuggability of newer ones. If it causes
problems, it can be disabled via the option
`-swift-async-frame-pointer=never`.
Fixes rdar://84687579.