ARGOBOTS  7a09f9f632d87ed4f43aec50889983fa897fba10
Macros | Typedefs | Enumerations | Functions
abtu.h File Reference
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "abt_config.h"
Include dependency graph for abtu.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ABTU_likely(cond)   __builtin_expect(!!(cond), 1)
 
#define ABTU_unlikely(cond)   __builtin_expect(!!(cond), 0)
 
#define ABTU_noreturn   __attribute__((noreturn))
 
#define ABTU_unreachable()   __builtin_unreachable()
 
#define ABTU_alignof(type)   (__alignof__(type))
 
#define ABTU_MAX_ALIGNMENT   ABTU_max_size(ABTU_alignof(long double), ABTU_alignof(long long))
 
#define ABTU_ret_err   __attribute__((warn_unused_result))
 
#define ABTU_align_member_var(size)   __attribute__((aligned(size)))
 
#define ABTU_no_sanitize_address
 

Typedefs

typedef enum ABTU_MEM_LARGEPAGE_TYPE ABTU_MEM_LARGEPAGE_TYPE
 

Enumerations

enum  ABTU_MEM_LARGEPAGE_TYPE { ABTU_MEM_LARGEPAGE_MALLOC, ABTU_MEM_LARGEPAGE_MEMALIGN, ABTU_MEM_LARGEPAGE_MMAP, ABTU_MEM_LARGEPAGE_MMAP_HUGEPAGE }
 

Functions

static int ABTU_max_int (int a, int b)
 
static int32_t ABTU_max_int32 (int32_t a, int32_t b)
 
static uint32_t ABTU_max_uint32 (uint32_t a, uint32_t b)
 
static int64_t ABTU_max_int64 (int64_t a, int64_t b)
 
static uint64_t ABTU_max_uint64 (uint64_t a, uint64_t b)
 
static size_t ABTU_max_size (size_t a, size_t b)
 
static int ABTU_min_int (int a, int b)
 
static int32_t ABTU_min_int32 (int32_t a, int32_t b)
 
static uint32_t ABTU_min_uint32 (uint32_t a, uint32_t b)
 
static int64_t ABTU_min_int64 (int64_t a, int64_t b)
 
static uint64_t ABTU_min_uint64 (uint64_t a, uint64_t b)
 
static size_t ABTU_min_size (size_t a, size_t b)
 
static uint32_t ABTU_roundup_uint32 (uint32_t val, uint32_t multiple)
 
static uint64_t ABTU_roundup_uint64 (uint64_t val, uint64_t multiple)
 
static size_t ABTU_roundup_size (size_t val, size_t multiple)
 
static void * ABTU_roundup_ptr (void *ptr, size_t multiple)
 
static ABTU_ret_err int ABTU_memalign (size_t alignment, size_t size, void **p_ptr)
 
static void ABTU_free (void *ptr)
 
static ABTU_ret_err int ABTU_malloc (size_t size, void **p_ptr)
 
static ABTU_ret_err int ABTU_calloc (size_t num, size_t size, void **p_ptr)
 
static ABTU_ret_err int ABTU_realloc (size_t old_size, size_t new_size, void **p_ptr)
 
int ABTU_is_supported_largepage_type (size_t size, size_t alignment_hint, ABTU_MEM_LARGEPAGE_TYPE requested)
 
ABTU_ret_err int ABTU_alloc_largepage (size_t size, size_t alignment_hint, const ABTU_MEM_LARGEPAGE_TYPE *requested_types, int num_requested_types, ABTU_MEM_LARGEPAGE_TYPE *p_actual, void **p_ptr)
 
void ABTU_free_largepage (void *ptr, size_t size, ABTU_MEM_LARGEPAGE_TYPE type)
 
ABTU_ret_err int ABTU_mprotect (void *addr, size_t size, ABT_bool protect)
 
ABTU_ret_err int ABTU_atoi (const char *str, int *p_val, ABT_bool *p_overflow)
 
ABTU_ret_err int ABTU_atoui32 (const char *str, uint32_t *p_val, ABT_bool *p_overflow)
 
ABTU_ret_err int ABTU_atoui64 (const char *str, uint64_t *p_val, ABT_bool *p_overflow)
 
ABTU_ret_err int ABTU_atosz (const char *str, size_t *p_val, ABT_bool *p_overflow)
 

