Skip to content

Commit 9f8cf80

Browse files
committed
Remove IsolateHeap and fix build errors.
1 parent ab3e8dd commit 9f8cf80

12 files changed

+31
-77
lines changed

lib/Common/ConfigFlagsList.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,6 @@ FLAGNR(Number, MinBailOutsBeforeRejit, "Minimum number of bailouts for a single
13771377
FLAGNR(Number, MinBailOutsBeforeRejitForLoops, "Minimum number of bailouts for a single bailout record after which a rejit is considered", DEFAULT_CONFIG_MinBailOutsBeforeRejitForLoops)
13781378
FLAGNR(Boolean, LibraryStackFrame , "Display library stack frame", DEFAULT_CONFIG_LibraryStackFrame)
13791379
FLAGNR(Boolean, LibraryStackFrameDebugger , "Assume debugger support for library stack frame", DEFAULT_CONFIG_LibraryStackFrameDebugger)
1380-
FLAGNR(Number, RecyclerIsolatedHeapStress, "Stress allocation on isolated heap", 2)
13811380
#ifdef RECYCLER_STRESS
13821381
FLAGNR(Boolean, RecyclerStress , "Stress the recycler by collect on every allocation call", false)
13831382
#if ENABLE_CONCURRENT_GC

lib/Common/Memory/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ set (CCM_SOURCE_FILES ${CCM_SOURCE_FILES}
1212
HeapBlockMap.cpp
1313
HeapBucket.cpp
1414
HeapInfo.cpp
15+
HeapInfoManager.cpp
1516
IdleDecommitPageAllocator.cpp
1617
LargeHeapBlock.cpp
1718
LargeHeapBucket.cpp
@@ -26,6 +27,7 @@ set (CCM_SOURCE_FILES ${CCM_SOURCE_FILES}
2627
RecyclerObjectGraphDumper.cpp
2728
RecyclerPageAllocator.cpp
2829
RecyclerSweep.cpp
30+
RecyclerSweepManager.cpp
2931
RecyclerWriteBarrierManager.cpp
3032
SmallFinalizableHeapBlock.cpp
3133
SmallFinalizableHeapBucket.cpp

lib/Common/Memory/HeapBlock.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ enum ObjectInfoBits : unsigned short
131131
ClientTrackedBit = 0x0400, // This allocation is client tracked
132132
TraceBit = 0x0800,
133133

134-
IsolatedBit = 0x1000,
135-
136134
// Additional definitions based on above
137135

138136
#ifdef RECYCLER_STATS

lib/Common/Memory/HeapInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,7 @@ size_t HeapInfo::GetWriteWatchPageCount()
13111311
}
13121312
#endif
13131313
#endif
1314+
13141315
void
13151316
HeapInfo::SweepPendingObjects(RecyclerSweep& recyclerSweep)
13161317
{
@@ -2108,7 +2109,6 @@ void HeapInfo::ResumeIdleDecommitNonLeaf()
21082109
});
21092110
}
21102111

2111-
#ifdef IDLE_DECOMMIT_ENABLED
21122112
void
21132113
HeapInfo::EnterIdleDecommit()
21142114
{
@@ -2130,6 +2130,7 @@ HeapInfo::LeaveIdleDecommit(bool allowTimer)
21302130
return idleDecommitSignal;
21312131
}
21322132

