@@ -1473,6 +1473,7 @@ static void swift_job_runImpl(Job *job, ExecutorRef executor) {
1473
1473
// / the actor lives for the duration of job execution.
1474
1474
// / Note that this may conflict with the retain/release
1475
1475
// / design in the DefaultActorImpl, but it does fix bugs!
1476
+ SWIFT_CC (swiftasync)
1476
1477
static void processDefaultActor (DefaultActorImpl *currentActor,
1477
1478
RunningJobInfo runner) {
1478
1479
#if SWIFT_TASK_PRINTF_DEBUG
@@ -1547,6 +1548,7 @@ static void processDefaultActor(DefaultActorImpl *currentActor,
1547
1548
swift_release (actor);
1548
1549
}
1549
1550
1551
+ SWIFT_CC (swiftasync)
1550
1552
void ProcessInlineJob::process (Job *job) {
1551
1553
DefaultActorImpl *actor = DefaultActorImpl::fromInlineJob (job);
1552
1554
@@ -1555,11 +1557,11 @@ void ProcessInlineJob::process(Job *job) {
1555
1557
auto targetPriority = job->getPriority ();
1556
1558
auto runner = RunningJobInfo::forInline (targetPriority);
1557
1559
1558
- // FIXME: force tail call
1559
1560
swift_retain (actor);
1560
- return processDefaultActor (actor, runner);
1561
+ return processDefaultActor (actor, runner); // 'return' forces tail call
1561
1562
}
1562
1563
1564
+ SWIFT_CC (swiftasync)
1563
1565
void ProcessOutOfLineJob::process (Job *job) {
1564
1566
auto self = cast<ProcessOutOfLineJob>(job);
1565
1567
DefaultActorImpl *actor = self->Actor ;
@@ -1571,21 +1573,20 @@ void ProcessOutOfLineJob::process(Job *job) {
1571
1573
1572
1574
delete self;
1573
1575
1574
- // FIXME: force tail call
1575
1576
swift_retain (actor);
1576
- return processDefaultActor (actor, runner);
1577
+ return processDefaultActor (actor, runner); // 'return' forces tail call
1577
1578
}
1578
1579
1580
+ SWIFT_CC (swiftasync)
1579
1581
void ProcessOverrideJob::process (Job *job) {
1580
1582
auto self = cast<ProcessOverrideJob>(job);
1581
1583
1582
1584
// Pull the actor and priority out of the job.
1583
1585
auto actor = self->Actor ;
1584
1586
auto runner = RunningJobInfo::forOverride (self);
1585
1587
1586
- // FIXME: force tail call
1587
1588
swift_retain (actor);
1588
- return processDefaultActor (actor, runner);
1589
+ return processDefaultActor (actor, runner); // 'return' forces tail call
1589
1590
}
1590
1591
1591
1592
void DefaultActorImpl::enqueue (Job *job) {
@@ -1814,8 +1815,7 @@ static void runOnAssumedThread(AsyncTask *task, ExecutorRef executor,
1814
1815
if (oldTracking) {
1815
1816
oldTracking->setActiveExecutor (executor);
1816
1817
1817
- // FIXME: force tail call
1818
- return task->runInFullyEstablishedContext ();
1818
+ return task->runInFullyEstablishedContext (); // 'return' forces tail call
1819
1819
}
1820
1820
1821
1821
// Otherwise, set up tracking info.
@@ -1858,8 +1858,7 @@ static void swift_task_switchImpl(SWIFT_ASYNC_CONTEXT AsyncContext *resumeContex
1858
1858
// we can just immediately continue running with the resume function
1859
1859
// we were passed in.
1860
1860
if (!currentExecutor.mustSwitchToRun (newExecutor)) {
1861
- // FIXME: force tail call
1862
- return resumeFunction (resumeContext);
1861
+ return resumeFunction (resumeContext); // 'return' forces tail call
1863
1862
}
1864
1863
1865
1864
auto task = swift_task_getCurrent ();
@@ -1883,7 +1882,7 @@ static void swift_task_switchImpl(SWIFT_ASYNC_CONTEXT AsyncContext *resumeContex
1883
1882
fprintf (stderr, " [%p] switch succeeded, task %p assumed thread for executor %p\n " , pthread_self (), task, newExecutor.getIdentity ());
1884
1883
#endif
1885
1884
giveUpThreadForSwitch (currentExecutor, runner);
1886
- // FIXME: force tail call
1885
+ // 'return' forces tail call
1887
1886
return runOnAssumedThread (task, newExecutor, trackingInfo, runner);
1888
1887
}
1889
1888
0 commit comments