Skip to content

Commit d72f078

Browse files
committed
[region-isolation] Add ability to Profile an IsolationRegionInfo.
Just slicing down a larger diff to make it easier to review.
1 parent 12aad7c commit d72f078

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

include/swift/SILOptimizer/Utils/PartitionUtils.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,35 @@ class IsolationRegionInfo {
286286
return false;
287287
}
288288
}
289+
290+
void Profile(llvm::FoldingSetNodeID &id) const {
291+
id.AddInteger(getKind());
292+
switch (getKind()) {
293+
case Unknown:
294+
case Disconnected:
295+
return;
296+
case Task:
297+
id.AddPointer(getTaskIsolatedValue());
298+
return;
299+
case Actor:
300+
// We profile in integer cases here so that we can always distinguish in
301+
// between the various cases and the non-case. Just being paranoid.
302+
if (hasActorIsolation()) {
303+
if (auto isolation = getActorIsolation()) {
304+
id.AddInteger(1);
305+
return isolation->Profile(id);
306+
}
307+
}
308+
309+
if (hasActorInstance()) {
310+
id.AddInteger(2);
311+
return id.AddPointer(getActorInstance());
312+
}
313+
314+
id.AddInteger(3);
315+
break;
316+
}
317+
}
289318
};
290319

291320
} // namespace swift

0 commit comments

Comments
 (0)