#ifndef _TBB_malloc_Customize_H_
#define _TBB_malloc_Customize_H_
#define MALLOC_ASSERT(assertion, message) __TBB_ASSERT(assertion, message)
#define MALLOC_ASSERT_EX(assertion, message) __TBB_ASSERT_EX(assertion, message)
#ifndef MALLOC_DEBUG
#define MALLOC_DEBUG TBB_USE_DEBUG
#endif
#include "oneapi/tbb/detail/_utils.h"
#include "oneapi/tbb/detail/_assert.h"
#include "Synchronize.h"
#if __TBB_USE_ITT_NOTIFY
#include "../tbb/itt_notify.h"
#define MALLOC_ITT_SYNC_PREPARE(pointer) ITT_NOTIFY(sync_prepare, (pointer))
#define MALLOC_ITT_SYNC_ACQUIRED(pointer) ITT_NOTIFY(sync_acquired, (pointer))
#define MALLOC_ITT_SYNC_RELEASING(pointer) ITT_NOTIFY(sync_releasing, (pointer))
#define MALLOC_ITT_SYNC_CANCEL(pointer) ITT_NOTIFY(sync_cancel, (pointer))
#define MALLOC_ITT_FINI_ITTLIB() ITT_FINI_ITTLIB()
#else
#define MALLOC_ITT_SYNC_PREPARE(pointer) ((void)0)
#define MALLOC_ITT_SYNC_ACQUIRED(pointer) ((void)0)
#define MALLOC_ITT_SYNC_RELEASING(pointer) ((void)0)
#define MALLOC_ITT_SYNC_CANCEL(pointer) ((void)0)
#define MALLOC_ITT_FINI_ITTLIB() ((void)0)
#endif
inline intptr_t BitScanRev(uintptr_t x) {
return !x? -1 : tbb::detail::log2(x);
}
template<typename T>
static inline bool isAligned(T* arg, uintptr_t alignment) {
return tbb::detail::is_aligned(arg,alignment);
}
static inline bool isPowerOfTwo(uintptr_t arg) {
return tbb::detail::is_power_of_two(arg);
}
static inline bool isPowerOfTwoAtLeast(uintptr_t arg, uintptr_t power2) {
return arg && tbb::detail::is_power_of_two_at_least(arg,power2);
}
inline void do_yield() {
tbb::detail::yield();
}
#define USE_DEFAULT_MEMORY_MAPPING 1
#include "../tbbmalloc_proxy/proxy.h"
#if MALLOC_UNIXLIKE_OVERLOAD_ENABLED
#define malloc_proxy __TBB_malloc_proxy
extern "C" void * __TBB_malloc_proxy(size_t) __attribute__ ((weak));
#elif MALLOC_ZONE_OVERLOAD_ENABLED
const bool malloc_proxy = true;
#else
const bool malloc_proxy = false;
#endif
namespace rml {
namespace internal {
void init_tbbmalloc();
} }
#define MALLOC_EXTRA_INITIALIZATION rml::internal::init_tbbmalloc()
namespace tbb {
namespace detail {
namespace d1 {
enum notify_type {prepare=0, cancel, acquired, releasing};
#if TBB_USE_PROFILING_TOOLS
inline void call_itt_notify(notify_type t, void *ptr) {
detail::suppress_unused_warning(ptr);
switch ( t ) {
case prepare:
MALLOC_ITT_SYNC_PREPARE( ptr );
break;
case cancel:
MALLOC_ITT_SYNC_CANCEL( ptr );
break;
case acquired:
MALLOC_ITT_SYNC_ACQUIRED( ptr );
break;
case releasing:
MALLOC_ITT_SYNC_RELEASING( ptr );
break;
}
}
#else
inline void call_itt_notify(notify_type , void * ) {}
#endif
} } }
#include "oneapi/tbb/detail/_aggregator.h"
template <typename OperationType>
struct MallocAggregator {
typedef tbb::detail::d1::aggregator_generic<OperationType> type;
};
template <typename Derived>
struct MallocAggregatedOperation {
typedef tbb::detail::d1::aggregated_operation<Derived> type;
};
#endif