/bionic/benchmarks/tests/ |
D | benchmark_test.cpp | 22 for (size_t alignment = 1; alignment <= 32; alignment *= 2) { in TEST() local 23 for (size_t or_mask = 0; or_mask < alignment; ++or_mask) { in TEST() 24 uintptr_t aligned_ptr = reinterpret_cast<uintptr_t>(GetAlignedMemory(buf.data(), alignment, in TEST() 26 ASSERT_EQ(aligned_ptr % alignment, or_mask); in TEST() 27 ASSERT_EQ(aligned_ptr & alignment, alignment); in TEST() 34 for (size_t alignment = 1; alignment <= 2048; alignment *= 2) { in TEST() local 35 uintptr_t aligned_ptr = reinterpret_cast<uintptr_t>(GetAlignedPtr(&buf, alignment, 100)); in TEST() 36 ASSERT_EQ(aligned_ptr & alignment, alignment); in TEST() 37 ASSERT_EQ(aligned_ptr & (alignment - 1), 0u); in TEST()
|
/bionic/benchmarks/ |
D | util.cpp | 29 char* GetAlignedMemory(char* orig_ptr, size_t alignment, size_t or_mask) { in GetAlignedMemory() argument 30 if ((alignment & (alignment - 1)) != 0) { in GetAlignedMemory() 33 if (or_mask > alignment) { in GetAlignedMemory() 37 if (alignment > 0) { in GetAlignedMemory() 41 ptr += alignment - (ptr & (alignment - 1)); in GetAlignedMemory() 42 ptr |= alignment | or_mask; in GetAlignedMemory() 48 char* GetAlignedPtr(std::vector<char>* buf, size_t alignment, size_t nbytes) { in GetAlignedPtr() argument 49 buf->resize(nbytes + 3 * alignment); in GetAlignedPtr() 50 return GetAlignedMemory(buf->data(), alignment, 0); in GetAlignedPtr() 53 wchar_t* GetAlignedPtr(std::vector<wchar_t>* buf, size_t alignment, size_t nchars) { in GetAlignedPtr() argument [all …]
|
D | util.h | 64 char* GetAlignedMemory(char* orig_ptr, size_t alignment, size_t or_mask); 66 char* GetAlignedPtr(std::vector<char>* buf, size_t alignment, size_t nbytes); 68 wchar_t* GetAlignedPtr(std::vector<wchar_t>* buf, size_t alignment, size_t nbytes); 70 char* GetAlignedPtrFilled(std::vector<char>* buf, size_t alignment, size_t nbytes, char fill_byte);
|
D | string_benchmark.cpp | 81 const size_t alignment = state.range(1); in BM_string_memmove_overlap_dst_before_src() local 83 std::vector<char> buf(3 * alignment + nbytes + 1, 'x'); in BM_string_memmove_overlap_dst_before_src() 84 char* buf_aligned = GetAlignedPtrFilled(&buf, alignment, nbytes + 1, 'x'); in BM_string_memmove_overlap_dst_before_src() 96 const size_t alignment = state.range(1); in BM_string_memmove_overlap_src_before_dst() local 99 char* buf_aligned = GetAlignedPtrFilled(&buf, alignment, nbytes + 1, 'x'); in BM_string_memmove_overlap_src_before_dst() 111 const size_t alignment = state.range(1); in BM_string_memset() local 114 char* buf_aligned = GetAlignedPtr(&buf, alignment, nbytes + 1); in BM_string_memset() 126 const size_t alignment = state.range(1); in BM_string_strlen() local 129 char* buf_aligned = GetAlignedPtrFilled(&buf, alignment, nbytes + 1, 'x'); in BM_string_strlen()
|
/bionic/libc/malloc_hooks/ |
D | malloc_hooks.cpp | 63 void* hooks_memalign(size_t alignment, size_t bytes); 64 void* hooks_aligned_alloc(size_t alignment, size_t bytes); 69 int hooks_posix_memalign(void** memptr, size_t alignment, size_t size); 93 static void* default_memalign_hook(size_t alignment, size_t bytes, const void*) { in default_memalign_hook() argument 94 return g_dispatch->memalign(alignment, bytes); in default_memalign_hook() 142 void* hooks_memalign(size_t alignment, size_t bytes) { in hooks_memalign() argument 144 return __memalign_hook(alignment, bytes, __builtin_return_address(0)); in hooks_memalign() 146 return g_dispatch->memalign(alignment, bytes); in hooks_memalign() 183 void* hooks_aligned_alloc(size_t alignment, size_t size) { in hooks_aligned_alloc() argument 185 if (!powerof2(alignment) || (size % alignment) != 0) { in hooks_aligned_alloc() [all …]
|
D | README.md | 48 called, but only if alignment is a power of 2. 51 called, but only if alignment is a power of 2. 57 has been set, then the hook is called with an appropriate alignment value.
|
/bionic/libc/bionic/ |
D | bionic_elf_tls.cpp | 75 bool __bionic_check_tls_alignment(size_t* alignment) { in __bionic_check_tls_alignment() argument 79 if (*alignment == 0 || !powerof2(*alignment)) { in __bionic_check_tls_alignment() 83 *alignment = MIN(*alignment, PAGE_SIZE); in __bionic_check_tls_alignment() 108 const size_t result = reserve(exe_segment->size, exe_segment->alignment); in reserve_exe_segment_and_tcb() 115 const size_t exe_tpoff = __BIONIC_ALIGN(sizeof(void*) * 2, exe_segment->alignment); in reserve_exe_segment_and_tcb() 121 progname, exe_segment->alignment, min_bionic_alignment, in reserve_exe_segment_and_tcb() 133 const size_t exe_size = round_up_with_overflow_check(exe_segment->size, exe_segment->alignment); in reserve_exe_segment_and_tcb() 135 const size_t max_align = MAX(alignof(bionic_tcb), exe_segment->alignment); in reserve_exe_segment_and_tcb() 159 size_t StaticTlsLayout::reserve(size_t size, size_t alignment) { in reserve() argument 160 offset_ = round_up_with_overflow_check(offset_, alignment); in reserve() [all …]
|
D | malloc_limit.cpp | 50 static void* LimitMemalign(size_t alignment, size_t bytes); 51 static int LimitPosixMemalign(void** memptr, size_t alignment, size_t size); 53 static void* LimitAlignedAlloc(size_t alignment, size_t size); 149 static void* LimitMemalign(size_t alignment, size_t bytes) { in LimitMemalign() argument 151 warning_log("malloc_limit: memalign(%zu, %zu) exceeds limit %" PRId64, alignment, bytes, in LimitMemalign() 157 return IncrementLimit(dispatch_table->memalign(alignment, bytes)); in LimitMemalign() 159 return IncrementLimit(Malloc(memalign)(alignment, bytes)); in LimitMemalign() 162 static int LimitPosixMemalign(void** memptr, size_t alignment, size_t size) { in LimitPosixMemalign() argument 164 warning_log("malloc_limit: posix_memalign(%zu, %zu) exceeds limit %" PRId64, alignment, size, in LimitPosixMemalign() 171 retval = dispatch_table->posix_memalign(memptr, alignment, size); in LimitPosixMemalign() [all …]
|
D | malloc_common.cpp | 134 extern "C" void* memalign(size_t alignment, size_t bytes) { in memalign() argument 137 return MaybeTagPointer(dispatch_table->memalign(alignment, bytes)); in memalign() 139 void* result = Malloc(memalign)(alignment, bytes); in memalign() 141 warning_log("memalign(%zu, %zu) failed: returning null pointer", alignment, bytes); in memalign() 146 extern "C" int posix_memalign(void** memptr, size_t alignment, size_t size) { in posix_memalign() argument 150 result = dispatch_table->posix_memalign(memptr, alignment, size); in posix_memalign() 152 result = Malloc(posix_memalign)(memptr, alignment, size); in posix_memalign() 160 extern "C" void* aligned_alloc(size_t alignment, size_t size) { in aligned_alloc() argument 163 return MaybeTagPointer(dispatch_table->aligned_alloc(alignment, size)); in aligned_alloc() 165 void* result = Malloc(aligned_alloc)(alignment, size); in aligned_alloc() [all …]
|
D | jemalloc_wrapper.cpp | 59 void* je_aligned_alloc_wrapper(size_t alignment, size_t size) { in je_aligned_alloc_wrapper() argument 60 if ((size % alignment) != 0) { in je_aligned_alloc_wrapper() 64 return je_aligned_alloc(alignment, size); in je_aligned_alloc_wrapper()
|
D | libc_init_static.cpp | 142 if (!__bionic_check_tls_alignment(&mod.segment.alignment)) { in layout_static_tls() 144 progname, mod.segment.alignment); in layout_static_tls()
|
/bionic/libc/private/ |
D | bionic_elf_tls.h | 41 size_t alignment = 1; member 49 __LIBC_HIDDEN__ bool __bionic_check_tls_alignment(size_t* alignment); 69 size_t alignment() const { return alignment_; } in alignment() function 75 return reserve(segment.size, segment.alignment); in reserve_solib_segment() 80 size_t reserve(size_t size, size_t alignment); 86 size_t round_up_with_overflow_check(size_t value, size_t alignment);
|
/bionic/tests/libs/ |
D | bionic_tests_zipalign.cpp | 67 static bool CreateAlignedZip(ZipArchiveHandle& handle, FILE* zip_dst, uint32_t alignment) { in CreateAlignedZip() argument 86 error = writer.StartAlignedEntry(zip_name.c_str(), flags, alignment); in CreateAlignedZip() 126 unsigned long int alignment = strtoul(argv[1], &end, 10); in main() local 127 if ((alignment == ULONG_MAX && errno == ERANGE) || *end != '\0') { in main() 132 if (((alignment - 1) & alignment) != 0) { in main() 152 bool success = CreateAlignedZip(handle, zip_dst, static_cast<uint32_t>(alignment)); in main()
|
D | segment_gap_outer.lds | 3 # appropriate alignment between them.
|
/bionic/libc/malloc_debug/ |
D | malloc_debug.cpp | 90 void* debug_aligned_alloc(size_t alignment, size_t size); 91 void* debug_memalign(size_t alignment, size_t bytes); 97 int debug_posix_memalign(void** memptr, size_t alignment, size_t size); 565 void* debug_memalign(size_t alignment, size_t bytes) { in debug_memalign() argument 567 return g_dispatch->memalign(alignment, bytes); in debug_memalign() 585 if (!powerof2(alignment)) { in debug_memalign() 586 alignment = BIONIC_ROUND_UP_POWER_OF_2(alignment); in debug_memalign() 590 if (alignment < MINIMUM_ALIGNMENT_BYTES) { in debug_memalign() 591 alignment = MINIMUM_ALIGNMENT_BYTES; in debug_memalign() 597 size_t real_size = alignment + bytes + g_debug->extra_bytes(); in debug_memalign() [all …]
|
D | RecordData.cpp | 84 MemalignEntry::MemalignEntry(void* pointer, size_t size, size_t alignment) in MemalignEntry() argument 85 : MallocEntry(pointer, size), alignment_(alignment) {} in MemalignEntry()
|
D | RecordData.h | 134 MemalignEntry(void* pointer, size_t size, size_t alignment);
|
/bionic/tests/ |
D | buffer_tests.cpp | 196 static void *GetAlignedPtr(void *orig_ptr, int alignment, int or_mask) { in GetAlignedPtr() argument 198 if (alignment > 0) { in GetAlignedPtr() 202 ptr += alignment - (ptr & (alignment - 1)); in GetAlignedPtr() 203 ptr |= alignment | or_mask; in GetAlignedPtr()
|
D | malloc_test.cpp | 114 for (size_t alignment = 1 << i; alignment < (1U << (i+1)); alignment++) { in TEST() local 115 char *ptr = reinterpret_cast<char*>(memalign(alignment, 100)); in TEST() 116 ASSERT_TRUE(ptr != nullptr) << "Failed at alignment " << alignment; in TEST() 117 ASSERT_LE(100U, malloc_usable_size(ptr)) << "Failed at alignment " << alignment; in TEST() 119 << "Failed at alignment " << alignment; in TEST() 142 for (size_t alignment = 1; alignment <= 4096; alignment <<= 1) { in TEST() local 143 char *ptr = (char*)memalign(alignment, 100); in TEST() 146 ASSERT_EQ(0U, (intptr_t)ptr % alignment); in TEST()
|
/bionic/libc/malloc_debug/tests/ |
D | malloc_debug_unit_tests.cpp | 412 for (size_t alignment = 1; alignment <= 256; alignment++) { in TEST_F() local 413 pointer = reinterpret_cast<uint8_t*>(debug_memalign(alignment, 100)); in TEST_F() 417 size_t alignment_mask = alignment - 1; in TEST_F() 418 if (!powerof2(alignment)) { in TEST_F() 419 alignment_mask = BIONIC_ROUND_UP_POWER_OF_2(alignment) - 1; in TEST_F() 509 for (size_t alignment = 1; alignment <= 256; alignment++) { in TEST_F() local 510 pointer = reinterpret_cast<uint8_t*>(debug_memalign(alignment, 100)); in TEST_F() 515 size_t alignment_mask = alignment - 1; in TEST_F() 516 if (!powerof2(alignment)) { in TEST_F() 517 alignment_mask = BIONIC_ROUND_UP_POWER_OF_2(alignment) - 1; in TEST_F() [all …]
|
/bionic/libc/kernel/uapi/mtd/ |
D | ubi-user.h | 67 __s32 alignment; member
|
/bionic/libc/malloc_hooks/tests/ |
D | malloc_hooks_tests.cpp | 168 void* MallocHooksTest::test_memalign_hook(size_t alignment, size_t size, const void* arg) { in test_memalign_hook() argument 171 return orig_memalign_hook_(alignment, size, arg); in test_memalign_hook()
|
/bionic/libc/kernel/uapi/drm/ |
D | i915_drm.h | 379 int alignment; member 484 __u64 alignment; member 501 __u64 alignment; member 572 __u64 alignment; member
|
D | radeon_drm.h | 561 int alignment; member 615 __u64 alignment; member
|
/bionic/linker/ |
D | linker_phdr.h | 71 bool CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment);
|