@@ -590,11 +590,10 @@ void SILGenFunction::emitHopToActorValue(SILLocation loc, ManagedValue actor) {
590590 executor, /* mandatory*/ true );
591591}
592592
593- void SILGenFunction::emitPreconditionCheckExpectedExecutor (
594- SILLocation loc, SILValue executorOrActor) {
593+ static bool isCheckExpectedExecutorIntrinsicAvailable (SILGenModule &SGM) {
595594 auto checkExecutor = SGM.getCheckExpectedExecutor ();
596595 if (!checkExecutor)
597- return ;
596+ return false ;
598597
599598 // Forego a check if instrinsic is unavailable, this could happen
600599 // in main-actor context.
@@ -603,10 +602,28 @@ void SILGenFunction::emitPreconditionCheckExpectedExecutor(
603602 auto deploymentAvailability = AvailabilityContext::forDeploymentTarget (C);
604603 auto declAvailability =
605604 AvailabilityInference::availableRange (checkExecutor, C);
606- if (!deploymentAvailability.isContainedIn (declAvailability))
607- return ;
605+ return deploymentAvailability.isContainedIn (declAvailability);
608606 }
609607
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+
610627 // We don't want the debugger to step into these.
611628 loc.markAutoGenerated ();
612629
@@ -617,7 +634,7 @@ void SILGenFunction::emitPreconditionCheckExpectedExecutor(
617634 auto args = emitSourceLocationArgs (loc.getSourceLoc (), loc);
618635
619636 emitApplyOfLibraryIntrinsic (
620- loc, checkExecutor , SubstitutionMap (),
637+ loc, SGM. getCheckExpectedExecutor () , SubstitutionMap (),
621638 {args.filenameStartPointer , args.filenameLength , args.filenameIsAscii ,
622639 args.line , ManagedValue::forObjectRValueWithoutOwnership (executor)},
623640 SGFContext ());
0 commit comments