Skip to content

Commit c697881

Browse files
author
Atul Katti
committed
[MERGE #5474 @atulkatti] MSFT:16723718 Track RecyclerVisited object allocations using a dummy typeid.
Merge pull request #5474 from atulkatti:Bug16723718.ReenableHtmlTests.1 Also, brings in changes to the RecyclerVisited* allocation APIs to make the code consistent.
2 parents 8a4df57 + 7923234 commit c697881

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

bin/GCStress/RecyclerTestObject.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,17 +387,17 @@ class RecyclerVisitedObject : public RecyclerTestObject
387387
switch (allocType)
388388
{
389389
case AllocationType::TraceAndFinalized:
390-
mem = RecyclerAllocVisitedHostTracedAndFinalizedZero(recyclerInstance, size);
390+
mem = RecyclerAllocVisitedHostTracedAndFinalized(recyclerInstance, size);
391391
break;
392392
case AllocationType::TraceOnly:
393-
mem = RecyclerAllocVisitedHostTracedZero(recyclerInstance, size);
393+
mem = RecyclerAllocVisitedHostTraced(recyclerInstance, size);
394394
break;
395395
case AllocationType::FinalizeLeaf:
396-
mem = RecyclerAllocVisitedHostFinalizedZero(recyclerInstance, size);
396+
mem = RecyclerAllocVisitedHostFinalized(recyclerInstance, size);
397397
break;
398398
default:
399399
Assert(allocType == AllocationType::Leaf);
400-
mem = RecyclerAllocLeafZero(recyclerInstance, size);
400+
mem = RecyclerAllocLeaf(recyclerInstance, size);
401401
}
402402

403403
// Construct the v-table, allocType, and count information for the new object.

lib/Common/Memory/Recycler.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,11 @@ class RecyclerWeakReferenceRegion {
230230
#define RecyclerNewTrackedLeafPlusZ(recycler,size,T,...) static_cast<T *>(static_cast<FinalizableObject *>(AllocatorNewPlusBase(Recycler, recycler, AllocZeroTrackedLeafInlined, size, T, __VA_ARGS__)))
231231

232232
#ifdef RECYCLER_VISITED_HOST
233-
#define RecyclerAllocVisitedHostTracedAndFinalizedZero(recycler,size) recycler->AllocVisitedHost<RecyclerVisitedHostTracedFinalizableBits>(size)
234-
#define RecyclerAllocVisitedHostFinalizedZero(recycler,size) recycler->AllocVisitedHost<RecyclerVisitedHostFinalizableBits>(size)
235-
#define RecyclerAllocVisitedHostTracedZero(recycler,size) recycler->AllocVisitedHost<RecyclerVisitedHostTracedBits>(size)
236-
#define RecyclerAllocLeafZero(recycler,size) recycler->AllocVisitedHost<LeafBit>(size)
233+
// We need to track these allocations. The RecyclerVisitedHost* object allocation APIs don't provide us with the type of the objects being allocated. Use the DummyVTableObject type used elsewhere to track the allocations.
234+
#define RecyclerAllocVisitedHostTracedAndFinalized(recycler,size) (TRACK_ALLOC_INFO(recycler, DummyVTableObject, Recycler, size, (size_t)-1))->AllocVisitedHost<RecyclerVisitedHostTracedFinalizableBits>(size)
235+
#define RecyclerAllocVisitedHostFinalized(recycler,size) (TRACK_ALLOC_INFO(recycler, DummyVTableObject, Recycler, size, (size_t)-1))->AllocVisitedHost<RecyclerVisitedHostFinalizableBits>(size)
236+
#define RecyclerAllocVisitedHostTraced(recycler,size) (TRACK_ALLOC_INFO(recycler, DummyVTableObject, Recycler, size, (size_t)-1))->AllocVisitedHost<RecyclerVisitedHostTracedBits>(size)
237+
#define RecyclerAllocLeaf(recycler,size) (TRACK_ALLOC_INFO(recycler, DummyVTableObject, Recycler, size, (size_t)-1))->AllocVisitedHost<LeafBit>(size)
237238
#endif
238239

239240
#ifdef TRACE_OBJECT_LIFETIME
@@ -1348,7 +1349,7 @@ class Recycler
13481349
template <ObjectInfoBits infoBits>
13491350
char * AllocVisitedHost(DECLSPEC_GUARD_OVERFLOW size_t size)
13501351
{
1351-
return AllocZeroWithAttributes<infoBits, /* nothrow = */ true>(size);
1352+
return AllocWithAttributes<infoBits, /* nothrow = */ true>(size);
13521353
}
13531354

13541355
template<typename T>

0 commit comments

Comments
 (0)