File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
include/swift/RemoteInspection Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -1929,12 +1929,17 @@ class ReflectionContext
19291929 Fptr == target_task_wait_throwing_resume_adapter) ||
19301930 (target_task_future_wait_resume_adapter &&
19311931 Fptr == target_task_future_wait_resume_adapter)) {
1932- auto ContextBytes = getReader ().readBytes (RemoteAddress (ResumeContextPtr),
1933- sizeof (AsyncContext<Runtime>));
1934- if (ContextBytes) {
1935- auto ContextPtr =
1936- reinterpret_cast <const AsyncContext<Runtime> *>(ContextBytes.get ());
1937- return stripSignedPointer (ContextPtr->ResumeParent );
1932+ // It's only safe to look through these adapters when there's a dependency
1933+ // record. If there isn't a dependency record, then the task was resumed
1934+ // and the pointers are potentially stale.
1935+ if (AsyncTaskObj->PrivateStorage .DependencyRecord ) {
1936+ auto ContextBytes = getReader ().readBytes (
1937+ RemoteAddress (ResumeContextPtr), sizeof (AsyncContext<Runtime>));
1938+ if (ContextBytes) {
1939+ auto ContextPtr = reinterpret_cast <const AsyncContext<Runtime> *>(
1940+ ContextBytes.get ());
1941+ return stripSignedPointer (ContextPtr->ResumeParent );
1942+ }
19381943 }
19391944 }
19401945
Original file line number Diff line number Diff line change @@ -82,8 +82,7 @@ template <typename Runtime>
8282struct StackAllocator {
8383 typename Runtime::StoredPointer LastAllocation;
8484 typename Runtime::StoredPointer FirstSlab;
85- int32_t NumAllocatedSlabs;
86- bool FirstSlabIsPreallocated;
85+ int32_t NumAllocatedSlabsAndFirstSlabIsPreallocated;
8786
8887 struct Slab {
8988 typename Runtime::StoredPointer Metadata;
@@ -123,7 +122,8 @@ struct AsyncTaskPrivateStorage {
123122 StackAllocator<Runtime> Allocator;
124123 typename Runtime::StoredPointer Local;
125124 uint32_t Id;
126- uint32_t BasePriority;
125+ typename Runtime::StoredSize BasePriority;
126+ typename Runtime::StoredPointer DependencyRecord;
127127};
128128
129129template <typename Runtime, typename ActiveTaskStatus>
You can’t perform that action at this time.
0 commit comments