llvm/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp

//===-- sanitizer_allocator.cpp -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file is shared between AddressSanitizer and ThreadSanitizer
// run-time libraries.
// This allocator is used inside run-times.
//===----------------------------------------------------------------------===//

#include "sanitizer_allocator.h"

#include "sanitizer_allocator_checks.h"
#include "sanitizer_allocator_internal.h"
#include "sanitizer_atomic.h"
#include "sanitizer_common.h"
#include "sanitizer_platform.h"

namespace __sanitizer {

// Default allocator names.
const char *PrimaryAllocatorName =;
const char *SecondaryAllocatorName =;

alignas(64) static char internal_alloc_placeholder[sizeof(InternalAllocator)];
static atomic_uint8_t internal_allocator_initialized;
static StaticSpinMutex internal_alloc_init_mu;

static InternalAllocatorCache internal_allocator_cache;
static StaticSpinMutex internal_allocator_cache_mu;

InternalAllocator *internal_allocator() {}

static void *RawInternalAlloc(uptr size, InternalAllocatorCache *cache,
                              uptr alignment) {}

static void *RawInternalRealloc(void *ptr, uptr size,
                                InternalAllocatorCache *cache) {}

static void RawInternalFree(void *ptr, InternalAllocatorCache *cache) {}

static void NORETURN ReportInternalAllocatorOutOfMemory(uptr requested_size) {}

void *InternalAlloc(uptr size, InternalAllocatorCache *cache, uptr alignment) {}

void *InternalRealloc(void *addr, uptr size, InternalAllocatorCache *cache) {}

void *InternalReallocArray(void *addr, uptr count, uptr size,
                           InternalAllocatorCache *cache) {}

void *InternalCalloc(uptr count, uptr size, InternalAllocatorCache *cache) {}

void InternalFree(void *addr, InternalAllocatorCache *cache) {}

void InternalAllocatorLock() SANITIZER_NO_THREAD_SAFETY_ANALYSIS {}

void InternalAllocatorUnlock() SANITIZER_NO_THREAD_SAFETY_ANALYSIS {}

// LowLevelAllocator
constexpr uptr kLowLevelAllocatorDefaultAlignment =;
constexpr uptr kMinNumPagesRounded =;
constexpr uptr kMinRoundedSize =;
static uptr low_level_alloc_min_alignment =;
static LowLevelAllocateCallback low_level_alloc_callback;

static LowLevelAllocator Alloc;
LowLevelAllocator &GetGlobalLowLevelAllocator() {}

void *LowLevelAllocator::Allocate(uptr size) {}

void SetLowLevelAllocateMinAlignment(uptr alignment) {}

void SetLowLevelAllocateCallback(LowLevelAllocateCallback callback) {}

// Allocator's OOM and other errors handling support.

static atomic_uint8_t allocator_out_of_memory =;
static atomic_uint8_t allocator_may_return_null =;

bool IsAllocatorOutOfMemory() {}

void SetAllocatorOutOfMemory() {}

bool AllocatorMayReturnNull() {}

void SetAllocatorMayReturnNull(bool may_return_null) {}

void PrintHintAllocatorCannotReturnNull() {}

static atomic_uint8_t rss_limit_exceeded;

bool IsRssLimitExceeded() {}

void SetRssLimitExceeded(bool limit_exceeded) {}

} // namespace __sanitizer