File tree 2 files changed +14
-9
lines changed
include/swift/RemoteInspection
2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -1929,12 +1929,17 @@ class ReflectionContext
1929
1929
Fptr == target_task_wait_throwing_resume_adapter) ||
1930
1930
(target_task_future_wait_resume_adapter &&
1931
1931
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
+ }
1938
1943
}
1939
1944
}
1940
1945
Original file line number Diff line number Diff line change @@ -82,8 +82,7 @@ template <typename Runtime>
82
82
struct StackAllocator {
83
83
typename Runtime::StoredPointer LastAllocation;
84
84
typename Runtime::StoredPointer FirstSlab;
85
- int32_t NumAllocatedSlabs;
86
- bool FirstSlabIsPreallocated;
85
+ int32_t NumAllocatedSlabsAndFirstSlabIsPreallocated;
87
86
88
87
struct Slab {
89
88
typename Runtime::StoredPointer Metadata;
@@ -123,7 +122,8 @@ struct AsyncTaskPrivateStorage {
123
122
StackAllocator<Runtime> Allocator;
124
123
typename Runtime::StoredPointer Local;
125
124
uint32_t Id;
126
- uint32_t BasePriority;
125
+ typename Runtime::StoredSize BasePriority;
126
+ typename Runtime::StoredPointer DependencyRecord;
127
127
};
128
128
129
129
template <typename Runtime, typename ActiveTaskStatus>
You can’t perform that action at this time.
0 commit comments