Home
last modified time | relevance | path

Searched refs:alignment (Results 1 – 25 of 33) sorted by relevance

12

/bionic/benchmarks/tests/
Dbenchmark_test.cpp22 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/
Dutil.cpp29 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 …]
Dutil.h64 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);
Dstring_benchmark.cpp80 const size_t alignment = state.range(1); in BM_string_memmove_overlap_dst_before_src() local
82 std::vector<char> buf(3 * alignment + nbytes + 1, 'x'); in BM_string_memmove_overlap_dst_before_src()
83 char* buf_aligned = GetAlignedPtrFilled(&buf, alignment, nbytes + 1, 'x'); in BM_string_memmove_overlap_dst_before_src()
95 const size_t alignment = state.range(1); in BM_string_memmove_overlap_src_before_dst() local
98 char* buf_aligned = GetAlignedPtrFilled(&buf, alignment, nbytes + 1, 'x'); in BM_string_memmove_overlap_src_before_dst()
110 const size_t alignment = state.range(1); in BM_string_memset() local
113 char* buf_aligned = GetAlignedPtr(&buf, alignment, nbytes + 1); in BM_string_memset()
125 const size_t alignment = state.range(1); in BM_string_strlen() local
128 char* buf_aligned = GetAlignedPtrFilled(&buf, alignment, nbytes + 1, 'x'); in BM_string_strlen()
/bionic/libc/malloc_hooks/
Dmalloc_hooks.cpp63 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 …]
DREADME.md48 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/
Dmalloc_limit.cpp51 static void* LimitMemalign(size_t alignment, size_t bytes);
52 static int LimitPosixMemalign(void** memptr, size_t alignment, size_t size);
54 static void* LimitAlignedAlloc(size_t alignment, size_t size);
150 static void* LimitMemalign(size_t alignment, size_t bytes) { in LimitMemalign() argument
152 warning_log("malloc_limit: memalign(%zu, %zu) exceeds limit %" PRId64, alignment, bytes, in LimitMemalign()
158 return IncrementLimit(dispatch_table->memalign(alignment, bytes)); in LimitMemalign()
160 return IncrementLimit(Malloc(memalign)(alignment, bytes)); in LimitMemalign()
163 static int LimitPosixMemalign(void** memptr, size_t alignment, size_t size) { in LimitPosixMemalign() argument
165 warning_log("malloc_limit: posix_memalign(%zu, %zu) exceeds limit %" PRId64, alignment, size, in LimitPosixMemalign()
172 retval = dispatch_table->posix_memalign(memptr, alignment, size); in LimitPosixMemalign()
[all …]
Dmalloc_common.cpp160 extern "C" void* memalign(size_t alignment, size_t bytes) { in memalign() argument
163 return MaybeTagPointer(dispatch_table->memalign(alignment, bytes)); in memalign()
165 void* result = Malloc(memalign)(alignment, bytes); in memalign()
167 warning_log("memalign(%zu, %zu) failed: returning null pointer", alignment, bytes); in memalign()
172 extern "C" int posix_memalign(void** memptr, size_t alignment, size_t size) { in posix_memalign() argument
176 result = dispatch_table->posix_memalign(memptr, alignment, size); in posix_memalign()
178 result = Malloc(posix_memalign)(memptr, alignment, size); in posix_memalign()
186 extern "C" void* aligned_alloc(size_t alignment, size_t size) { in aligned_alloc() argument
189 return MaybeTagPointer(dispatch_table->aligned_alloc(alignment, size)); in aligned_alloc()
191 void* result = Malloc(aligned_alloc)(alignment, size); in aligned_alloc()
[all …]
Djemalloc_wrapper.cpp69 void* je_aligned_alloc_wrapper(size_t alignment, size_t size) { in je_aligned_alloc_wrapper() argument
70 if ((size % alignment) != 0) { in je_aligned_alloc_wrapper()
74 return je_aligned_alloc(alignment, size); in je_aligned_alloc_wrapper()
/bionic/tests/libs/
Dbionic_tests_zipalign.cpp67 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()
Dsegment_gap_outer.lds3 # appropriate alignment between them.
/bionic/tests/
Dbionic_allocator_test.cpp241 size_t alignment; in TEST() local
244 alignment = kPageSize >> 1; in TEST()
245 ptr = allocator.memalign(alignment, 0x2000); in TEST()
247 ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr) % alignment); in TEST()
251 alignment = kPageSize; in TEST()
252 ptr = allocator.memalign(alignment, 0x2000); in TEST()
254 ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr) % alignment); in TEST()
259 alignment = kPageSize << 1; in TEST()
260 ptr = allocator.memalign(alignment, 0x4000); in TEST()
Dbuffer_tests.cpp196 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()
Dmalloc_test.cpp146 for (size_t alignment = 1 << i; alignment < (1U << (i+1)); alignment++) { in TEST() local
147 char *ptr = reinterpret_cast<char*>(memalign(alignment, 100)); in TEST()
148 ASSERT_TRUE(ptr != nullptr) << "Failed at alignment " << alignment; in TEST()
149 ASSERT_LE(100U, malloc_usable_size(ptr)) << "Failed at alignment " << alignment; in TEST()
151 << "Failed at alignment " << alignment; in TEST()
174 for (size_t alignment = 1; alignment <= 4096; alignment <<= 1) { in TEST() local
175 char *ptr = (char*)memalign(alignment, 100); in TEST()
178 ASSERT_EQ(0U, (intptr_t)ptr % alignment); in TEST()
/bionic/linker/
Dlinker_memory.cpp75 void* memalign(size_t alignment, size_t byte_count) { in memalign() argument
76 return get_allocator().memalign(alignment, byte_count); in memalign()
79 void* aligned_alloc(size_t alignment, size_t byte_count) { in aligned_alloc() argument
80 return get_allocator().memalign(alignment, byte_count); in aligned_alloc()
Dlinker_phdr.h75 [[nodiscard]] bool CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment);
/bionic/libc/malloc_debug/
Dmalloc_debug.cpp187 void* debug_aligned_alloc(size_t alignment, size_t size);
188 void* debug_memalign(size_t alignment, size_t bytes);
194 int debug_posix_memalign(void** memptr, size_t alignment, size_t size);
687 void* debug_memalign(size_t alignment, size_t bytes) { in debug_memalign() argument
691 return g_dispatch->memalign(alignment, bytes); in debug_memalign()
710 if (!powerof2(alignment)) { in debug_memalign()
711 alignment = BIONIC_ROUND_UP_POWER_OF_2(alignment); in debug_memalign()
715 if (alignment < MINIMUM_ALIGNMENT_BYTES) { in debug_memalign()
716 alignment = MINIMUM_ALIGNMENT_BYTES; in debug_memalign()
722 size_t real_size = alignment + bytes + g_debug->extra_bytes(); in debug_memalign()
[all …]
DRecordData.cpp94 MemalignEntry::MemalignEntry(void* pointer, size_t size, size_t alignment, uint64_t start_ns, in MemalignEntry() argument
96 : MallocEntry(pointer, size, start_ns, end_ns), alignment_(alignment) {} in MemalignEntry()
DRecordData.h141 MemalignEntry(void* pointer, size_t size, size_t alignment, uint64_t st, uint64_t et);
/bionic/libc/kernel/uapi/linux/
Dvirtio_bt.h31 __u8 alignment; member
/bionic/libc/kernel/uapi/mtd/
Dubi-user.h57 __s32 alignment; member
/bionic/libc/malloc_hooks/tests/
Dmalloc_hooks_tests.cpp169 void* MallocHooksTest::test_memalign_hook(size_t alignment, size_t size, const void* arg) { in test_memalign_hook() argument
172 return orig_memalign_hook_(alignment, size, arg); in test_memalign_hook()
/bionic/libc/malloc_debug/tests/
Dmalloc_debug_unit_tests.cpp481 for (size_t alignment = 1; alignment <= 256; alignment++) { in TEST_F() local
482 pointer = reinterpret_cast<uint8_t*>(debug_memalign(alignment, 100)); in TEST_F()
486 size_t alignment_mask = alignment - 1; in TEST_F()
487 if (!powerof2(alignment)) { in TEST_F()
488 alignment_mask = BIONIC_ROUND_UP_POWER_OF_2(alignment) - 1; in TEST_F()
578 for (size_t alignment = 1; alignment <= 256; alignment++) { in TEST_F() local
579 pointer = reinterpret_cast<uint8_t*>(debug_memalign(alignment, 100)); in TEST_F()
584 size_t alignment_mask = alignment - 1; in TEST_F()
585 if (!powerof2(alignment)) { in TEST_F()
586 alignment_mask = BIONIC_ROUND_UP_POWER_OF_2(alignment) - 1; in TEST_F()
[all …]
/bionic/libc/kernel/uapi/drm/
Di915_drm.h384 int alignment; member
490 __u64 alignment; member
507 __u64 alignment; member
586 __u64 alignment; member
Dradeon_drm.h549 int alignment; member
603 __u64 alignment; member

12