SmallBlockDeclarations.inl 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #ifndef TBlockTypeAttributes
  6. #error Need to define block type attributes before including this file
  7. #endif
  8. template void SmallHeapBlockT<TBlockTypeAttributes>::ReleasePages(Recycler * recycler);
  9. #if ENABLE_BACKGROUND_PAGE_FREEING
  10. template void SmallHeapBlockT<TBlockTypeAttributes>::BackgroundReleasePagesSweep(Recycler* recycler);
  11. #endif
  12. template void SmallHeapBlockT<TBlockTypeAttributes>::ReleasePagesSweep(Recycler * recycler);
  13. template BOOL SmallHeapBlockT<TBlockTypeAttributes>::ReassignPages(Recycler * recycler);
  14. template SweepState SmallHeapBlockT<TBlockTypeAttributes>::Sweep(RecyclerSweep& recyclerSweep, bool queuePendingSweep, bool allocable, ushort finalizeCount, bool hasPendingDispose);
  15. template SmallNormalHeapBlockT<TBlockTypeAttributes>* HeapBlock::AsNormalBlock<TBlockTypeAttributes>();
  16. template SmallLeafHeapBlockT<TBlockTypeAttributes>* HeapBlock::AsLeafBlock<TBlockTypeAttributes>();
  17. template SmallFinalizableHeapBlockT<TBlockTypeAttributes>* HeapBlock::AsFinalizableBlock<TBlockTypeAttributes>();
  18. #ifdef RECYCLER_VISITED_HOST
  19. template SmallRecyclerVisitedHostHeapBlockT<TBlockTypeAttributes>* HeapBlock::AsRecyclerVisitedHostBlock<TBlockTypeAttributes>();
  20. #endif
  21. #ifdef RECYCLER_WRITE_BARRIER
  22. template SmallNormalWithBarrierHeapBlockT<TBlockTypeAttributes>* HeapBlock::AsNormalWriteBarrierBlock<TBlockTypeAttributes>();
  23. template SmallFinalizableWithBarrierHeapBlockT<TBlockTypeAttributes>* HeapBlock::AsFinalizableWriteBarrierBlock<TBlockTypeAttributes>();
  24. #endif
  25. template bool SmallHeapBlockT<TBlockTypeAttributes>::FindHeapObjectImpl<SmallLeafHeapBlockT<TBlockTypeAttributes>>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject);
  26. template bool SmallHeapBlockT<TBlockTypeAttributes>::FindHeapObjectImpl<SmallNormalHeapBlockT<TBlockTypeAttributes>>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject);
  27. template bool SmallHeapBlockT<TBlockTypeAttributes>::FindHeapObjectImpl<SmallFinalizableHeapBlockT<TBlockTypeAttributes>>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject);
  28. #ifdef RECYCLER_VISITED_HOST
  29. template bool SmallHeapBlockT<TBlockTypeAttributes>::FindHeapObjectImpl<SmallRecyclerVisitedHostHeapBlockT<TBlockTypeAttributes>>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject);
  30. #endif
  31. #ifdef RECYCLER_WRITE_BARRIER
  32. template bool SmallHeapBlockT<TBlockTypeAttributes>::FindHeapObjectImpl<SmallNormalWithBarrierHeapBlockT<TBlockTypeAttributes>>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject);
  33. template bool SmallHeapBlockT<TBlockTypeAttributes>::FindHeapObjectImpl<SmallFinalizableWithBarrierHeapBlockT<TBlockTypeAttributes>>(void* objectAddress, Recycler * recycler, FindHeapObjectFlags flags, RecyclerHeapObjectInfo& heapObject);
  34. #endif
  35. #ifdef RECYCLER_SLOW_CHECK_ENABLED
  36. template bool SmallHeapBlockT<TBlockTypeAttributes>::GetFreeObjectListOnAllocatorImpl<SmallNormalHeapBlockT<TBlockTypeAttributes>>(FreeObject ** freeObjectList);
  37. template bool SmallHeapBlockT<TBlockTypeAttributes>::GetFreeObjectListOnAllocatorImpl<SmallLeafHeapBlockT<TBlockTypeAttributes>>(FreeObject ** freeObjectList);
  38. template bool SmallHeapBlockT<TBlockTypeAttributes>::GetFreeObjectListOnAllocatorImpl<SmallFinalizableHeapBlockT<TBlockTypeAttributes>>(FreeObject ** freeObjectList);
  39. #ifdef RECYCLER_VISITED_HOST
  40. template bool SmallHeapBlockT<TBlockTypeAttributes>::GetFreeObjectListOnAllocatorImpl<SmallRecyclerVisitedHostHeapBlockT<TBlockTypeAttributes>>(FreeObject ** freeObjectList);
  41. #endif
  42. #ifdef RECYCLER_WRITE_BARRIER
  43. template bool SmallHeapBlockT<TBlockTypeAttributes>::GetFreeObjectListOnAllocatorImpl<SmallNormalWithBarrierHeapBlockT<TBlockTypeAttributes>>(FreeObject ** freeObjectList);
  44. template bool SmallHeapBlockT<TBlockTypeAttributes>::GetFreeObjectListOnAllocatorImpl<SmallFinalizableWithBarrierHeapBlockT<TBlockTypeAttributes>>(FreeObject ** freeObjectList);
  45. #endif
  46. #endif
  47. // template const SmallHeapBlockT<TBlockTypeAttributes>::SmallHeapBlockBitVector * HeapInfo::ValidPointersMap<TBlockTypeAttributes>::GetInvalidBitVector(uint index) const;
  48. // Explicit instantiate all the sweep mode
  49. template void SmallHeapBlockT<TBlockTypeAttributes>::SweepObjects<SweepMode_InThread>(Recycler * recycler);
  50. #if ENABLE_CONCURRENT_GC
  51. template <>
  52. template <>
  53. void
  54. SmallHeapBlockT<TBlockTypeAttributes>::SweepObject<SweepMode_Concurrent>(Recycler * recycler, uint i, void * addr)
  55. {
  56. AssertMsg(!(ObjectInfo(i) & FinalizeBit), "Finalize object should not be concurrent swept");
  57. EnqueueProcessedObject(&freeObjectList, addr, i);
  58. }
  59. // Explicit instantiate all the sweep mode
  60. template void SmallHeapBlockT<TBlockTypeAttributes>::SweepObjects<SweepMode_Concurrent>(Recycler * recycler);
  61. #if ENABLE_PARTIAL_GC
  62. template <>
  63. template <>
  64. void
  65. SmallHeapBlockT<TBlockTypeAttributes>::SweepObject<SweepMode_ConcurrentPartial>(Recycler * recycler, uint i, void * addr)
  66. {
  67. Assert(recycler->inPartialCollectMode);
  68. AssertMsg(!this->IsLeafBlock(), "Leaf pages should not do partial sweep");
  69. AssertMsg(!(ObjectInfo(i) & FinalizeBit), "Finalize object should not be concurrent swept");
  70. // This is a partial swept block; i.e. we're not reusing it.
  71. // Just leave the object as-is; we will collect it in a future Sweep.
  72. // However, we do clear out the ObjectInfo
  73. // this keeps us from getting confused in certain situations, e.g. function enumeration for the debugger.
  74. ObjectInfo(i) = 0;
  75. }
  76. // Explicit instantiate all the sweep mode
  77. template void SmallHeapBlockT<TBlockTypeAttributes>::SweepObjects<SweepMode_ConcurrentPartial>(Recycler * recycler);
  78. #endif
  79. #endif
  80. template <>
  81. template <>
  82. void
  83. SmallHeapBlockT<TBlockTypeAttributes>::SweepObject<SweepMode_InThread>(Recycler * recycler, uint i, void * addr)
  84. {
  85. if (ObjectInfo(i) & FinalizeBit)
  86. {
  87. Assert(this->IsAnyFinalizableBlock());
  88. #if ENABLE_CONCURRENT_GC
  89. #if ENABLE_ALLOCATIONS_DURING_CONCURRENT_SWEEP
  90. Assert(!recycler->IsConcurrentExecutingState() && !recycler->IsConcurrentSweepState());
  91. #else
  92. Assert(!recycler->IsConcurrentExecutingState());
  93. #endif
  94. #endif
  95. // Call prepare finalize to do clean up that needs to be done immediately
  96. // (e.g. Clear the ITrackable alias reference, so it can't be revived during
  97. // other finalizers or concurrent sweep)
  98. ((FinalizableObject *)addr)->Finalize(false);
  99. // Set ObjectInfo to indicate a pending dispose object
  100. ObjectInfo(i) = PendingDisposeObjectBits;
  101. this->AsFinalizableBlock<TBlockTypeAttributes>()->AddPendingDisposeObject();
  102. #ifdef RECYCLER_FINALIZE_CHECK
  103. recycler->autoHeap.pendingDisposableObjectCount++;
  104. #endif
  105. }
  106. else
  107. {
  108. EnqueueProcessedObject(&freeObjectList, addr, i);
  109. }
  110. }