2133+
#ifdef IDLE_DECOMMIT_ENABLED
21332134
DWORD HeapInfo::IdleDecommit()
21342135
{
21352136
DWORD waitTime = INFINITE;

lib/Common/Memory/HeapInfo.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,8 @@ class HeapInfo
203203
static void * GetAlignedAddress(void * address) { return (void*)((uintptr_t)address & ~(uintptr_t)HeapInfo::ObjectAlignmentMask); }
204204
private:
205205
template <ObjectInfoBits attributes>
206-
typename SmallHeapBlockType<attributes, SmallAllocationBlockAttributes>::BucketType& GetBucket(size_t sizeCat);
206+
typename SmallHeapBlockType<attributes, SmallAllocationBlockAttributes>::BucketType& GetBucket(size_t sizeCat);
207207

208-
void SweepNonFinalizableBuckets(RecyclerSweep& recyclerSweep, bool concurrent);
209-
210208
#ifdef BUCKETIZE_MEDIUM_ALLOCATIONS
211209
#if SMALLBLOCK_MEDIUM_ALLOC
212210
template <ObjectInfoBits attributes>
@@ -376,7 +374,7 @@ class HeapInfo
376374

377375
inline const ValidPointers<TBlockAttributes> GetValidPointersForIndex(uint bucketIndex) const
378376
{
379-
AnalysisAssert(bucketIndex < TBlockAttributes::BucketCount);
377+
AnalysisAssert(bucketIndex < TBlockAttributes::BucketCount);
380378
ushort const * validPointers = nullptr;
381379
#if USE_VPM_TABLE
382380
validPointers = validPointersBuffer[bucketIndex];
@@ -386,7 +384,7 @@ class HeapInfo
386384

387385
inline const typename SmallHeapBlockT<TBlockAttributes>::SmallHeapBlockBitVector * GetInvalidBitVector(uint index) const
388386
{
389-
AnalysisAssert(index < TBlockAttributes::BucketCount);
387+
AnalysisAssert(index < TBlockAttributes::BucketCount);
390388
#if USE_STATIC_VPM
391389
return &(*invalidBitsBuffers)[index];
392390
#else
@@ -503,9 +501,10 @@ class HeapInfo
503501

504502
void SuspendIdleDecommitNonLeaf();
505503
void ResumeIdleDecommitNonLeaf();
506-
#ifdef IDLE_DECOMMIT_ENABLED
504+
507505
void EnterIdleDecommit();
508506
IdleDecommitSignal LeaveIdleDecommit(bool allowTimer);
507+
#ifdef IDLE_DECOMMIT_ENABLED
509508
DWORD IdleDecommit();
510509
#endif
511510
#if DBG

lib/Common/Memory/HeapInfoManager.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,35 @@ namespace Memory
99
template <class Fn>
1010
bool HeapInfoManager::AreAllHeapInfo(Fn fn)
1111
{
12-
return fn(defaultHeap) && fn(isolatedHeap);
12+
return fn(defaultHeap);
1313
}
1414

1515
template <class Fn>
1616
bool HeapInfoManager::IsAnyHeapInfo(Fn fn)
1717
{
18-
return fn(defaultHeap) || fn(isolatedHeap);
18+
return fn(defaultHeap);
1919
}
2020

2121
template <class Fn>
2222
void HeapInfoManager::ForEachHeapInfo(Fn fn)
2323
{
2424
fn(defaultHeap);
25-
fn(isolatedHeap);
2625
}
2726

2827
template <class Fn>
2928
void HeapInfoManager::ForEachHeapInfo(RecyclerSweepManager& recyclerSweepManager, Fn fn)
3029
{
3130
fn(defaultHeap, recyclerSweepManager.defaultHeapRecyclerSweep);
32-
fn(isolatedHeap, recyclerSweepManager.isolatedHeapRecyclerSweep);
3331
}
3432

3533
template <class Fn>
3634
void HeapInfoManager::ForEachHeapInfo(RecyclerSweepManager * recyclerSweepManager, Fn fn)
3735
{
3836
fn(defaultHeap, recyclerSweepManager? &recyclerSweepManager->defaultHeapRecyclerSweep : nullptr);
39-
fn(isolatedHeap, recyclerSweepManager? &recyclerSweepManager->isolatedHeapRecyclerSweep : nullptr);
4037
}
4138

4239
HeapInfoManager::HeapInfoManager(AllocationPolicyManager * policyManager, Js::ConfigFlagsTable& configFlagsTable, IdleDecommitPageAllocator * leafPageAllocator) :
43-
isolatedLeafPageAllocator(&isolatedHeap, policyManager, configFlagsTable, RecyclerHeuristic::Instance.DefaultMaxFreePageCount, RecyclerHeuristic::Instance.DefaultMaxAllocPageCount),
4440
defaultHeap(policyManager, configFlagsTable, leafPageAllocator),
45-
isolatedHeap(policyManager, configFlagsTable, &isolatedLeafPageAllocator),
4641
#if ENABLE_PARTIAL_GC
4742
uncollectedNewPageCount(0),
4843
unusedPartialCollectFreeBytes(0),
@@ -474,7 +469,6 @@ HeapInfoManager::Close()
474469
{
475470
heapInfo.CloseNonLeaf();
476471
});
477-
this->isolatedLeafPageAllocator.Close();
478472
}
479473

480474
void
@@ -494,7 +488,7 @@ HeapInfoManager::ResumeIdleDecommitNonLeaf()
494488
heapInfo.ResumeIdleDecommitNonLeaf();
495489
});
496490
}
497-
#ifdef IDLE_DECOMMIT_ENABLED
491+
498492
void
499493
HeapInfoManager::EnterIdleDecommit()
500494
{
@@ -516,6 +510,7 @@ HeapInfoManager::LeaveIdleDecommit(bool allowTimer)
516510
return idleDecommitSignal;
517511
}
518512

