|
10 | 10 |
|
11 | 11 | #include "hermes/ADT/BitArray.h" |
12 | 12 | #include "hermes/ADT/ExponentialMovingAverage.h" |
| 13 | +#include "hermes/Support/Algorithms.h" |
13 | 14 | #include "hermes/Support/SlowAssert.h" |
14 | 15 | #include "hermes/VM/AlignedHeapSegment.h" |
15 | 16 | #include "hermes/VM/GCBase.h" |
@@ -76,14 +77,17 @@ class HadesGC final : public GCBase { |
76 | 77 | return gc->getKind() == HeapKind::HADES; |
77 | 78 | } |
78 | 79 |
|
79 | | - static uint32_t minAllocationSize(); |
80 | | - |
81 | 80 | static constexpr uint32_t maxAllocationSize() { |
82 | 81 | // The largest allocation allowable in Hades is the max size a single |
83 | 82 | // segment supports. |
84 | 83 | return HeapSegment::maxSize(); |
85 | 84 | } |
86 | 85 |
|
| 86 | + static constexpr uint32_t minAllocationSize() { |
| 87 | + return heapAlignSize( |
| 88 | + max(sizeof(OldGen::FreelistCell), sizeof(CopyListCell))); |
| 89 | + } |
| 90 | + |
87 | 91 | /// \name GCBase overrides |
88 | 92 | /// \{ |
89 | 93 |
|
@@ -234,14 +238,22 @@ class HadesGC final : public GCBase { |
234 | 238 |
|
235 | 239 | class CollectionStats; |
236 | 240 | class HeapMarkingAcceptor; |
237 | | - struct CopyListCell; |
238 | 241 | template <bool CompactionEnabled> |
239 | 242 | class EvacAcceptor; |
240 | 243 | class MarkAcceptor; |
241 | 244 | class MarkWeakRootsAcceptor; |
242 | 245 | class OldGen; |
243 | 246 | class Executor; |
244 | 247 |
|
| 248 | + struct CopyListCell final : public GCCell { |
| 249 | + // Linked list of cells pointing to the next cell that was copied. |
| 250 | + CopyListCell *next_; |
| 251 | + // If the cell was trimmed, this field will have the original size of the |
| 252 | + // object stored. If the cell wasn't trimmed it'll have the same size as the |
| 253 | + // forwarded pointer. |
| 254 | + uint32_t originalSize_; |
| 255 | + }; |
| 256 | + |
245 | 257 | /// Similar to AlignedHeapSegment except it uses a free list. |
246 | 258 | class HeapSegment final : public AlignedHeapSegment { |
247 | 259 | public: |
|
0 commit comments