5#ifndef RUNTIME_VM_HEAP_FREELIST_H_
6#define RUNTIME_VM_HEAP_FREELIST_H_
36 return *SizeAddress();
58 DISALLOW_ALLOCATION();
68 intptr_t* SizeAddress()
const {
70 return reinterpret_cast<intptr_t*
>(
addr);
75 DISALLOW_ALLOCATION();
76 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeListElement);
103 if (
size > last_free_small_size_) {
106 int index = IndexForSize(
size);
107 if (index != kNumLists && free_map_.
Test(index)) {
108 return reinterpret_cast<uword>(DequeueElement(index));
110 if ((index + 1) < kNumLists) {
111 intptr_t next_index = free_map_.
Next(index + 1);
112 if (next_index != -1) {
114 SplitElementAfterAndEnqueue(element,
size,
false);
115 return reinterpret_cast<uword>(element);
126 if (new_top <= end_) {
135 intptr_t
result = unaccounted_size_;
136 unaccounted_size_ = 0;
150 intptr_t remaining = end_ - top_;
151 if (remaining != 0) {
152 Free(top_, remaining);
166 static constexpr int kNumLists = 128;
167 static constexpr intptr_t kInitialFreeListSearchBudget = 1000;
169 static intptr_t IndexForSize(intptr_t
size) {
174 if (index >= kNumLists) {
180 intptr_t LengthLocked(
int index)
const;
182 void EnqueueElement(FreeListElement* element, intptr_t index);
183 FreeListElement* DequeueElement(intptr_t index) {
184 FreeListElement*
result = free_lists_[index];
186 if (
next ==
nullptr && index != kNumLists) {
188 if (
size == last_free_small_size_) {
190 last_free_small_size_ =
193 free_map_.
Set(index,
false);
196 free_lists_[index] =
next;
200 void SplitElementAfterAndEnqueue(FreeListElement* element,
204 void PrintSmall()
const;
205 void PrintLarge()
const;
213 intptr_t unaccounted_size_ = 0;
216 mutable Mutex mutex_;
218 BitSet<kNumLists> free_map_;
220 FreeListElement* free_lists_[kNumLists + 1];
222 intptr_t freelist_search_budget_ = kInitialFreeListSearchBudget;
225 intptr_t last_free_small_size_;
static float next(float f)
#define DEBUG_ASSERT(cond)
static constexpr ClassIdTagType decode(uword value)
intptr_t ClearLastAndFindPrevious(intptr_t current_last)
bool Test(intptr_t i) const
void Set(intptr_t i, bool value)
intptr_t Next(intptr_t i) const
static intptr_t InstanceSize()
static cpp_vtable vtable()
static const ClassId kClassId
static intptr_t NextFieldOffset()
FreeListElement * next() const
intptr_t HeapSize(uword tags)
uword next_address() const
void set_next(FreeListElement *next)
static FreeListElement * AsElementNew(uword addr, intptr_t size)
static intptr_t HeaderSizeFor(intptr_t size)
static constexpr intptr_t kLargeHeaderSize
static FreeListElement * AsElement(uword addr, intptr_t size)
void set_end(uword value)
void AddUnaccountedSize(intptr_t size)
void FreeLocked(uword addr, intptr_t size)
DART_FORCE_INLINE bool TryAllocateBumpLocked(intptr_t size, uword *result)
FreeListElement * TryAllocateLarge(intptr_t minimum_size)
uword TryAllocateLocked(intptr_t size, bool is_protected)
uword TryAllocate(intptr_t size, bool is_protected)
void set_top(uword value)
FreeListElement * TryAllocateLargeLocked(intptr_t minimum_size)
DART_WARN_UNUSED_RESULT intptr_t ReleaseBumpAllocation()
void Free(uword addr, intptr_t size)
intptr_t TakeUnaccountedSizeLocked()
uword TryAllocateSmallLocked(intptr_t size)
bool IsOwnedByCurrentThread() const
static constexpr uword decode(uword tag)
static constexpr bool IsAligned(T x, uintptr_t alignment, uintptr_t offset=0)
#define DART_WARN_UNUSED_RESULT
constexpr intptr_t kWordSize
static constexpr intptr_t kObjectAlignment
static constexpr intptr_t kObjectAlignmentLog2
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size