513+
#ifdef IDLE_DECOMMIT_ENABLED
519514
DWORD
520515
HeapInfoManager::IdleDecommit()
521516
{

lib/Common/Memory/HeapInfoManager.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ class HeapInfoManager
1818
return &defaultHeap;
1919
}
2020

21-
HeapInfo * GetIsolatedHeap()
22-
{
23-
return &isolatedHeap;
24-
}
25-
2621
void Initialize(Recycler * recycler
2722
#ifdef RECYCLER_PAGE_HEAP
2823
, PageHeapMode pageheapmode = PageHeapMode::PageHeapModeOff
@@ -109,9 +104,9 @@ class HeapInfoManager
109104

110105
void SuspendIdleDecommitNonLeaf();
111106
void ResumeIdleDecommitNonLeaf();
112-
#ifdef IDLE_DECOMMIT_ENABLED
113107
void EnterIdleDecommit();
114108
IdleDecommitSignal LeaveIdleDecommit(bool allowTimer);
109+
#ifdef IDLE_DECOMMIT_ENABLED
115110
DWORD IdleDecommit();
116111
#endif
117112
#if DBG
@@ -204,10 +199,7 @@ class HeapInfoManager
204199
friend class HeapInfo;
205200
friend class RecyclerSweepManager;
206201

207-
RecyclerPageAllocator isolatedLeafPageAllocator;
208202
HeapInfo defaultHeap;
209-
HeapInfo isolatedHeap;
210-
211203

212204
size_t uncollectedAllocBytes;
213205
size_t lastUncollectedAllocBytes;

lib/Common/Memory/Recycler.cpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ Recycler::Recycler(AllocationPolicyManager * policyManager, IdleDecommitPageAllo
169169
#if DBG
170170
isExternalStackSkippingGC(false),
171171
isProcessingRescan(false),
172-
recyclerIsolatedHeapStressAllocationCount(0),
173172
#endif
174173
#if ENABLE_PARTIAL_GC
175174
inPartialCollectMode(false),
@@ -1054,15 +1053,14 @@ Recycler::LeaveIdleDecommit()
10541053
Output::Flush();
10551054
}
10561055
#endif
1056+
1057+
#pragma prefast(suppress:6387, "INVALID_PARAM_VALUE_1 We will never reach here if concurrentIdleDecommitEvent is NULL.");
10571058
SetEvent(this->concurrentIdleDecommitEvent);
10581059
}
10591060
}
10601061

10611062
#else
1062-
ForEachPageAllocator([](IdleDecommitPageAllocator* pageAlloc)
1063-
{
1064-
pageAlloc->LeaveIdleDecommit(false);
1065-
});
1063+
autoHeap.LeaveIdleDecommit(false /*allowTimer*/);
10661064
#endif
10671065
}
10681066

@@ -1178,14 +1176,7 @@ bool Recycler::ExplicitFreeInternal(void* buffer, size_t size, size_t sizeCat)
11781176
Assert(heapBlock != nullptr);
11791177

11801178
#if DBG
1181-
if (this->GetRecyclerFlagsTable().RecyclerIsolatedHeapStress != 0)
1182-
{
1183-
heapInfo = heapBlock->GetHeapInfo();
1184-
}
1185-
else
1186-
{
1187-
Assert(heapInfo == heapBlock->GetHeapInfo());
1188-
}
1179+
Assert(heapInfo == heapBlock->GetHeapInfo());
11891180
#endif
11901181