Macro Definition Documentation

◆ ABTU_align_member_var

#define ABTU_align_member_var (   size)    __attribute__((aligned(size)))

Definition at line 170 of file abtu.h.

◆ ABTU_alignof

#define ABTU_alignof (   type)    (__alignof__(type))

Definition at line 145 of file abtu.h.

◆ ABTU_likely

#define ABTU_likely (   cond)    __builtin_expect(!!(cond), 1)

Definition at line 119 of file abtu.h.

◆ ABTU_MAX_ALIGNMENT

#define ABTU_MAX_ALIGNMENT   ABTU_max_size(ABTU_alignof(long double), ABTU_alignof(long long))

Definition at line 151 of file abtu.h.

◆ ABTU_no_sanitize_address

#define ABTU_no_sanitize_address

Definition at line 211 of file abtu.h.

◆ ABTU_noreturn

#define ABTU_noreturn   __attribute__((noreturn))

Definition at line 127 of file abtu.h.

◆ ABTU_ret_err

#define ABTU_ret_err   __attribute__((warn_unused_result))

Definition at line 155 of file abtu.h.

◆ ABTU_unlikely

#define ABTU_unlikely (   cond)    __builtin_expect(!!(cond), 0)

Definition at line 120 of file abtu.h.

◆ ABTU_unreachable

#define ABTU_unreachable ( )    __builtin_unreachable()

Definition at line 133 of file abtu.h.

Typedef Documentation

◆ ABTU_MEM_LARGEPAGE_TYPE

Enumeration Type Documentation

◆ ABTU_MEM_LARGEPAGE_TYPE

Enumerator
ABTU_MEM_LARGEPAGE_MALLOC 
ABTU_MEM_LARGEPAGE_MEMALIGN 
ABTU_MEM_LARGEPAGE_MMAP 
ABTU_MEM_LARGEPAGE_MMAP_HUGEPAGE 

Definition at line 308 of file abtu.h.

Function Documentation

◆ ABTU_alloc_largepage()

ABTU_ret_err int ABTU_alloc_largepage ( size_t  size,
size_t  alignment_hint,
const ABTU_MEM_LARGEPAGE_TYPE requested_types,
int  num_requested_types,
ABTU_MEM_LARGEPAGE_TYPE p_actual,
void **  p_ptr 
)

Definition at line 90 of file largepage.c.

◆ ABTU_atoi()

ABTU_ret_err int ABTU_atoi ( const char *  str,
int *  p_val,
ABT_bool p_overflow 
)

Definition at line 11 of file atoi.c.

Referenced by load_env_int().

◆ ABTU_atosz()

ABTU_ret_err int ABTU_atosz ( const char *  str,
size_t *  p_val,
ABT_bool p_overflow 
)

Definition at line 85 of file atoi.c.

Referenced by load_env_size().

◆ ABTU_atoui32()

ABTU_ret_err int ABTU_atoui32 ( const char *  str,
uint32_t *  p_val,
ABT_bool p_overflow 
)

Definition at line 39 of file atoi.c.

Referenced by load_env_uint32().

◆ ABTU_atoui64()

ABTU_ret_err int ABTU_atoui64 ( const char *  str,
uint64_t *  p_val,
ABT_bool p_overflow 
)

Definition at line 65 of file atoi.c.

Referenced by load_env_uint64().

◆ ABTU_calloc()

static ABTU_ret_err int ABTU_calloc ( size_t  num,
size_t  size,
void **  p_ptr 
)
inlinestatic

Definition at line 244 of file abtu.h.

Referenced by list_calloc().

◆ ABTU_free()

static void ABTU_free ( void *  ptr)
inlinestatic

Definition at line 228 of file abtu.h.

Referenced by ABTU_free_largepage(), ABTU_is_supported_largepage_type(), and list_free_all().

◆ ABTU_free_largepage()

void ABTU_free_largepage ( void *  ptr,
size_t  size,
ABTU_MEM_LARGEPAGE_TYPE  type 
)

Definition at line 132 of file largepage.c.

◆ ABTU_is_supported_largepage_type()

int ABTU_is_supported_largepage_type ( size_t  size,
size_t  alignment_hint,
ABTU_MEM_LARGEPAGE_TYPE  requested 
)

