@@ -590,11 +590,10 @@ void SILGenFunction::emitHopToActorValue(SILLocation loc, ManagedValue actor) {
590
590
executor, /* mandatory*/ true );
591
591
}
592
592
593
- void SILGenFunction::emitPreconditionCheckExpectedExecutor (
594
- SILLocation loc, SILValue executorOrActor) {
593
+ static bool isCheckExpectedExecutorIntrinsicAvailable (SILGenModule &SGM) {
595
594
auto checkExecutor = SGM.getCheckExpectedExecutor ();
596
595
if (!checkExecutor)
597
- return ;
596
+ return false ;
598
597
599
598
// Forego a check if instrinsic is unavailable, this could happen
600
599
// in main-actor context.
@@ -603,10 +602,28 @@ void SILGenFunction::emitPreconditionCheckExpectedExecutor(
603
602
auto deploymentAvailability = AvailabilityContext::forDeploymentTarget (C);
604
603
auto declAvailability =
605
604
AvailabilityInference::availableRange (checkExecutor, C);
606
- if (!deploymentAvailability.isContainedIn (declAvailability))
607
- return ;
605
+ return deploymentAvailability.isContainedIn (declAvailability);
608
606
}
609
607
608
+ return true ;
609
+ }
610
+
611
+ void SILGenFunction::emitPreconditionCheckExpectedExecutor (
612
+ SILLocation loc, ActorIsolation isolation,
613
+ std::optional<ManagedValue> actorSelf) {
614
+ if (!isCheckExpectedExecutorIntrinsicAvailable (SGM))
615
+ return ;
616
+
617
+ auto executor = emitExecutor (loc, isolation, actorSelf);
618
+ assert (executor);
619
+ emitPreconditionCheckExpectedExecutor (loc, *executor);
620
+ }
621
+
622
+ void SILGenFunction::emitPreconditionCheckExpectedExecutor (
623
+ SILLocation loc, SILValue executorOrActor) {
624
+ if (!isCheckExpectedExecutorIntrinsicAvailable (SGM))
625
+ return ;
626
+
610
627
// We don't want the debugger to step into these.
611
628
loc.markAutoGenerated ();
612
629
@@ -617,7 +634,7 @@ void SILGenFunction::emitPreconditionCheckExpectedExecutor(
617
634
auto args = emitSourceLocationArgs (loc.getSourceLoc (), loc);
618
635
619
636
emitApplyOfLibraryIntrinsic (
620
- loc, checkExecutor , SubstitutionMap (),
637
+ loc, SGM. getCheckExpectedExecutor () , SubstitutionMap (),
621
638
{args.filenameStartPointer , args.filenameLength , args.filenameIsAscii ,
622
639
args.line , ManagedValue::forObjectRValueWithoutOwnership (executor)},
623
640
SGFContext ());
0 commit comments