Lines Matching refs:std

62     void* scalable_malloc(std::size_t);
64 void* scalable_aligned_malloc(std::size_t, std::size_t);
75 static void* initialize_allocate_handler(std::size_t size);
78 using allocate_handler_type = void* (*)(std::size_t size);
79 static std::atomic<allocate_handler_type> allocate_handler{ &initialize_allocate_handler };
86 static void* initialize_cache_aligned_allocate_handler(std::size_t n, std::size_t alignment);
89 static void* std_cache_aligned_allocate(std::size_t n, std::size_t alignment);
95 using cache_aligned_allocate_handler_type = void* (*)(std::size_t n, std::size_t alignment);
96 static std::atomic<cache_aligned_allocate_handler_type> cache_aligned_allocate_handler{ &initialize…
142 allocate_handler_unsafe = &std::malloc; in initialize_handler_pointers()
143 deallocate_handler = &std::free; in initialize_handler_pointers()
148 allocate_handler.store(allocate_handler_unsafe, std::memory_order_release); in initialize_handler_pointers()
149 …cache_aligned_allocate_handler.store(cache_aligned_allocate_handler_unsafe, std::memory_order_rele… in initialize_handler_pointers()
154 static std::once_flag initialization_state;
156 std::call_once(initialization_state, &initialize_handler_pointers); in initialize_cache_aligned_allocator()
160 static void* initialize_allocate_handler(std::size_t size) { in initialize_allocate_handler()
167 static void* initialize_cache_aligned_allocate_handler(std::size_t bytes, std::size_t alignment) { in initialize_cache_aligned_allocate_handler()
175 static constexpr std::size_t nfs_size = 128;
177 std::size_t __TBB_EXPORTED_FUNC cache_line_size() { in cache_line_size()
181 void* __TBB_EXPORTED_FUNC cache_aligned_allocate(std::size_t size) { in cache_aligned_allocate()
182 const std::size_t cache_line_size = nfs_size; in cache_aligned_allocate()
192 …void* result = cache_aligned_allocate_handler.load(std::memory_order_acquire)(size, cache_line_siz… in cache_aligned_allocate()
205 static void* std_cache_aligned_allocate(std::size_t bytes, std::size_t alignment) { in std_cache_aligned_allocate()
218 std::size_t space = alignment + bytes; in std_cache_aligned_allocate()
219 std::uintptr_t base = reinterpret_cast<std::uintptr_t>(std::malloc(space)); in std_cache_aligned_allocate()
223 std::uintptr_t result = (base + nfs_size) & ~(nfs_size - 1); in std_cache_aligned_allocate()
225 …__TBB_ASSERT((result - base) >= sizeof(std::uintptr_t), "Cannot store a base pointer to the header… in std_cache_aligned_allocate()
229 (reinterpret_cast<std::uintptr_t*>(result))[-1] = base; in std_cache_aligned_allocate()
241 …__TBB_ASSERT(reinterpret_cast<std::uintptr_t>(p) >= 0x4096, "attempt to free block not obtained fr… in std_cache_aligned_deallocate()
243 std::uintptr_t base = (reinterpret_cast<std::uintptr_t*>(p))[-1]; in std_cache_aligned_deallocate()
244 …__TBB_ASSERT(((base + nfs_size) & ~(nfs_size - 1)) == reinterpret_cast<std::uintptr_t>(p), "Incorr… in std_cache_aligned_deallocate()
245 std::free(reinterpret_cast<void*>(base)); in std_cache_aligned_deallocate()
250 void* __TBB_EXPORTED_FUNC allocate_memory(std::size_t size) { in allocate_memory()
251 void* result = allocate_handler.load(std::memory_order_acquire)(size); in allocate_memory()
266 auto handler_snapshot = allocate_handler.load(std::memory_order_acquire); in is_tbbmalloc_used()
270 handler_snapshot = allocate_handler.load(std::memory_order_relaxed); in is_tbbmalloc_used()
273 …) == reinterpret_cast<void*>(&std::malloc)) == (reinterpret_cast<void*>(deallocate_handler) == rei… in is_tbbmalloc_used()
275 return reinterpret_cast<void*>(handler_snapshot) == reinterpret_cast<void*>(&std::malloc); in is_tbbmalloc_used()