We've been building up this exponential explosion of task-creation
builtins because it's not currently possible to overload builtins.
As long as all of the operands are scalar, though, it's pretty easy
to peephole optional injections in IRGen, which means we can at
least just use a single builtin in SIL and then break it apart in
IRGen to decide which options to set.
I also eliminated the metadata argument, which can easily be recreated
from the substitutions. I also added proper verification for the builtin,
which required (1) getting `@Sendable` right more consistently and (2)
updating a bunch of tests checking for things that are not actually
valid, like passing a function that returns an Int directly.
With libdispatch executor, `level` function is called on non-main thread
because it does not specify main executor explicitly. Therefore, the
crash message from swift-backtrace says `Thread 1 crashed: ...`.
However, with single threaded executor, all jobs are executed on the
main thread, and main thread always has its name, so the message can be
thread name 'Thread 0 "CrashAsync" crashed:'.
If ASAN is enabled, it will catch the crashes and the backtracing code
won't, so in that case the tests will fail. Fix by disabling them for
ASAN.
rdar://107129465
The CI nodes currently run an older macOS version that can't demangle the
async function names. So, to pass PR testing and CI, we'll need to turn
demangling off for this test for now. No big deal.
rdar://106363539
These weren't working correctly because I made the unwinder call
`_swift_task_getCurrent()`, but of course when out-of-process, it calls
that in `swift-backtrace`, which is wrong. Remove that for now.
While I'm here, I also tweaked the formatting slightly, and I noticed
that we were saying that all thunks were also system functions, which
seemed unnecessary and odd.
Plus there were a couple of extra system functions I added to make the
async crash backtraces nicer in friendly mode.
rdar://106363539