//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- #ifndef TBlockTypeAttributes #error Need to define block type attributes before including this file #endif template void SmallHeapBlockT::ReleasePages(Recycler * recycler); #if ENABLE_BACKGROUND_PAGE_FREEING template void SmallHeapBlockT::BackgroundReleasePagesSweep(Recycler* recycler); #endif template void SmallHeapBlockT::ReleasePagesSweep(Recycler * recycler); template BOOL SmallHeapBlockT::ReassignPages(Recycler * recycler); template SweepState SmallHeapBlockT::Sweep(RecyclerSweep& recyclerSweep, bool queuePendingSweep, bool allocable, ushort finalizeCount, bool hasPendingDispose); template SmallNormalHeapBlockT* HeapBlock::AsNormalBlock(); template SmallLeafHeapBlockT* HeapBlock::AsLeafBlock(); template SmallFinalizableHeapBlockT* HeapBlock::AsFinalizableBlock(); #ifdef RECYCLER_VISITED_HOST template SmallRecyclerVisitedHostHeapBlockT* HeapBlock::AsRecyclerVisitedHostBlock(); #endif #ifdef RECYCLER_WRITE_BARRIER template SmallNormalWithBarrierHeapBlockT* HeapBlock::AsNormalWriteBarrierBlock(); template SmallFinalizableWithBarrierHeapBlockT* HeapBlock::AsFinalizableWriteBarrierBlock(); #endif template bool SmallHeapBlockT::FindHeapObjectImpl>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject); template bool SmallHeapBlockT::FindHeapObjectImpl>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject); template bool SmallHeapBlockT::FindHeapObjectImpl>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject); #ifdef RECYCLER_VISITED_HOST template bool SmallHeapBlockT::FindHeapObjectImpl>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject); #endif #ifdef RECYCLER_WRITE_BARRIER template bool SmallHeapBlockT::FindHeapObjectImpl>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject); template bool SmallHeapBlockT::FindHeapObjectImpl>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject); #endif #ifdef RECYCLER_SLOW_CHECK_ENABLED template bool SmallHeapBlockT::GetFreeObjectListOnAllocatorImpl>(FreeObject ** freeObjectList); template bool SmallHeapBlockT::GetFreeObjectListOnAllocatorImpl>(FreeObject ** freeObjectList); template bool SmallHeapBlockT::GetFreeObjectListOnAllocatorImpl>(FreeObject ** freeObjectList); #ifdef RECYCLER_VISITED_HOST template bool SmallHeapBlockT::GetFreeObjectListOnAllocatorImpl>(FreeObject ** freeObjectList); #endif #ifdef RECYCLER_WRITE_BARRIER template bool SmallHeapBlockT::GetFreeObjectListOnAllocatorImpl>(FreeObject ** freeObjectList); template bool SmallHeapBlockT::GetFreeObjectListOnAllocatorImpl>(FreeObject ** freeObjectList); #endif #endif // template const SmallHeapBlockT::SmallHeapBlockBitVector * HeapInfo::ValidPointersMap::GetInvalidBitVector(uint index) const; // Explicit instantiate all the sweep mode template void SmallHeapBlockT::SweepObjects(Recycler * recycler); #if ENABLE_CONCURRENT_GC template <> template <> void SmallHeapBlockT::SweepObject(Recycler * recycler, uint i, void * addr) { AssertMsg(!(ObjectInfo(i) & FinalizeBit), "Finalize object should not be concurrent swept"); EnqueueProcessedObject(&freeObjectList, addr, i); } // Explicit instantiate all the sweep mode template void SmallHeapBlockT::SweepObjects(Recycler * recycler); #if ENABLE_PARTIAL_GC template <> template <> void SmallHeapBlockT::SweepObject(Recycler * recycler, uint i, void * addr) { Assert(recycler->inPartialCollectMode); AssertMsg(!this->IsLeafBlock(), "Leaf pages should not do partial sweep"); AssertMsg(!(ObjectInfo(i) & FinalizeBit), "Finalize object should not be concurrent swept"); // This is a partial swept block; i.e. we're not reusing it. // Just leave the object as-is; we will collect it in a future Sweep. // However, we do clear out the ObjectInfo // this keeps us from getting confused in certain situations, e.g. function enumeration for the debugger. ObjectInfo(i) = 0; } // Explicit instantiate all the sweep mode template void SmallHeapBlockT::SweepObjects(Recycler * recycler); #endif #endif template <> template <> void SmallHeapBlockT::SweepObject(Recycler * recycler, uint i, void * addr) { if (ObjectInfo(i) & FinalizeBit) { Assert(this->IsAnyFinalizableBlock()); #if ENABLE_CONCURRENT_GC #if ENABLE_ALLOCATIONS_DURING_CONCURRENT_SWEEP Assert(!recycler->IsConcurrentExecutingState() && !recycler->IsConcurrentSweepState()); #else Assert(!recycler->IsConcurrentExecutingState()); #endif #endif // Call prepare finalize to do clean up that needs to be done immediately // (e.g. Clear the ITrackable alias reference, so it can't be revived during // other finalizers or concurrent sweep) ((FinalizableObject *)addr)->Finalize(false); // Set ObjectInfo to indicate a pending dispose object ObjectInfo(i) = PendingDisposeObjectBits; this->AsFinalizableBlock()->AddPendingDisposeObject(); #ifdef RECYCLER_FINALIZE_CHECK this->heapBucket->heapInfo->pendingDisposableObjectCount++; #endif } else { EnqueueProcessedObject(&freeObjectList, addr, i); } }