/ark/runtime_core/verification/util/tests/ |
D | bit_vector_test.cpp | 53 for (size_t idx = 0; idx < bitset.Bits.size(); ++idx) { in showValue() 77 size_t size = (set.empty() ? 0 : *set.rbegin()) + inc; in arbitrary() local 79 BitVector bits {size}; in arbitrary() 107 void ClassifySize(std::string name, size_t size, const Intervals &intervals) in ClassifySize() argument 110 RC_CLASSIFY(i.Contains(size), name + " " + std::to_string(i)); in ClassifySize() 121 ClassifySize("Bits.size() in", bitset.Bits.size(), stat_intervals); in stat() 122 ClassifySize("Indices.size() in", bitset.Indices.size(), stat_intervals); in stat() 126 StdSet Universum(size_t size) in Universum() argument 128 return ToSet<StdSet>(Interval(0, size - 1)); in Universum() 138 RC_ASSERT(bit_set.Bits.SetBitsCount() == bit_set.Indices.size()); in __anon823681b80302() [all …]
|
/ark/runtime_core/runtime/mem/ |
D | alloc_config.h | 40 static void OnAlloc(size_t size, SpaceType type_mem, MemStatsType *mem_stats) in OnAlloc() argument 42 mem_stats->RecordAllocateObject(size, type_mem); in OnAlloc() 45 static void OnFree(size_t size, SpaceType type_mem, MemStatsType *mem_stats) in OnFree() argument 47 mem_stats->RecordFreeObject(size, type_mem); in OnFree() 53 static void MemoryInit(void *mem, size_t size) in MemoryInit() argument 57 (void)memset_s(mem, size, 0, size); in MemoryInit() 108 static void InitializeCrossingMapForMemory(void *start_addr, size_t size) in InitializeCrossingMapForMemory() argument 110 return CrossingMapSingleton::InitializeCrossingMapForMemory(start_addr, size); in InitializeCrossingMapForMemory() 118 static void RemoveCrossingMapForMemory(void *start_addr, size_t size) in RemoveCrossingMapForMemory() argument 120 return CrossingMapSingleton::RemoveCrossingMapForMemory(start_addr, size); in RemoveCrossingMapForMemory() [all …]
|
D | frame_allocator-inl.h | 61 inline bool FrameAllocator<AlignmenT, UseMemsetT>::TryAllocateNewArena(size_t size) in TryAllocateNewArena() argument 63 size_t arena_size = GetNextArenaSize(size); in TryAllocateNewArena() 81 inline void *FrameAllocator<AlignmenT, UseMemsetT>::Alloc(size_t size) in Alloc() argument 83 ASSERT(AlignUp(size, GetAlignmentInBytes(AlignmenT)) == size); in Alloc() 85 void *mem = TryToAllocate(size); in Alloc() 88 …LOG_FRAME_ALLOCATOR(DEBUG) << "Can't allocate " << size << " bytes for a new frame in current aren… in Alloc() 89 if (!TryAllocateNewArena(size)) { in Alloc() 93 mem = TryToAllocate(size); in Alloc() 104 (void)memset_s(mem, size, 0x00, size); in Alloc() 133 inline void *FrameAllocator<AlignmenT, UseMemsetT>::TryToAllocate(size_t size) in TryToAllocate() argument [all …]
|
/ark/js_runtime/ecmascript/mem/ |
D | tlab_allocator-inl.h | 46 uintptr_t TlabAllocator::Allocate(size_t size, MemSpaceType spaceAlloc) in Allocate() argument 51 result = TlabAllocatorYoungSpace(size); in Allocate() 54 result = TlabAllocatorOldSpace(size); in Allocate() 57 result = TlabAllocatorCompressSpace(size); in Allocate() 65 uintptr_t TlabAllocator::TlabAllocatorYoungSpace(size_t size) in TlabAllocatorYoungSpace() argument 67 ASSERT(AlignUp(size, static_cast<size_t>(MemAlignment::MEM_ALIGN_OBJECT)) == size); in TlabAllocatorYoungSpace() 68 if (UNLIKELY(size > SMALL_OBJECT_SIZE)) { in TlabAllocatorYoungSpace() 69 uintptr_t address = heap_->AllocateYoungSync(size); in TlabAllocatorYoungSpace() 72 uintptr_t result = youngerAllocator_.Allocate(size); in TlabAllocatorYoungSpace() 80 return youngerAllocator_.Allocate(size); in TlabAllocatorYoungSpace() [all …]
|
D | heap-inl.h | 96 size_t size = hclass->GetObjectSize(); in AllocateYoungOrHugeObject() local 97 return AllocateYoungOrHugeObject(hclass, size); in AllocateYoungOrHugeObject() 100 TaggedObject *Heap::AllocateYoungOrHugeObject(JSHClass *hclass, size_t size) in AllocateYoungOrHugeObject() argument 102 size = AlignUp(size, static_cast<size_t>(MemAlignment::MEM_ALIGN_OBJECT)); in AllocateYoungOrHugeObject() 103 if (size > MAX_REGULAR_HEAP_OBJECT_SIZE) { in AllocateYoungOrHugeObject() 104 return AllocateHugeObject(hclass, size); in AllocateYoungOrHugeObject() 107 auto object = reinterpret_cast<TaggedObject *>(toSpace_->Allocate(size)); in AllocateYoungOrHugeObject() 110 object = reinterpret_cast<TaggedObject *>(toSpace_->Allocate(size)); in AllocateYoungOrHugeObject() 113 object = reinterpret_cast<TaggedObject *>(toSpace_->Allocate(size)); in AllocateYoungOrHugeObject() 115 ThrowOutOfMemoryError(size, "AllocateYoungObject"); in AllocateYoungOrHugeObject() [all …]
|
D | allocator-inl.h | 42 uintptr_t BumpPointerAllocator::Allocate(size_t size) in Allocate() argument 44 ASSERT(size != 0); in Allocate() 46 if (UNLIKELY(top_ + size > end_)) { in Allocate() 51 top_ += size; in Allocate() 80 uintptr_t FreeListAllocator::Allocate(size_t size) in Allocate() argument 82 auto ret = bpAllocator_.Allocate(size); in Allocate() 84 allocationSizeAccumulator_ += size; in Allocate() 85 Region::ObjectAddressToRange(ret)->IncrementAliveObject(size); in Allocate() 88 FreeObject *object = freeList_->Allocate(size); in Allocate() 90 ret = Allocate(object, size); in Allocate() [all …]
|
D | native_area_allocator.cpp | 62 auto size = area->GetSize() + sizeof(Area); in FreeArea() local 63 DecreaseNativeMemoryUsage(size); in FreeArea() 65 if (memset_s(area, size, INVALID_VALUE, size) != EOK) { in FreeArea() 74 void NativeAreaAllocator::Free(void *mem, size_t size) in Free() argument 79 DecreaseNativeMemoryUsage(size); in Free() 81 if (memset_s(mem, size, INVALID_VALUE, size) != EOK) { in Free() 90 void *NativeAreaAllocator::AllocateBuffer(size_t size) in AllocateBuffer() argument 92 if (size == 0) { in AllocateBuffer() 97 void *ptr = malloc(size); in AllocateBuffer() 103 if (memset_s(ptr, size, INVALID_VALUE, size) != EOK) { in AllocateBuffer() [all …]
|
D | chunk.h | 38 [[nodiscard]] void *Allocate(size_t size) in Allocate() argument 40 if (size == 0) { in Allocate() 45 size = AlignUp(size, MEM_ALIGN); in Allocate() 46 if (UNLIKELY(size > end_ - ptr_)) { in Allocate() 47 result = Expand(size); in Allocate() 49 ptr_ += size; in Allocate() 56 [[nodiscard]] T *NewArray(size_t size) in NewArray() argument 58 return static_cast<T *>(Allocate(size * sizeof(T))); in NewArray() 86 uintptr_t Expand(size_t size); 87 Area *NewArea(size_t size);
|
D | free_object_set.cpp | 22 void FreeObjectSet::Free(uintptr_t begin, size_t size) in Free() argument 28 available_ += size; in Free() 40 FreeObject *FreeObjectSet::ObtainSmallFreeObject(size_t size) in ObtainSmallFreeObject() argument 43 if (freeObject_ != nullptr && freeObject_->Available() >= size) { in ObtainSmallFreeObject() 52 FreeObject *FreeObjectSet::ObtainLargeFreeObject(size_t size) in ObtainLargeFreeObject() argument 57 if (curFreeObject->Available() >= size) { in ObtainLargeFreeObject() 73 FreeObject *FreeObjectSet::LookupSmallFreeObject(size_t size) in LookupSmallFreeObject() argument 75 if (freeObject_ != nullptr && freeObject_->Available() >= size) { in LookupSmallFreeObject() 81 FreeObject *FreeObjectSet::LookupLargeFreeObject(size_t size) in LookupLargeFreeObject() argument 83 if (available_ < size) { in LookupLargeFreeObject() [all …]
|
/ark/runtime_core/libpandabase/tests/ |
D | utf_test.cpp | 42 std::vector<uint16_t> out(res.size()); in TEST() 51 std::vector<uint16_t> out(res.size()); in TEST() 60 std::vector<uint16_t> out(res.size()); in TEST() 69 std::vector<uint16_t> out(res.size()); in TEST() 78 std::vector<uint16_t> out(res.size()); in TEST() 86 std::vector<uint16_t> out(res.size()); in TEST() 94 std::vector<uint16_t> out(res.size()); in TEST() 105 size_t res = Utf16ToMUtf8Size(in.data(), in.size()); in TEST() 112 size_t res = Utf16ToMUtf8Size(in.data(), in.size()); in TEST() 119 size_t res = Utf16ToMUtf8Size(in.data(), in.size()); in TEST() [all …]
|
D | small_vector_test.cpp | 52 ASSERT_EQ(vector.size(), 0); in TestVectorGrow() 56 ASSERT_EQ(vector.size(), 1); in TestVectorGrow() 63 ASSERT_EQ(vector.size(), 4U); in TestVectorGrow() 68 ASSERT_EQ(vector.size(), 5U); in TestVectorGrow() 75 ASSERT_EQ(vector.size(), 10U); in TestVectorGrow() 77 for (size_t i = 0; i < values.size(); i++) { in TestVectorGrow() 98 ASSERT_EQ(vector.size(), 0); in TestVectorIteration() 102 ASSERT_EQ(vector.size(), 4U); in TestVectorIteration() 131 ASSERT_EQ(vector.size(), 10U); in TestVectorIteration() 209 ASSERT_EQ(vector.size(), 1); in TEST_F() [all …]
|
/ark/runtime_core/libpandabase/os/unix/ |
D | mem.cpp | 33 void MmapDeleter(std::byte *ptr, size_t size) noexcept in MmapDeleter() argument 36 munmap(ptr, size); in MmapDeleter() 40 BytePtr MapFile(file::File file, uint32_t prot, uint32_t flags, size_t size, size_t file_offset, vo… in MapFile() argument 44 size_t map_size = size + offset; in MapFile() 52 return BytePtr(static_cast<std::byte *>(result) + offset, size, offset, MmapDeleter); in MapFile() 55 BytePtr MapExecuted(size_t size) in MapExecuted() argument 60 void *result = mmap(nullptr, size, PROT_EXEC | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); in MapExecuted() 65 return BytePtr(static_cast<std::byte *>(result), (result == nullptr) ? 0 : size, MmapDeleter); in MapExecuted() 68 std::optional<Error> MakeMemReadExec(void *mem, size_t size) in MakeMemReadExec() argument 71 int r = mprotect(mem, size, PROT_EXEC | PROT_READ); in MakeMemReadExec() [all …]
|
/ark/runtime_core/libpandabase/utils/ |
D | small_vector.h | 63 uint32_t size {0}; 201 buffer_.size = 0; in SmallVector() 207 buffer_.size = 0; in SmallVector() 290 return const_iterator(&operator[](size())); in end() 295 return iterator(&operator[](size())); in end() 300 return const_iterator(&operator[](size())); in cend() 305 return const_reverse_iterator(&operator[](size() - 1)); in rbegin() 310 return reverse_iterator(&operator[](size() - 1)); in rbegin() 315 return const_reverse_iterator(&operator[](size() - 1)); in crbegin() 333 size_t size() const in size() function [all …]
|
D | asan_interface.h | 35 void __asan_poison_memory_region(void const volatile *addr, size_t size) __attribute__((visibility(… 38 void __asan_unpoison_memory_region(void const volatile *addr, size_t size) __attribute__((visibilit… 41 #define ASAN_POISON_MEMORY_REGION(addr, size) __asan_poison_memory_region((addr), (size)) argument 43 #define ASAN_UNPOISON_MEMORY_REGION(addr, size) __asan_unpoison_memory_region((addr), (size)) argument 51 #define ASAN_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) argument 53 #define ASAN_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) argument
|
/ark/runtime_core/libpandabase/mem/ |
D | mmap_mem_pool-inl.h | 32 inline Pool MmapPoolMap::PopFreePool(size_t size) in PopFreePool() argument 34 auto element = free_pools_.lower_bound(size); in PopFreePool() 45 Pool pool(size, element_mem); in PopFreePool() 47 if (size < element_size) { in PopFreePool() 48 Pool new_pool(element_size - size, ToVoidPtr(ToUintPtr(element_mem) + size)); in PopFreePool() 49 mmap_pool->SetSize(size); in PopFreePool() 155 inline ArenaT *MmapMemPool::AllocArenaImpl(size_t size, SpaceType space_type, AllocatorType allocat… in AllocArenaImpl() argument 159 LOG_MMAP_MEM_POOL(DEBUG) << "Try to get new arena with size " << std::dec << size << " for " in AllocArenaImpl() 161 Pool pool_for_arena = AllocPoolUnsafe(size, space_type, allocator_type, allocator_addr); in AllocArenaImpl() 168 ASSERT(pool_for_arena.GetSize() == size); in AllocArenaImpl() [all …]
|
D | code_allocator.cpp | 49 void *CodeAllocator::AllocateCode(size_t size, const void *code_buff) in AllocateCode() argument 52 void *code_ptr = arenaAllocator_.Alloc(size, PAGE_LOG_ALIGN); in AllocateCode() 53 if (UNLIKELY(code_ptr == nullptr || memcpy_s(code_ptr, size, code_buff, size) != EOK)) { in AllocateCode() 56 ProtectCode(os::mem::MapRange<std::byte>(static_cast<std::byte *>(code_ptr), size)); in AllocateCode() 57 memStats_->RecordAllocateRaw(size, SpaceType::SPACE_TYPE_CODE); in AllocateCode() 58 CodeRangeUpdate(code_ptr, size); in AllocateCode() 62 os::mem::MapRange<std::byte> CodeAllocator::AllocateCodeUnprotected(size_t size) in AllocateCodeUnprotected() argument 65 void *code_ptr = arenaAllocator_.Alloc(size, PAGE_LOG_ALIGN); in AllocateCodeUnprotected() 69 memStats_->RecordAllocateRaw(size, SpaceType::SPACE_TYPE_CODE); in AllocateCodeUnprotected() 70 CodeRangeUpdate(code_ptr, size); in AllocateCodeUnprotected() [all …]
|
D | mmap_mem_pool.h | 52 void SetSize(size_t size) in SetSize() argument 54 pool_ = Pool(size, GetMem()); in SetSize() 100 Pool PopFreePool(size_t size); 164 …ArenaT *AllocArenaImpl(size_t size, SpaceType space_type, AllocatorType allocator_type, void *allo… 168 void *AllocRawMemImpl(size_t size, SpaceType type); 169 void *AllocRawMemCompilerImpl(size_t size); 170 void *AllocRawMemInternalImpl(size_t size); 171 void *AllocRawMemCodeImpl(size_t size); 172 void *AllocRawMemObjectImpl(size_t size, SpaceType type); 173 static void FreeRawMemImpl(void *mem, size_t size); [all …]
|
/ark/runtime_core/libpandafile/ |
D | file_items.cpp | 93 return leb128::UnsignedEncodingSize((utf16_length_ << 1U) | is_ascii_) + str_.size(); in CalculateSize() 140 …size_t size = BaseClassItem::CalculateSize() + ID_SIZE + leb128::UnsignedEncodingSize(access_flags… in CalculateSizeWithoutFieldsAndMethods() local 142 size += leb128::UnsignedEncodingSize(fields_.size()); in CalculateSizeWithoutFieldsAndMethods() 143 size += leb128::UnsignedEncodingSize(methods_.size()); in CalculateSizeWithoutFieldsAndMethods() 146 size += TAG_SIZE + leb128::UnsignedEncodingSize(ifaces_.size()) + IDX_SIZE * ifaces_.size(); in CalculateSizeWithoutFieldsAndMethods() 150 size += TAG_SIZE + sizeof(SourceLang); in CalculateSizeWithoutFieldsAndMethods() 153 size += (TAG_SIZE + ID_SIZE) * runtime_annotations_.size(); in CalculateSizeWithoutFieldsAndMethods() 154 size += (TAG_SIZE + ID_SIZE) * annotations_.size(); in CalculateSizeWithoutFieldsAndMethods() 155 size += (TAG_SIZE + ID_SIZE) * runtime_type_annotations_.size(); in CalculateSizeWithoutFieldsAndMethods() 156 size += (TAG_SIZE + ID_SIZE) * type_annotations_.size(); in CalculateSizeWithoutFieldsAndMethods() [all …]
|
/ark/runtime_core/libpandabase/serializer/ |
D | serializer.h | 61 uint32_t size = vec.size() * sizeof(type); 62 auto ret = TypeToBuffer(size, buffer); 69 const uint8_t *ptr_end = ToUint8tPtr(ToUintPtr(ptr) + size); 71 return ret.Value() + size; 80 auto ret = TypeToBuffer(static_cast<uint32_t>(map.size()), buffer); 109 Expected<size_t, const char *> BufferToType(const uint8_t *data, size_t size, /* out */ T &value) in BufferToType() argument 113 if (sizeof(value) > size) { in BufferToType() 123 inline Expected<size_t, const char *> BufferToType(const uint8_t *data, size_t size, /* out */ std:… in BufferToType() argument 127 auto r = BufferToType(data, size, str_size); in BufferToType() 131 ASSERT(r.Value() <= size); in BufferToType() [all …]
|
/ark/runtime_core/runtime/tests/ |
D | string_test.cpp | 78 uint32_t utf16_length = data.size() - 1; in TEST_F() 93 uint32_t utf16_length = data.size() - 2U; in TEST_F() 143 …String::CreateFromUtf16(data.data(), data.size(), GetLanguageContext(), Runtime::GetCurrent()->Get… in TEST_F() 145 ASSERT_TRUE(String::StringsAreEqualUtf16(first_string, second_string, data.size())); in TEST_F() 157 auto *first_string = String::CreateFromUtf16(data.data(), data.size() - 1, GetLanguageContext(), in TEST_F() 160 ASSERT_TRUE(String::StringsAreEqualUtf16(first_string, second_string, data.size() - 1)); in TEST_F() 168 …String::CreateFromUtf16(data1.data(), data1.size(), GetLanguageContext(), Runtime::GetCurrent()->G… in TEST_F() 170 ASSERT_FALSE(String::StringsAreEqualUtf16(first_string, second_string, data2.size())); in TEST_F() 178 …String::CreateFromUtf16(data1.data(), data1.size(), GetLanguageContext(), Runtime::GetCurrent()->G… in TEST_F() 181 ASSERT_FALSE(String::StringsAreEqualUtf16(first_string, second_string, data2.size())); in TEST_F() [all …]
|
/ark/runtime_core/runtime/ |
D | class_helper.cpp | 28 static void Pad(size_t size, size_t *padding, size_t *n) in Pad() argument 30 while (*padding >= size && *n > 0) { in Pad() 31 *padding -= size; in Pad() 41 size_t size = sizeof(Class); in ComputeClassSize() local 42 size = AlignUp(size, OBJECT_POINTER_SIZE); in ComputeClassSize() 43 size += vtable_size * POINTER_SIZE; in ComputeClassSize() 44 size += imt_size * POINTER_SIZE; in ComputeClassSize() 45 size += num_ref_sfields * OBJECT_POINTER_SIZE; in ComputeClassSize() 55 if (!IsAligned<SIZE_64>(size) && (num_64bit_sfields > 0 || num_tagged_sfields > 0)) { in ComputeClassSize() 56 size_t padding = AlignUp(size, SIZE_64) - size; in ComputeClassSize() [all …]
|
/ark/runtime_core/dprof/libdprof/dprof/ipc/ |
D | ipc_message.cpp | 29 uint32_t size = message.GetSize(); in SendMessage() local 30 if (!SendAll(fd, &size, sizeof(size))) { in SendMessage() 35 if (size != 0 && !SendAll(fd, message.GetData(), message.GetSize())) { in SendMessage() 58 uint32_t size; in RecvMessage() local 59 if (RecvTimeout(fd, &size, sizeof(size), DEFAULT_TIMEOUT) <= 0) { in RecvMessage() 64 if (size > Message::MAX_DATA_SIZE) { in RecvMessage() 65 LOG(ERROR, DPROF) << "Data size is too large, size=" << size; in RecvMessage() 69 std::vector<uint8_t> data(size); in RecvMessage() 70 if (size != 0) { in RecvMessage() 71 if (RecvTimeout(fd, data.data(), data.size(), DEFAULT_TIMEOUT) <= 0) { in RecvMessage()
|
/ark/runtime_core/scripts/ |
D | memdump.py | 67 def alloc(self, size): argument 70 self.allocated_size += size 71 self.sizes.append(size) 73 def free(self, size): argument 76 self.allocated_size -= size 125 for size in sizes: 126 if size < min_size: 127 min_size = size 128 elif size > max_size: 129 max_size = size [all …]
|
/ark/js_runtime/ecmascript/regexp/tests/ |
D | regexp_test.cpp | 111 … parser.Init(const_cast<char *>(reinterpret_cast<const char *>(source.c_str())), source.size(), 0); in HWTEST_F_L0() 121 … parser.Init(const_cast<char *>(reinterpret_cast<const char *>(source.c_str())), source.size(), 0); in HWTEST_F_L0() 131 … parser.Init(const_cast<char *>(reinterpret_cast<const char *>(source.c_str())), source.size(), 0); in HWTEST_F_L0() 141 … parser.Init(const_cast<char *>(reinterpret_cast<const char *>(source.c_str())), source.size(), 0); in HWTEST_F_L0() 151 … parser.Init(const_cast<char *>(reinterpret_cast<const char *>(source.c_str())), source.size(), 0); in HWTEST_F_L0() 161 … parser.Init(const_cast<char *>(reinterpret_cast<const char *>(source.c_str())), source.size(), 0); in HWTEST_F_L0() 171 … parser.Init(const_cast<char *>(reinterpret_cast<const char *>(source.c_str())), source.size(), 0); in HWTEST_F_L0() 181 … parser.Init(const_cast<char *>(reinterpret_cast<const char *>(source.c_str())), source.size(), 0); in HWTEST_F_L0() 191 … parser.Init(const_cast<char *>(reinterpret_cast<const char *>(source.c_str())), source.size(), 0); in HWTEST_F_L0() 201 … parser.Init(const_cast<char *>(reinterpret_cast<const char *>(source.c_str())), source.size(), 0); in HWTEST_F_L0() [all …]
|
/ark/runtime_core/libpandabase/os/ |
D | mem.h | 41 void MmapDeleter(std::byte *ptr, size_t size) noexcept; 49 std::optional<Error> MakeMemReadExec(void *mem, size_t size); 57 std::optional<Error> MakeMemReadWrite(void *mem, size_t size); 65 std::optional<Error> MakeMemReadOnly(void *mem, size_t size); 79 void *AlignedAlloc(size_t alignment_in_bytes, size_t size); 84 MapRange(T *ptr, size_t size) : sp_(reinterpret_cast<std::byte *>(ptr), size) {} in MapRange() argument 86 MapRange GetSubRange(size_t offset, size_t size) in GetSubRange() argument 88 return MapRange(sp_.SubSpan(offset, size)); in GetSubRange() 157 …MapPtr(T *ptr, size_t size, Deleter deleter) : ptr_(ptr), size_(size), page_offset_(0), deleter_(d… in MapPtr() argument 158 MapPtr(T *ptr, size_t size, size_t page_offset, Deleter deleter) in MapPtr() argument [all …]
|