@@ -794,7 +794,7 @@ class alignas(sizeof(void *) * 2) ActiveActorStatus {
794
794
}
795
795
#endif
796
796
797
- void traceStateChanged (HeapObject *actor) {
797
+ void traceStateChanged (HeapObject *actor, bool distributedActorIsRemote ) {
798
798
// Convert our state to a consistent raw value. These values currently match
799
799
// the enum values, but this explicit conversion provides room for change.
800
800
uint8_t traceState = 255 ;
@@ -814,7 +814,7 @@ class alignas(sizeof(void *) * 2) ActiveActorStatus {
814
814
}
815
815
concurrency::trace::actor_state_changed (
816
816
actor, getFirstJob ().getRawJob (), getFirstJob ().needsPreprocessing (),
817
- traceState, swift_distributed_actor_is_remote ((HeapObject *) actor) ,
817
+ traceState, distributedActorIsRemote ,
818
818
isMaxPriorityEscalated (), static_cast <uint8_t >(getMaxPriority ()));
819
819
}
820
820
};
@@ -1176,12 +1176,12 @@ static void traceJobQueue(DefaultActorImpl *actor, Job *first) {
1176
1176
}
1177
1177
1178
1178
static SWIFT_ATTRIBUTE_ALWAYS_INLINE void traceActorStateTransition (DefaultActorImpl *actor,
1179
- ActiveActorStatus oldState, ActiveActorStatus newState) {
1179
+ ActiveActorStatus oldState, ActiveActorStatus newState, bool distributedActorIsRemote ) {
1180
1180
1181
1181
SWIFT_TASK_DEBUG_LOG (" Actor %p transitioned from %#x to %#x (%s)" , actor,
1182
1182
oldState.getOpaqueFlags (), newState.getOpaqueFlags (),
1183
1183
__FUNCTION__);
1184
- newState.traceStateChanged (actor);
1184
+ newState.traceStateChanged (actor, distributedActorIsRemote );
1185
1185
}
1186
1186
1187
1187
#if SWIFT_CONCURRENCY_ENABLE_PRIORITY_ESCALATION
@@ -1206,6 +1206,7 @@ void DefaultActorImpl::enqueue(Job *job, JobPriority priority) {
1206
1206
SWIFT_TASK_DEBUG_LOG (" Enqueueing job %p onto actor %p at priority %#zx" , job,
1207
1207
this , priority);
1208
1208
concurrency::trace::actor_enqueue (this , job);
1209
+ bool distributedActorIsRemote = swift_distributed_actor_is_remote (this );
1209
1210
auto oldState = _status ().load (std::memory_order_relaxed);
1210
1211
while (true ) {
1211
1212
auto newState = oldState;
@@ -1233,7 +1234,7 @@ void DefaultActorImpl::enqueue(Job *job, JobPriority priority) {
1233
1234
if (_status ().compare_exchange_weak (oldState, newState,
1234
1235
/* success */ std::memory_order_release,
1235
1236
/* failure */ std::memory_order_relaxed)) {
1236
- traceActorStateTransition (this , oldState, newState);
1237
+ traceActorStateTransition (this , oldState, newState, distributedActorIsRemote );
1237
1238
1238
1239
if (!oldState.isScheduled () && newState.isScheduled ()) {
1239
1240
// We took responsibility to schedule the actor for the first time. See
@@ -1276,6 +1277,7 @@ void DefaultActorImpl::enqueueStealer(Job *job, JobPriority priority) {
1276
1277
1277
1278
SWIFT_TASK_DEBUG_LOG (" [Override] Escalating an actor %p due to job that is enqueued being escalated" , this );
1278
1279
1280
+ bool distributedActorIsRemote = swift_distributed_actor_is_remote (this );
1279
1281
auto oldState = _status ().load (std::memory_order_relaxed);
1280
1282
while (true ) {
1281
1283
// Until we figure out how to safely enqueue a stealer and rendevouz with
@@ -1314,7 +1316,7 @@ void DefaultActorImpl::enqueueStealer(Job *job, JobPriority priority) {
1314
1316
if (_status ().compare_exchange_weak (oldState, newState,
1315
1317
/* success */ std::memory_order_relaxed,
1316
1318
/* failure */ std::memory_order_relaxed)) {
1317
- traceActorStateTransition (this , oldState, newState);
1319
+ traceActorStateTransition (this , oldState, newState, distributedActorIsRemote );
1318
1320
#if SWIFT_CONCURRENCY_ENABLE_PRIORITY_ESCALATION
1319
1321
if (newState.isRunning ()) {
1320
1322
// Actor is running on a thread, escalate the thread running it
@@ -1344,6 +1346,7 @@ Job * DefaultActorImpl::drainOne() {
1344
1346
SWIFT_TASK_DEBUG_LOG (" Draining one job from default actor %p" , this );
1345
1347
1346
1348
// Pairs with the store release in DefaultActorImpl::enqueue
1349
+ bool distributedActorIsRemote = swift_distributed_actor_is_remote (this );
1347
1350
auto oldState = _status ().load (SWIFT_MEMORY_ORDER_CONSUME);
1348
1351
_swift_tsan_consume (this );
1349
1352
@@ -1367,7 +1370,7 @@ Job * DefaultActorImpl::drainOne() {
1367
1370
/* success */ std::memory_order_relaxed,
1368
1371
/* failure */ std::memory_order_relaxed)) {
1369
1372
SWIFT_TASK_DEBUG_LOG (" Drained first job %p from actor %p" , firstJob, this );
1370
- traceActorStateTransition (this , oldState, newState);
1373
+ traceActorStateTransition (this , oldState, newState, distributedActorIsRemote );
1371
1374
concurrency::trace::actor_dequeue (this , firstJob);
1372
1375
return firstJob;
1373
1376
}
@@ -1556,6 +1559,7 @@ retry:;
1556
1559
SWIFT_TASK_DEBUG_LOG (" Thread attempting to jump onto %p, as drainer = %d" , this , asDrainer);
1557
1560
#endif
1558
1561
1562
+ bool distributedActorIsRemote = swift_distributed_actor_is_remote (this );
1559
1563
auto oldState = _status ().load (std::memory_order_relaxed);
1560
1564
while (true ) {
1561
1565
@@ -1612,7 +1616,7 @@ retry:;
1612
1616
std::memory_order_acquire,
1613
1617
std::memory_order_relaxed)) {
1614
1618
_swift_tsan_acquire (this );
1615
- traceActorStateTransition (this , oldState, newState);
1619
+ traceActorStateTransition (this , oldState, newState, distributedActorIsRemote );
1616
1620
return true ;
1617
1621
}
1618
1622
}
@@ -1635,6 +1639,7 @@ bool DefaultActorImpl::unlock(bool forceUnlock)
1635
1639
this ->drainLock .unlock ();
1636
1640
return true ;
1637
1641
#else
1642
+ bool distributedActorIsRemote = swift_distributed_actor_is_remote (this );
1638
1643
auto oldState = _status ().load (std::memory_order_relaxed);
1639
1644
SWIFT_TASK_DEBUG_LOG (" Try unlock-ing actor %p with forceUnlock = %d" , this , forceUnlock);
1640
1645
@@ -1693,7 +1698,7 @@ bool DefaultActorImpl::unlock(bool forceUnlock)
1693
1698
/* success */ std::memory_order_release,
1694
1699
/* failure */ std::memory_order_relaxed)) {
1695
1700
_swift_tsan_release (this );
1696
- traceActorStateTransition (this , oldState, newState);
1701
+ traceActorStateTransition (this , oldState, newState, distributedActorIsRemote );
1697
1702
1698
1703
if (newState.isScheduled ()) {
1699
1704
// See ownership rule (6) in DefaultActorImpl
0 commit comments