A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
|
#include <assert.h>
#include <limits.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tlsf.h"
Go to the source code of this file.
Classes | |
struct | block_header_t |
struct | control_t |
struct | integrity_t |
Macros | |
#define | tlsf_decl static |
#define | tlsf_fls_sizet tlsf_fls |
#define | tlsf_cast(t, exp) ((t)(exp)) |
#define | tlsf_min(a, b) ((a) < (b) ? (a) : (b)) |
#define | tlsf_max(a, b) ((a) > (b) ? (a) : (b)) |
#define | tlsf_assert assert |
#define | _tlsf_glue2(x, y) x##y |
#define | _tlsf_glue(x, y) _tlsf_glue2(x, y) |
#define | tlsf_static_assert(exp) typedef char _tlsf_glue(static_assert, __LINE__)[(exp) ? 1 : -1] |
#define | TLSF_INCREASE_REAL_USED(control, increment) |
#define | TLSF_INCREASE_FRAGMENTS(control) |
#define | tlsf_insist(x) |
Typedefs | |
typedef struct block_header_t | block_header_t |
typedef struct control_t | control_t |
typedef ptrdiff_t | tlsfptr_t |
typedef struct integrity_t | integrity_t |
Enumerations | |
enum | tlsf_public { SL_INDEX_COUNT_LOG2 = 5 } |
enum | tlsf_private { ALIGN_SIZE_LOG2 = 2, ALIGN_SIZE = (1 << ALIGN_SIZE_LOG2), FL_INDEX_MAX = 30, SL_INDEX_COUNT = (1 << SL_INDEX_COUNT_LOG2), FL_INDEX_SHIFT = (SL_INDEX_COUNT_LOG2 + ALIGN_SIZE_LOG2), FL_INDEX_COUNT = (FL_INDEX_MAX - FL_INDEX_SHIFT + 1), SMALL_BLOCK_SIZE = (1 << FL_INDEX_SHIFT) } |
Functions | |
tlsf_decl int | tlsf_fls_generic (unsigned int word) |
tlsf_decl int | tlsf_ffs (unsigned int word) |
tlsf_decl int | tlsf_fls (unsigned int word) |
tlsf_static_assert (sizeof(int)*CHAR_BIT==32) | |
tlsf_static_assert (sizeof(size_t)*CHAR_BIT >=32) | |
tlsf_static_assert (sizeof(size_t)*CHAR_BIT<=64) | |
tlsf_static_assert (sizeof(unsigned int)*CHAR_BIT >=SL_INDEX_COUNT) | |
tlsf_static_assert (ALIGN_SIZE==SMALL_BLOCK_SIZE/SL_INDEX_COUNT) | |
static size_t | block_size (const block_header_t *block) |
static void | block_set_size (block_header_t *block, size_t size) |
static int | block_is_last (const block_header_t *block) |
static int | block_is_free (const block_header_t *block) |
static void | block_set_free (block_header_t *block) |
static void | block_set_used (block_header_t *block) |
static int | block_is_prev_free (const block_header_t *block) |
static void | block_set_prev_free (block_header_t *block) |
static void | block_set_prev_used (block_header_t *block) |
static block_header_t * | block_from_ptr (const void *ptr) |
static void * | block_to_ptr (const block_header_t *block) |
static block_header_t * | offset_to_block (const void *ptr, size_t size) |
static block_header_t * | block_prev (const block_header_t *block) |
static block_header_t * | block_next (const block_header_t *block) |
static block_header_t * | block_link_next (block_header_t *block) |
static void | block_mark_as_free (block_header_t *block) |
static void | block_mark_as_used (block_header_t *block) |
static size_t | align_up (size_t x, size_t align) |
static size_t | align_down (size_t x, size_t align) |
static void * | align_ptr (const void *ptr, size_t align) |
static size_t | adjust_request_size (size_t size, size_t align) |
static void | mapping_insert (size_t size, int *fli, int *sli) |
static void | mapping_search (size_t size, int *fli, int *sli) |
static block_header_t * | search_suitable_block (control_t *control, int *fli, int *sli) |
static void | remove_free_block (control_t *control, block_header_t *block, int fl, int sl) |
static void | insert_free_block (control_t *control, block_header_t *block, int fl, int sl) |
static void | block_remove (control_t *control, block_header_t *block) |
static void | block_insert (control_t *control, block_header_t *block) |
static int | block_can_split (block_header_t *block, size_t size) |
static block_header_t * | block_split (block_header_t *block, size_t size) |
static block_header_t * | block_absorb (block_header_t *prev, block_header_t *block) |
static block_header_t * | block_merge_prev (control_t *control, block_header_t *block) |
static block_header_t * | block_merge_next (control_t *control, block_header_t *block) |
static void | block_trim_free (control_t *control, block_header_t *block, size_t size) |
static void | block_trim_used (control_t *control, block_header_t *block, size_t size) |
static block_header_t * | block_trim_free_leading (control_t *control, block_header_t *block, size_t size) |
static block_header_t * | block_locate_free (control_t *control, size_t size) |
static void * | block_prepare_used (control_t *control, block_header_t *block, size_t size) |
static void | control_construct (control_t *control) |
static void | integrity_walker (void *ptr, size_t size, int used, void *user) |
static void | default_walker (void *ptr, size_t size, int used, void *user) |
Variables | |
static const size_t | block_header_free_bit = 1 << 0 |
static const size_t | block_header_prev_free_bit = 1 << 1 |
static const size_t | block_header_overhead = sizeof(size_t) |
static const size_t | block_start_offset = offsetof(block_header_t, size) + sizeof(size_t) |
static const size_t | block_size_min = sizeof(block_header_t) - sizeof(block_header_t*) |
static const size_t | block_size_max = tlsf_cast(size_t, 1) << FL_INDEX_MAX |
#define _tlsf_glue | ( | x, | |
y | |||
) | _tlsf_glue2(x, y) |
#define TLSF_INCREASE_FRAGMENTS | ( | control | ) |
#define TLSF_INCREASE_REAL_USED | ( | control, | |
increment | |||
) |
#define tlsf_insist | ( | x | ) |
#define tlsf_static_assert | ( | exp | ) | typedef char _tlsf_glue(static_assert, __LINE__)[(exp) ? 1 : -1] |
typedef struct block_header_t block_header_t |
typedef struct integrity_t integrity_t |
enum tlsf_private |
enum tlsf_public |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
tlsf_decl int tlsf_ffs | ( | unsigned int | word | ) |
tlsf_decl int tlsf_fls | ( | unsigned int | word | ) |
tlsf_decl int tlsf_fls_generic | ( | unsigned int | word | ) |
tlsf_static_assert | ( | sizeof(int)* | CHAR_BIT = =32 | ) |
tlsf_static_assert | ( | sizeof(size_t)*CHAR_BIT >= | 32 | ) |
tlsf_static_assert | ( | sizeof(size_t)*CHAR_BIT<= | 64 | ) |
tlsf_static_assert | ( | sizeof(unsigned int)*CHAR_BIT >= | SL_INDEX_COUNT | ) |
tlsf_static_assert | ( | ALIGN_SIZE | = =SMALL_BLOCK_SIZE/SL_INDEX_COUNT | ) |
|
static |
|
static |
|
static |