11911182
#ifdef RECYCLER_PAGE_HEAP
@@ -1387,11 +1378,7 @@ void Recycler::GetNormalHeapBlockAllocatorInfoForNativeAllocation(size_t allocSi
13871378
Assert(HeapInfo::IsSmallObject(allocSize));
13881379

13891380
allocatorAddress = (char*)this + offsetof(Recycler, autoHeap)
1390-
#ifdef RECYCLER_ISOLATED_HEAP
1391-
+ (isolated ? offsetof(HeapInfoManager, isolatedHeap) : offsetof(HeapInfoManager, defaultHeap))
1392-
#else
13931381
+ offsetof(HeapInfoManager, defaultHeap)
1394-
#endif
13951382
+ offsetof(HeapInfo, heapBuckets)
13961383
+ sizeof(HeapBucketGroup<SmallAllocationBlockAttributes>)*((uint)(allocSize >> HeapConstants::ObjectAllocationShift) - 1)
13971384
+ HeapBucketGroup<SmallAllocationBlockAttributes>::GetHeapBucketOffset()
@@ -3186,7 +3173,7 @@ Recycler::SweepHeap(bool concurrent, RecyclerSweepManager& recyclerSweepManager)
31863173
#if ENABLE_BACKGROUND_PAGE_ZEROING
31873174
if (CONFIG_FLAG(EnableBGFreeZero))
31883175
{
3189-
Assert(!autoHeap.HasZeroQueuedPages());
3176+
Assert(!autoHeap.HasZeroQueuedPages());
31903177
}
31913178
#endif
31923179

lib/Common/Memory/Recycler.h

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,32 +1074,15 @@ class Recycler
10741074
template <ObjectInfoBits attributes>
10751075
HeapInfo * GetHeapInfoForAllocation()
10761076
{
1077-
#if DBG
1078-
if (this->GetRecyclerFlagsTable().IsEnabled(Js::RecyclerIsolatedHeapStressFlag))
1079-
{
1080-
recyclerIsolatedHeapStressAllocationCount++;
1081-
if ((recyclerIsolatedHeapStressAllocationCount % this->GetRecyclerFlagsTable().RecyclerIsolatedHeapStress) != 0)
1082-
{
1083-
return this->autoHeap.GetIsolatedHeap();
1084-
}
1085-
}
1086-
#endif
10871077
return this->GetHeapInfo<attributes>();
10881078
}
10891079

10901080
template <ObjectInfoBits attributes>
10911081
HeapInfo * GetHeapInfo()
10921082
{
1093-
if (attributes & IsolatedBit)
1094-
{
1095-
return this->autoHeap.GetIsolatedHeap();
1096-
}
10971083
return this->autoHeap.GetDefaultHeap();
10981084
}
10991085

1100-
#if DBG
1101-
uint recyclerIsolatedHeapStressAllocationCount;
1102-
#endif
11031086
#ifdef PROFILE_MEM
11041087
RecyclerMemoryData * memoryData;
11051088
#endif
@@ -1167,7 +1150,6 @@ class Recycler
11671150

11681151
void Prime();
11691152
void* GetOwnerContext() { return (void*) this->collectionWrapper; }
1170-
//PageAllocator * GetPageAllocator() { return threadPageAllocator; }
11711153
bool NeedOOMRescan() const;
11721154
void SetNeedOOMRescan();
11731155
void ClearNeedOOMRescan();
@@ -1377,21 +1359,21 @@ class Recycler
13771359
char* GetAddressOfAllocator(size_t sizeCat)
13781360
{
13791361
Assert(HeapInfo::IsAlignedSmallObjectSize(sizeCat));
1380-
return (char*)this->GetHeapInfo<attributes>()->GetBucket<(ObjectInfoBits)(attributes & GetBlockTypeBitMask)>(sizeCat).GetAllocator();
1362+
return (char*)this->GetHeapInfo<attributes>()->template GetBucket<(ObjectInfoBits)(attributes & GetBlockTypeBitMask)>(sizeCat).GetAllocator();
13811363
}
13821364

13831365
template <ObjectInfoBits attributes>
13841366
uint32 GetEndAddressOffset(size_t sizeCat)
13851367
{
13861368
Assert(HeapInfo::IsAlignedSmallObjectSize(sizeCat));
1387-
return this->GetHeapInfo<attributes>()->GetBucket<(ObjectInfoBits)(attributes & GetBlockTypeBitMask)>(sizeCat).GetAllocator()->GetEndAddressOffset();
1369+
return this->GetHeapInfo<attributes>()->template GetBucket<(ObjectInfoBits)(attributes & GetBlockTypeBitMask)>(sizeCat).GetAllocator()->GetEndAddressOffset();
13881370
}
13891371

13901372
template <ObjectInfoBits attributes>
13911373
uint32 GetFreeObjectListOffset(size_t sizeCat)
13921374
{
13931375
Assert(HeapInfo::IsAlignedSmallObjectSize(sizeCat));
1394-
return this->GetHeapInfo<attributes>()->GetBucket<(ObjectInfoBits)(attributes & GetBlockTypeBitMask)>(sizeCat).GetAllocator()->GetFreeObjectListOffset();
1376+
return this->GetHeapInfo<attributes>()->template GetBucket<(ObjectInfoBits)(attributes & GetBlockTypeBitMask)>(sizeCat).GetAllocator()->GetFreeObjectListOffset();
13951377
}
13961378

13971379
void GetNormalHeapBlockAllocatorInfoForNativeAllocation(size_t sizeCat, void*& allocatorAddress, uint32& endAddressOffset, uint32& freeListOffset, bool allowBumpAllocation, bool isOOPJIT);
@@ -2271,7 +2253,7 @@ class CollectedRecyclerWeakRefHeapBlock : public HeapBlock
22712253
#endif
22722254

22732255
#if DBG
2274-
virtual HeapInfo * GetHeapInfo() const override { Assert(false); return false; }
2256+
virtual HeapInfo * GetHeapInfo() const override { Assert(false); return nullptr; }
22752257
virtual BOOL IsFreeObject(void* objectAddress) override { Assert(false); return false; }
22762258
#endif
22772259
virtual BOOL IsValidObject(void* objectAddress) override { Assert(false); return false; }

lib/Common/Memory/RecyclerSweepManager.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ RecyclerSweepManager::BeginSweep(Recycler * recycler)
5353
// We are about to sweep, give the runtime a chance to see the now-immutable state of the world.
5454
// And clean up all the cache not monitor by the GC (e.g. inline caches)
5555
AUTO_NO_EXCEPTION_REGION;
56+
57+
// RecyclerSweep may not be initialized till later in this function but
58+
// GCETW relies on the recycler pointer being correctly set up
59+
this->recycler = recycler;
5660
GCETW(GC_PRESWEEPCALLBACK_START, (this));
5761
recycler->collectionWrapper->PreSweepCallback();
5862
GCETW(GC_PRESWEEPCALLBACK_STOP, (this));
@@ -66,8 +70,6 @@ RecyclerSweepManager::BeginSweep(Recycler * recycler)
6670
recycler->recyclerSweepManager = this;
6771

6872
this->defaultHeapRecyclerSweep.BeginSweep(recycler, this, recycler->autoHeap.GetDefaultHeap());
69-
this->isolatedHeapRecyclerSweep.BeginSweep(recycler, this, recycler->autoHeap.GetIsolatedHeap());
70-
7173

7274
#if ENABLE_PARTIAL_GC
7375
Assert(recycler->clientTrackedObjectList.Empty());
@@ -133,7 +135,7 @@ RecyclerSweepManager::FinishSweep()
133135
if (recycler->collectionState == CollectionStateConcurrentSweepPass2)
134136
{
135137
GCETW_INTERNAL(GC_START, (recycler, ETWEvent_ConcurrentSweep_Pass2));
136-
GCETW_INTERNAL(GC_START2, (recycler, ETWEvent_ConcurrentSweep_Pass2, this->collectionStartReason, this->collectionStartFlags));
138+
GCETW_INTERNAL(GC_START2, (recycler, ETWEvent_ConcurrentSweep_Pass2, recycler->collectionStartReason, recycler->collectionStartFlags));
137139
}
138140
#endif
139141

@@ -217,7 +219,7 @@ RecyclerSweepManager::FinishSweep()
217219
if (recycler->collectionState == CollectionStateConcurrentSweepPass2)
218220
{
219221
GCETW_INTERNAL(GC_STOP, (recycler, ETWEvent_ConcurrentSweep_Pass2));
220-
GCETW_INTERNAL(GC_STOP2, (recycler, ETWEvent_ConcurrentSweep_Pass2, this->collectionStartReason, this->collectionStartFlags));
222+
GCETW_INTERNAL(GC_STOP2, (recycler, ETWEvent_ConcurrentSweep_Pass2, recycler->collectionStartReason, recycler->collectionStartFlags));
221223
}
222224
#endif
223225
#endif
@@ -255,7 +257,6 @@ void
255257
RecyclerSweepManager::ShutdownCleanup()
256258
{
257259
this->defaultHeapRecyclerSweep.ShutdownCleanup();
258-
this->isolatedHeapRecyclerSweep.ShutdownCleanup();
259260
}
260261

261262
#if ENABLE_CONCURRENT_GC
@@ -583,6 +584,6 @@ RecyclerSweepManager::DoAdjustPartialHeuristics() const
583584
#if DBG || defined(RECYCLER_SLOW_CHECK_ENABLED)
584585
size_t RecyclerSweepManager::GetPendingMergeNewHeapBlockCount(HeapInfo const * heapInfo)
585586
{
586-
return this->defaultHeapRecyclerSweep.GetPendingMergeNewHeapBlockCount(heapInfo) + this->isolatedHeapRecyclerSweep.GetPendingMergeNewHeapBlockCount(heapInfo);
587+
return this->defaultHeapRecyclerSweep.GetPendingMergeNewHeapBlockCount(heapInfo);
587588
}
588589
#endif

0 commit comments

Comments
 (0)