Add Builtin.hopToActor

SILGen this builtin to a mandatory hop_to_executor with an actor type
operand.

e.g.

    Task.detached {
      Builtin.hopToActor(MainActor.shared)
      await suspend()
    }

Required to fix a bug in _runAsyncMain.
This commit is contained in:
Andrew Trick
2021-06-13 21:31:36 -07:00
parent 7d11dc5004
commit c4f1f56ea7
20 changed files with 174 additions and 21 deletions

View File

@@ -1570,6 +1570,14 @@ static ManagedValue emitBuiltinWithUnsafeThrowingContinuation(
/*throws=*/true);
}
static ManagedValue emitBuiltinHopToActor(SILGenFunction &SGF, SILLocation loc,
SubstitutionMap subs,
ArrayRef<ManagedValue> args,
SGFContext C) {
SGF.emitHopToActorValue(loc, args[0]);
return ManagedValue::forUnmanaged(SGF.emitEmptyTuple(loc));
}
static ManagedValue emitBuiltinAutoDiffCreateLinearMapContext(
SILGenFunction &SGF, SILLocation loc, SubstitutionMap subs,
ArrayRef<ManagedValue> args, SGFContext C) {