@@ -28,8 +28,6 @@ struct SwiftError;
28
28
class TaskStatusRecord ;
29
29
class TaskGroup ;
30
30
31
- extern FullMetadata<HeapMetadata> taskLocalHeapItemHeapMetadata;
32
-
33
31
// ==== Task Locals Values ---------------------------------------------------
34
32
35
33
class TaskLocal {
@@ -46,9 +44,6 @@ class TaskLocal {
46
44
// / lookups by skipping empty parent tasks during get(), and explained
47
45
// / in depth in `createParentLink`.
48
46
IsParent = 0b01 ,
49
-
50
- // / The next item is "unstructured" and must be ref-counted.
51
- ThisItemIsHeapItem = 0b10
52
47
};
53
48
54
49
// / Values must match `TaskLocalInheritance` declared in `TaskLocal.swift`.
@@ -133,10 +128,6 @@ class TaskLocal {
133
128
return static_cast <NextLinkType>(next & statusMask);
134
129
}
135
130
136
- bool isHeapItem () const {
137
- return getNextLinkType () == NextLinkType::ThisItemIsHeapItem;
138
- }
139
-
140
131
// / Item does not contain any actual value, and is only used to point at
141
132
// / a specific parent item.
142
133
bool isEmpty () const {
@@ -147,14 +138,13 @@ class TaskLocal {
147
138
OpaqueValue *getStoragePtr () {
148
139
fprintf (stderr, " [%s:%d] (%s) GET STORAGE\n " , __FILE__, __LINE__, __FUNCTION__);
149
140
return reinterpret_cast <OpaqueValue *>(
150
- reinterpret_cast <char *>(this ) + storageOffset (isHeapItem (), valueType));
141
+ reinterpret_cast <char *>(this ) + storageOffset (valueType));
151
142
}
152
143
153
144
// / Compute the offset of the storage from the base of the item.
154
- static size_t storageOffset (bool isHeapItem, const Metadata *valueType) {
145
+ static size_t storageOffset (const Metadata *valueType) {
155
146
size_t offset = sizeof (Item);
156
147
157
-
158
148
if (valueType) {
159
149
size_t alignment = valueType->vw_alignment ();
160
150
return (offset + alignment - 1 ) & ~(alignment - 1 );
@@ -164,54 +154,15 @@ class TaskLocal {
164
154
}
165
155
166
156
// / Determine the size of the item given a particular value type.
167
- static size_t itemSize (bool isHeapItem, const Metadata *valueType) {
168
- size_t offset = storageOffset (isHeapItem, valueType);
169
- size_t headerSize = isHeapItem ? sizeof (HeapObject) : 0 ;
170
- offset += headerSize;
157
+ static size_t itemSize (const Metadata *valueType) {
158
+ size_t offset = storageOffset (valueType);
171
159
if (valueType) {
172
160
offset += valueType->vw_size ();
173
161
}
174
162
return offset;
175
163
}
176
164
};
177
165
178
- // / Heap allocated version of TaskLocal::Item.
179
- // / It is used in limited un-structured concurrency cases, where the task
180
- // / local must be stored on the heap for the time being.
181
- // /
182
- // / MUST HAVE THE SAME LAYOUT AS TaskLocal::Item.
183
- // / FIXME: how to actually make this work...
184
- // / get the address of "after heap object" and cast that to Item?
185
- class HeapItem : public HeapObject , public Item {
186
- public:
187
-
188
- explicit HeapItem (const HeapMetadata *metadata = &taskLocalHeapItemHeapMetadata)
189
- : HeapObject(metadata),
190
- Item() {}
191
-
192
- explicit HeapItem (const HeapObject *key, const Metadata *valueType)
193
- : HeapItem(&taskLocalHeapItemHeapMetadata, key, valueType) {}
194
-
195
- explicit HeapItem (const HeapMetadata *metadata,
196
- const HeapObject *key, const Metadata *valueType)
197
- : HeapObject(metadata),
198
- Item(key, valueType) {}
199
-
200
-
201
- // / Retrieve a pointer to the `Item` that is part of this object.
202
- TaskLocal::Item *getItem () {
203
- fprintf (stderr, " [%s:%d] (%s) GET ITEM PTR, heapItem:%p\n " , __FILE__, __LINE__, __FUNCTION__, this );
204
- return reinterpret_cast <TaskLocal::Item *>(
205
- reinterpret_cast <char *>(this ) + itemOffset ());
206
- }
207
-
208
- // / Compute the offset of `Item` part of this object.
209
- static size_t itemOffset () {
210
- size_t offset = sizeof (HeapObject);
211
- return offset;
212
- }
213
- };
214
-
215
166
class Storage {
216
167
friend class TaskLocal ::Item;
217
168
private:
0 commit comments