Definition at line 59 of file largepage.c.

◆ ABTU_malloc()

static ABTU_ret_err int ABTU_malloc ( size_t  size,
void **  p_ptr 
)
inlinestatic

◆ ABTU_max_int()

static int ABTU_max_int ( int  a,
int  b 
)
inlinestatic

Definition at line 15 of file abtu.h.

Referenced by load_env_int().

◆ ABTU_max_int32()

static int32_t ABTU_max_int32 ( int32_t  a,
int32_t  b 
)
inlinestatic

Definition at line 20 of file abtu.h.

◆ ABTU_max_int64()

static int64_t ABTU_max_int64 ( int64_t  a,
int64_t  b 
)
inlinestatic

Definition at line 30 of file abtu.h.

◆ ABTU_max_size()

static size_t ABTU_max_size ( size_t  a,
size_t  b 
)
inlinestatic

Definition at line 40 of file abtu.h.

Referenced by load_env_size().

◆ ABTU_max_uint32()

static uint32_t ABTU_max_uint32 ( uint32_t  a,
uint32_t  b 
)
inlinestatic

Definition at line 25 of file abtu.h.

Referenced by load_env_uint32().

◆ ABTU_max_uint64()

static uint64_t ABTU_max_uint64 ( uint64_t  a,
uint64_t  b 
)
inlinestatic

Definition at line 35 of file abtu.h.

Referenced by load_env_uint64().

◆ ABTU_memalign()

static ABTU_ret_err int ABTU_memalign ( size_t  alignment,
size_t  size,
void **  p_ptr 
)
inlinestatic

Definition at line 216 of file abtu.h.

Referenced by ABTU_alloc_largepage(), ABTU_is_supported_largepage_type(), and ABTU_malloc().

◆ ABTU_min_int()

static int ABTU_min_int ( int  a,
int  b 
)
inlinestatic

Definition at line 45 of file abtu.h.

Referenced by load_env_int().

◆ ABTU_min_int32()

static int32_t ABTU_min_int32 ( int32_t  a,
int32_t  b 
)
inlinestatic

Definition at line 50 of file abtu.h.

◆ ABTU_min_int64()

static int64_t ABTU_min_int64 ( int64_t  a,
int64_t  b 
)
inlinestatic

Definition at line 60 of file abtu.h.

◆ ABTU_min_size()

static size_t ABTU_min_size ( size_t  a,
size_t  b 
)
inlinestatic

Definition at line 70 of file abtu.h.

Referenced by load_env_size().

◆ ABTU_min_uint32()

static uint32_t ABTU_min_uint32 ( uint32_t  a,
uint32_t  b 
)
inlinestatic

Definition at line 55 of file abtu.h.

Referenced by load_env_uint32().

◆ ABTU_min_uint64()

static uint64_t ABTU_min_uint64 ( uint64_t  a,
uint64_t  b 
)
inlinestatic

Definition at line 65 of file abtu.h.

Referenced by load_env_uint64().

◆ ABTU_mprotect()

ABTU_ret_err int ABTU_mprotect ( void *  addr,
size_t  size,
ABT_bool  protect 
)

Definition at line 9 of file mprotect.c.

Referenced by protect_memory().

◆ ABTU_realloc()

static ABTU_ret_err int ABTU_realloc ( size_t  old_size,
size_t  new_size,
void **  p_ptr 
)
inlinestatic

Definition at line 257 of file abtu.h.

Referenced by list_realloc().

◆ ABTU_roundup_ptr()

static void* ABTU_roundup_ptr ( void *  ptr,
size_t  multiple 
)
inlinestatic

Definition at line 105 of file abtu.h.

Referenced by protect_memory().

◆ ABTU_roundup_size()

static size_t ABTU_roundup_size ( size_t  val,
size_t  multiple 
)
inlinestatic

Definition at line 95 of file abtu.h.

Referenced by ABTU_malloc().

◆ ABTU_roundup_uint32()

static uint32_t ABTU_roundup_uint32 ( uint32_t  val,
uint32_t  multiple 
)
inlinestatic

Definition at line 75 of file abtu.h.

◆ ABTU_roundup_uint64()

static uint64_t ABTU_roundup_uint64 ( uint64_t  val,
uint64_t  multiple 
)
inlinestatic

Definition at line 85 of file abtu.h.