| /arkcompiler/ets_runtime/ecmascript/mem/ |
| D | heap-inl.h | 35 #define CHECK_OBJ_AND_THROW_OOM_ERROR(object, size, space, message) … argument 39 …object = reinterpret_cast<TaggedObject *>((space)->Allocate(size)); … 40 …ThrowOutOfMemoryError(size, message); … 122 size_t size = hclass->GetObjectSize(); in AllocateYoungOrHugeObject() local 123 return AllocateYoungOrHugeObject(hclass, size); in AllocateYoungOrHugeObject() 126 TaggedObject *Heap::AllocateYoungOrHugeObject(size_t size) in AllocateYoungOrHugeObject() argument 128 size = AlignUp(size, static_cast<size_t>(MemAlignment::MEM_ALIGN_OBJECT)); in AllocateYoungOrHugeObject() 129 if (size > MAX_REGULAR_HEAP_OBJECT_SIZE) { in AllocateYoungOrHugeObject() 130 return AllocateHugeObject(size); in AllocateYoungOrHugeObject() 133 auto object = reinterpret_cast<TaggedObject *>(activeSemiSpace_->Allocate(size)); in AllocateYoungOrHugeObject() [all …]
|
| D | tlab_allocator-inl.h | 46 uintptr_t TlabAllocator::Allocate(size_t size, MemSpaceType space) in Allocate() argument 51 result = AllocateInYoungSpace(size); in Allocate() 54 result = AllocateInOldSpace(size); in Allocate() 57 result = AllocateInCompressSpace(size); in Allocate() 66 uintptr_t TlabAllocator::AllocateInYoungSpace(size_t size) in AllocateInYoungSpace() argument 68 ASSERT(AlignUp(size, static_cast<size_t>(MemAlignment::MEM_ALIGN_OBJECT)) == size); in AllocateInYoungSpace() 69 if (UNLIKELY(size > SMALL_OBJECT_SIZE)) { in AllocateInYoungSpace() 70 uintptr_t address = heap_->AllocateYoungSync(size); in AllocateInYoungSpace() 73 uintptr_t result = youngAllocator_.Allocate(size); in AllocateInYoungSpace() 81 return youngAllocator_.Allocate(size); in AllocateInYoungSpace() [all …]
|
| D | allocator-inl.h | 51 uintptr_t BumpPointerAllocator::Allocate(size_t size) in Allocate() argument 53 ASSERT(size != 0); in Allocate() 55 if (UNLIKELY(top_ + size > end_)) { in Allocate() 60 ASAN_UNPOISON_MEMORY_REGION(reinterpret_cast<void *>(result), size); in Allocate() 61 top_ += size; in Allocate() 90 uintptr_t FreeListAllocator::Allocate(size_t size) in Allocate() argument 92 auto ret = bpAllocator_.Allocate(size); in Allocate() 94 allocationSizeAccumulator_ += size; in Allocate() 97 FreeObject *object = freeList_->Allocate(size); in Allocate() 99 ret = Allocate(object, size); in Allocate() [all …]
|
| D | native_area_allocator.cpp | 26 LOG_ECMA_MEM(FATAL) << "capacity must have a size not less than sizeof Area."; in AllocateArea() 37 LOG_ECMA_MEM(FATAL) << "malloc failed, current alloc size = " << capacity in AllocateArea() 38 … << ", total allocated size = " << nativeMemoryUsage_.load(std::memory_order_relaxed); in AllocateArea() 63 auto size = area->GetSize() + sizeof(Area); in FreeArea() local 64 DecreaseNativeMemoryUsage(size); in FreeArea() 66 if (memset_s(area, size, INVALID_VALUE, size) != EOK) { in FreeArea() 75 void NativeAreaAllocator::Free(void *mem, size_t size) in Free() argument 80 DecreaseNativeMemoryUsage(size); in Free() 82 if (memset_s(mem, size, INVALID_VALUE, size) != EOK) { in Free() 91 void *NativeAreaAllocator::AllocateBuffer(size_t size) in AllocateBuffer() argument [all …]
|
| D | free_object_list.h | 32 FreeObject *Allocate(size_t size); 34 FreeObject *LookupSuitableFreeObject(size_t size); 36 void Free(uintptr_t start, size_t size, bool isAdd = true); 40 bool MatchFreeObjectInSet(FreeObjectSet *set, size_t size); 68 void DecreaseWastedSize(size_t size) in DecreaseWastedSize() argument 70 wasted_ -= size; in DecreaseWastedSize() 72 void IncreaseWastedSize(size_t size) in IncreaseWastedSize() argument 74 wasted_ += size; in IncreaseWastedSize() 96 inline SetType SelectSetType(size_t size) const in SelectSetType() argument 98 if (size < SMALL_SET_MAX_SIZE) { in SelectSetType() [all …]
|
| D | chunk.h | 40 [[nodiscard]] void *Allocate(size_t size) in Allocate() argument 42 if (size == 0) { in Allocate() 43 LOG_ECMA_MEM(FATAL) << "size must have a size bigger than 0"; in Allocate() 47 size = AlignUp(size, MEM_ALIGN); in Allocate() 48 if (UNLIKELY(size > end_ - ptr_)) { in Allocate() 49 result = Expand(size); in Allocate() 51 ptr_ += size; in Allocate() 58 [[nodiscard]] T *NewArray(size_t size) in NewArray() argument 60 return static_cast<T *>(Allocate(size * sizeof(T))); in NewArray() 88 uintptr_t Expand(size_t size); [all …]
|
| D | sparse_space.h | 23 #define CHECK_OBJECT_AND_INC_OBJ_SIZE(size) \ argument 25 IncreaseLiveObjectSize(size); \ 27 Region::ObjectAddressToRange(object)->IncreaseAliveObject(size); \ 29 InvokeAllocationInspector(object, size, size); \ 33 #define CHECK_OBJECT_AND_INC_OBJ_SIZE(size) \ argument 35 IncreaseLiveObjectSize(size); \ 37 Region::ObjectAddressToRange(object)->IncreaseAliveObject(size); \ 65 uintptr_t Allocate(size_t size, bool allowGC = true); 83 Region *TryToGetSuitableSweptRegion(size_t size); 96 void IncreaseAllocatedSize(size_t size); [all …]
|
| /arkcompiler/ets_runtime/ecmascript/tests/ |
| D | dump_test.cpp | 183 JSHandle<JSHClass> mapClass = factory->NewEcmaHClass(JSMap::SIZE, JSType::JS_MAP, proto); in NewJSMap() 192 JSHandle<JSHClass> setClass = factory->NewEcmaHClass(JSSet::SIZE, JSType::JS_SET, proto); in NewJSSet() 203 …JSHandle<JSHClass> mapClass = factory->NewEcmaHClass(JSAPIHashMap::SIZE, JSType::JS_API_HASH_MAP, … in NewJSAPIHashMap() 214 …JSHandle<JSHClass> setClass = factory->NewEcmaHClass(JSAPIHashSet::SIZE, JSType::JS_API_HASH_SET, … in NewJSAPIHashSet() 225 …JSHandle<JSHClass> mapClass = factory->NewEcmaHClass(JSAPITreeMap::SIZE, JSType::JS_API_TREE_MAP, … in NewJSAPITreeMap() 236 …JSHandle<JSHClass> setClass = factory->NewEcmaHClass(JSAPITreeSet::SIZE, JSType::JS_API_TREE_SET, … in NewJSAPITreeSet() 247 …JSHandle<JSHClass> mapClass = factory->NewEcmaHClass(JSAPIPlainArray::SIZE, JSType::JS_API_PLAIN_A… in NewJSAPIPlainArray() 263 …JSHandle<JSHClass> listClass = factory->NewEcmaHClass(JSAPIList::SIZE, JSType::JS_API_LIST, proto); in NewJSAPIList() 274 …JSHandle<JSHClass> mapClass = factory->NewEcmaHClass(JSAPILinkedList::SIZE, JSType::JS_API_LINKED_… in NewJSAPILinkedList() 293 factory->NewEcmaHClass(JSAPIArrayList::SIZE, JSType::JS_API_ARRAY_LIST, proto); in NewJSAPIArrayList() [all …]
|
| /arkcompiler/runtime_core/libpandabase/os/ |
| D | mem.h | 41 void MmapDeleter(std::byte *ptr, size_t size) noexcept; 44 * \brief Make memory region \param mem with size \param size with protection flags \param prot 45 * @param mem Pointer to memory region (should be aligned to page size) 46 * @param size Size of memory region 50 std::optional<Error> MakeMemWithProtFlag(void *mem, size_t size, int prot); 53 * \brief Make memory region \param mem with size \param size readable and executable 54 * @param mem Pointer to memory region (should be aligned to page size) 55 * @param size Size of memory region 58 std::optional<Error> MakeMemReadExec(void *mem, size_t size); 61 * \brief Make memory region \param mem with size \param size readable and writable [all …]
|
| /arkcompiler/ets_runtime/test/fuzztest/containerslinkedlistcommon_fuzzer/ |
| D | containerslinkedlistcommon_fuzzer.h | 106 static void ContainersLinkedListAddFuzzTest(const uint8_t* data, size_t size) in ContainersLinkedListAddFuzzTest() argument 114 if (size <= 0) { in ContainersLinkedListAddFuzzTest() 117 if (size > MAXBYTELEN) { in ContainersLinkedListAddFuzzTest() 118 size = MAXBYTELEN; in ContainersLinkedListAddFuzzTest() 120 if (memcpy_s(&value, MAXBYTELEN, data, size) != 0) { in ContainersLinkedListAddFuzzTest() 128 static void ContainersLinkedListGetFirstFuzzTest(const uint8_t* data, size_t size) in ContainersLinkedListGetFirstFuzzTest() argument 136 if (size <= 0) { in ContainersLinkedListGetFirstFuzzTest() 139 if (size > MAXBYTELEN) { in ContainersLinkedListGetFirstFuzzTest() 140 size = MAXBYTELEN; in ContainersLinkedListGetFirstFuzzTest() 142 if (memcpy_s(&value, MAXBYTELEN, data, size) != 0) { in ContainersLinkedListGetFirstFuzzTest() [all …]
|
| /arkcompiler/runtime_core/platforms/unix/libpandabase/ |
| 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 57 // By design caller should pass valid size, so don't do any additional checks except ones that in MapExecuted() 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> MakeMemWithProtFlag(void *mem, size_t size, int prot) in MakeMemWithProtFlag() argument [all …]
|
| /arkcompiler/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() 134 // We should get aligned to PANDA_POOL_ALIGNMENT_IN_BYTES size in MmapMemPool() 147 … << ToVoidPtr(min_object_memory_addr_) << " Preallocated size is equal to " in MmapMemPool() 180 inline ArenaT *MmapMemPool::AllocArenaImpl(size_t size, SpaceType space_type, AllocatorType allocat… in AllocArenaImpl() argument 184 LOG_MMAP_MEM_POOL(DEBUG) << "Try to get new arena with size " << std::dec << size << " for " in AllocArenaImpl() [all …]
|
| D | mmap_mem_pool.h | 50 void SetSize(size_t size) in SetSize() argument 52 pool_ = Pool(size, GetMem()); in SetSize() 97 …// Find a free pool with enough size in the map. Split the pool, if the pool size is larger than r… 98 Pool PopFreePool(size_t size); 106 // Get the sum of all free pools size. 112 * @param pool_size the size of the pool we need 178 …ArenaT *AllocArenaImpl(size_t size, SpaceType space_type, AllocatorType allocator_type, const void… 182 void *AllocRawMemImpl(size_t size, SpaceType type); 183 void *AllocRawMemCompilerImpl(size_t size); 184 void *AllocRawMemInternalImpl(size_t size); [all …]
|
| /arkcompiler/ets_runtime/test/fuzztest/arraylist_fuzzer/ |
| D | arraylist_fuzzer.cpp | 122 void ArrayListForEachFuzzTest(const uint8_t* data, size_t size) in ArrayListForEachFuzzTest() argument 124 if (data == nullptr || size <= 0) { in ArrayListForEachFuzzTest() 136 if (size > MAXBYTELEN) { in ArrayListForEachFuzzTest() 137 size = MAXBYTELEN; in ArrayListForEachFuzzTest() 139 if (memcpy_s(&inputNum, MAXBYTELEN, data, size) != 0) { in ArrayListForEachFuzzTest() 161 void ArrayListAddFuzzTest(const uint8_t* data, size_t size) in ArrayListAddFuzzTest() argument 174 if (size <= 0) { in ArrayListAddFuzzTest() 177 if (size > MAXBYTELEN) { in ArrayListAddFuzzTest() 178 size = MAXBYTELEN; in ArrayListAddFuzzTest() 180 if (memcpy_s(&inputNum, MAXBYTELEN, data, size) != 0) { in ArrayListAddFuzzTest() [all …]
|
| /arkcompiler/runtime_core/libpandabase/utils/ |
| D | small_vector.h | 66 * that will be created once number of elements exceed size of the static buffer - `N`. 83 uint32_t size {0}; 211 buffer_.size = 0; in SmallVector() 219 buffer_.size = 0; in SmallVector() 232 buffer_.size = 0; in SmallVector() 239 buffer_.size = other.buffer_.size; in SmallVector() 241 for (uint32_t i = 0; i < buffer_.size; ++i) { in SmallVector() 255 buffer_.size = other.buffer_.size; in SmallVector() 257 for (uint32_t i = 0; i < buffer_.size; ++i) { in SmallVector() 284 buffer_.size = other.buffer_.size; [all …]
|
| /arkcompiler/ets_runtime/test/fuzztest/containersplainarray_fuzzer/ |
| D | containersplainarray_fuzzer.cpp | 80 void ContainersPlainArray_Constructor_FuzzTest(const uint8_t* data, size_t size) in ContainersPlainArray_Constructor_FuzzTest() argument 82 if (data == nullptr || size <= 0) { in ContainersPlainArray_Constructor_FuzzTest() 92 if (size > MAXBYTELEN) { in ContainersPlainArray_Constructor_FuzzTest() 93 size = MAXBYTELEN; in ContainersPlainArray_Constructor_FuzzTest() 95 if (memcpy_s(&input, MAXBYTELEN, data, size) != 0) { in ContainersPlainArray_Constructor_FuzzTest() 108 void ContainersPlainArray_Add_Has_FuzzTest(const uint8_t* data, size_t size) in ContainersPlainArray_Add_Has_FuzzTest() argument 110 if (data == nullptr || size <= 0) { in ContainersPlainArray_Add_Has_FuzzTest() 121 std::string inputStr(data, data + size); in ContainersPlainArray_Add_Has_FuzzTest() 123 if (size > MAXBYTELEN) { in ContainersPlainArray_Add_Has_FuzzTest() 124 size = MAXBYTELEN; in ContainersPlainArray_Add_Has_FuzzTest() [all …]
|
| /arkcompiler/runtime_core/libpandabase/serializer/ |
| D | serializer.h | 60 // pack size 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; 79 // pack size 80 auto ret = TypeToBuffer(static_cast<uint32_t>(map.size()), buffer); 110 Expected<size_t, const char *> BufferToType(const uint8_t *data, size_t size, /* out */ T &value) in BufferToType() argument 114 if (sizeof(value) > size) { in BufferToType() 124 inline Expected<size_t, const char *> BufferToType(const uint8_t *data, size_t size, /* out */ std:… in BufferToType() argument [all …]
|
| /arkcompiler/ets_runtime/ecmascript/platform/unix/ |
| D | map.cpp | 27 MemMap PageMap(size_t size, int prot, size_t alignment) in PageMap() argument 29 ASSERT(size == AlignUp(size, PageSize())); in PageMap() 31 size_t allocSize = size + alignment; in PageMap() 40 void *alignEndResult = reinterpret_cast<void *>(alignResult + size); in PageMap() 45 return MemMap(result, size); in PageMap() 53 MemMap MachineCodePageMap(size_t size, int prot, size_t alignment) in MachineCodePageMap() argument 55 MemMap memMap = PageMap(size, prot, alignment); in MachineCodePageMap() 67 void PageRelease(void *mem, size_t size) in PageRelease() argument 69 madvise(mem, size, MADV_DONTNEED); in PageRelease() 72 void PagePreRead(void *mem, size_t size) in PagePreRead() argument [all …]
|
| /arkcompiler/runtime_core/libpandabase/tests/ |
| D | arena_allocator_test.cpp | 201 constexpr size_t SIZE = 2048; variable 207 for (size_t i = 0; i < SIZE; ++i) { 211 ASSERT_EQ(SIZE, vec.size()); 213 ASSERT_EQ(SIZE, vec.size()); 215 for (size_t i = 0; i < SIZE; ++i) { 222 constexpr size_t SIZE = 512; variable 223 constexpr size_t MAGIC_CONSTANT_1 = std::numeric_limits<size_t>::max() / (SIZE + 2); 225 size_t MAGIC_CONSTANT_2 = rand() % SIZE; 230 // Allocate SIZE objects 231 for (size_t i = 0; i < SIZE; ++i) { [all …]
|
| D | utf_test.cpp | 32 std::vector<uint16_t> out(res.size()); 41 std::vector<uint16_t> out(res.size()); 50 std::vector<uint16_t> out(res.size()); 59 std::vector<uint16_t> out(res.size()); 68 std::vector<uint16_t> out(res.size()); 76 std::vector<uint16_t> out(res.size()); 84 std::vector<uint16_t> out(res.size()); 95 size_t res = Utf16ToMUtf8Size(in.data(), in.size()); 102 size_t res = Utf16ToMUtf8Size(in.data(), in.size()); 108 size_t res = Utf16ToMUtf8Size(in.data(), in.size()); [all …]
|
| /arkcompiler/toolchain/tooling/test/ |
| D | pt_base64_test.cpp | 49 dest.resize(PtBase64::DecodedSize(src.size())); in HWTEST_F_L0() 50 auto [numOctets, done] = PtBase64::Decode(dest.data(), src.data(), src.size()); in HWTEST_F_L0() 55 size_t len = PtBase64::Encode(dest.data(), src.data(), src.size()); in HWTEST_F_L0() 68 dest.resize(PtBase64::EncodedSize(src.size())); in HWTEST_F_L0() 69 len = PtBase64::Encode(dest.data(), src.data(), src.size()); in HWTEST_F_L0() 73 dest.resize(PtBase64::DecodedSize(src.size())); in HWTEST_F_L0() 74 auto [numOctets, done] = PtBase64::Decode(dest.data(), src.data(), src.size()); in HWTEST_F_L0() 82 dest.resize(PtBase64::EncodedSize(src.size())); in HWTEST_F_L0() 83 len = PtBase64::Encode(dest.data(), src.data(), src.size()); in HWTEST_F_L0() 87 dest.resize(PtBase64::DecodedSize(src.size())); in HWTEST_F_L0() [all …]
|
| /arkcompiler/ets_runtime/ecmascript/ |
| D | js_function.h | 61 static constexpr size_t METHOD_OFFSET = JSObject::SIZE; 69 static_assert((JSFunctionBase::SIZE % static_cast<uint8_t>(MemAlignment::MEM_ALIGN_OBJECT)) == 0); 227 static constexpr size_t PROTO_OR_DYNCLASS_OFFSET = JSFunctionBase::SIZE; 234 DECL_VISIT_OBJECT_FOR_JS_OBJECT(JSFunctionBase, PROTO_OR_DYNCLASS_OFFSET, SIZE) 248 static constexpr size_t SIZE = JSFunction::SIZE; variable 250 DECL_VISIT_OBJECT_FOR_JS_OBJECT(JSFunction, SIZE, SIZE) 262 static constexpr size_t BOUND_TARGET_OFFSET = JSFunctionBase::SIZE; 265 ACCESSORS(BoundArguments, BOUND_ARGUMENTS_OFFSET, SIZE); 267 DECL_VISIT_OBJECT_FOR_JS_OBJECT(JSFunctionBase, BOUND_TARGET_OFFSET, SIZE) 278 static constexpr size_t REVOCABLE_PROXY_OFFSET = JSFunction::SIZE; [all …]
|
| /arkcompiler/ets_runtime/ecmascript/js_api/ |
| D | js_api_plain_array.cpp | 33 uint32_t size = obj->GetLength(); in Add() local 34 int32_t index = obj->BinarySearch(*keyArray, 0, size, key.GetTaggedValue().GetNumber()); in Add() 41 if (index < static_cast<int32_t>(size)) { in Add() 42 obj->AdjustArray(thread, *keyArray, index, size, true); in Add() 43 obj->AdjustArray(thread, *valueArray, index, size, true); in Add() 46 if (size + 1 >= capacity) { in Add() 57 size++; in Add() 58 obj->SetLength(size); in Add() 63 ASSERT_PRINT(capacity > 0, "size must be a non-negative integer"); in CreateSlot() 71 uint32_t size = GetLength(); in AdjustForward() local [all …]
|
| /arkcompiler/runtime_core/platforms/windows/libpandabase/ |
| D | mem.cpp | 152 void MmapDeleter(std::byte *ptr, size_t size) noexcept in MmapDeleter() argument 155 munmap(ptr, size); in MmapDeleter() 159 BytePtr MapFile(file::File file, uint32_t prot, uint32_t flags, size_t size, size_t file_offset, vo… in MapFile() argument 163 size_t map_size = size + offset; in MapFile() 169 return BytePtr(static_cast<std::byte *>(result) + offset, size, MmapDeleter); in MapFile() 172 BytePtr MapExecuted(size_t size) in MapExecuted() argument 174 // By design caller should pass valid size, so don't do any additional checks except ones that in MapExecuted() 177 …void *result = mmap(nullptr, size, MMAP_PROT_EXEC | MMAP_PROT_WRITE, MMAP_FLAG_SHARED | MMAP_FLAG_… in MapExecuted() 182 return BytePtr(static_cast<std::byte *>(result), (result == nullptr) ? 0 : size, MmapDeleter); in MapExecuted() 185 std::optional<Error> MakeMemWithProtFlag(void *mem, size_t size, int prot) in MakeMemWithProtFlag() argument [all …]
|
| /arkcompiler/ets_runtime/ecmascript/platform/windows/ |
| D | map.cpp | 39 MemMap PageMap(size_t size, int prot, size_t alignment) in PageMap() argument 41 ASSERT(size == AlignUp(size, PageSize())); in PageMap() 43 size_t allocSize = size + alignment; in PageMap() 48 … LOG_NO_TAG(ERROR) << "[ArkRuntime Log]Failed to request a continuous segment of " << size in PageMap() 51 …LOG_ECMA(FATAL) << "PageMap "<< size << ", prot:" << prot << " fail, the error code is: " << errCo… in PageMap() 55 return MemMap(result, reinterpret_cast<void *>(alignResult), size); in PageMap() 57 return MemMap(result, result, size); in PageMap() 68 MemMap MachineCodePageMap(size_t size, int prot, size_t alignment) in MachineCodePageMap() argument 70 MemMap memMap = PageMap(size, prot, alignment); in MachineCodePageMap() 82 void PageRelease([[maybe_unused]] void *mem, [[maybe_unused]] size_t size) in PageRelease() argument [all …]
|