Go to the source code of this file.
|  | 
| #define | HEAP_ELT_FREE_BIT   (1 << 31) | 
|  | 
| #define | HEAP_LOG2_SMALL_BINS   (5) | 
|  | 
| #define | HEAP_SMALL_BINS   (1 << HEAP_LOG2_SMALL_BINS) | 
|  | 
| #define | HEAP_N_BINS   (2 * HEAP_SMALL_BINS) | 
|  | 
| #define | HEAP_IS_STATIC   (1) | 
|  | 
| #define | HEAP_DATA_ALIGN   (CLIB_CACHE_LINE_BYTES) | 
|  | 
| #define | heap_dup(v)   _heap_dup(v, vec_len (v) * sizeof (v[0])) | 
|  | 
| #define | heap_new(v)   (v) = _heap_new (0, sizeof ((v)[0])) | 
|  | 
| #define | heap_foreach(var,  len,  heap,  body) | 
|  | 
| #define | heap_elt_at_index(v,  index)   vec_elt_at_index(v,index) | 
|  | 
| #define | heap_elt_with_handle(v,  handle) | 
|  | 
| #define | heap_alloc_aligned(v,  size,  align,  handle) | 
|  | 
| #define | heap_alloc(v,  size,  handle)   heap_alloc_aligned((v),(size),0,(handle)) | 
|  | 
| #define | heap_free(v)   (v)=_heap_free(v) | 
|  | 
|  | 
| static uword | heap_is_free (heap_elt_t *e) | 
|  | 
| static uword | heap_offset (heap_elt_t *e) | 
|  | 
| static heap_elt_t * | heap_next (heap_elt_t *e) | 
|  | 
| static heap_elt_t * | heap_prev (heap_elt_t *e) | 
|  | 
| static uword | heap_elt_size (void *v, heap_elt_t *e) | 
|  | 
| static heap_header_t * | heap_header (void *v) | 
|  | 
| static uword | heap_header_bytes () | 
|  | 
| static void | heap_dup_header (heap_header_t *old, heap_header_t *new) | 
|  | 
| static uword | heap_elts (void *v) | 
|  | 
| uword | heap_bytes (void *v) | 
|  | 
| static void | heap_set_format (void *v, format_function_t *format_elt) | 
|  | 
| static void | heap_set_max_len (void *v, uword max_len) | 
|  | 
| static uword | heap_get_max_len (void *v) | 
|  | 
| static void * | heap_create_from_memory (void *memory, uword max_len, uword elt_bytes) | 
|  | 
| static heap_elt_t * | heap_get_elt (void *v, uword handle) | 
|  | 
| static uword | heap_is_free_handle (void *v, uword heap_handle) | 
|  | 
| uword | heap_len (void *v, word handle) | 
|  | 
| void | heap_dealloc (void *v, uword handle) | 
|  | 
| void | heap_validate (void *v) | 
|  | 
| u8 * | format_heap (u8 *s, va_list *va) | 
|  | 
      
        
          | #define heap_alloc_aligned | ( |  | v, | 
        
          |  |  |  | size, | 
        
          |  |  |  | align, | 
        
          |  |  |  | handle | 
        
          |  | ) |  |  | 
      
 
Value:  (
v) = _heap_alloc ((
v), _s, _a, 
sizeof ((
v)[0]), &_o, &_h);   \
  (handle) = _h;                                                \
  _o;                                                           \
})
Definition at line 327 of file heap.h.
 
 
      
        
          | #define heap_dup | ( |  | v | ) | _heap_dup(v, vec_len (v) * sizeof (v[0])) | 
      
 
 
      
        
          | #define HEAP_ELT_FREE_BIT   (1 << 31) | 
      
 
 
      
        
          | #define heap_elt_with_handle | ( |  | v, | 
        
          |  |  |  | handle | 
        
          |  | ) |  |  | 
      
 
Value:({                                                      \
})
static heap_elt_t * heap_get_elt(void *v, uword handle)
static uword heap_offset(heap_elt_t *e)
Definition at line 307 of file heap.h.
 
 
      
        
          | #define heap_foreach | ( |  | var, | 
        
          |  |  |  | len, | 
        
          |  |  |  | heap, | 
        
          |  |  |  | body | 
        
          |  | ) |  |  | 
      
 
Value:do {                                                    \
    {                                                   \
      heap_elt_t * _e   = _h->elts + _h->head;          \
      heap_elt_t * _end = _h->elts + _h->tail;          \
      while (1)                                         \
        {                                               \
            {                                           \
              do { body; } while (0);                   \
            }                                           \
          if (_e == _end)                               \
            break;                                      \
        }                                               \
    }                                                   \
} while (0)
static uword heap_is_free(heap_elt_t *e)
static heap_elt_t * heap_next(heap_elt_t *e)
static uword heap_offset(heap_elt_t *e)
static uword heap_elt_size(void *v, heap_elt_t *e)
static heap_header_t * heap_header(void *v)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant) 
Definition at line 274 of file heap.h.
 
 
      
        
          | #define heap_free | ( |  | v | ) | (v)=_heap_free(v) | 
      
 
 
      
        
          | #define HEAP_IS_STATIC   (1) | 
      
 
 
      
        
          | #define HEAP_LOG2_SMALL_BINS   (5) | 
      
 
 
      
        
          | #define heap_new | ( |  | v | ) | (v) = _heap_new (0, sizeof ((v)[0])) | 
      
 
 
      
        
          | u8* format_heap | ( | u8 * | s, | 
        
          |  |  | va_list * | va | 
        
          |  | ) |  |  | 
      
 
 
      
        
          | uword heap_bytes | ( | void * | v | ) |  | 
      
 
 
  
  | 
        
          | static void* heap_create_from_memory | ( | void * | memory, |  
          |  |  | uword | max_len, |  
          |  |  | uword | elt_bytes |  
          |  | ) |  |  |  | inlinestatic | 
 
 
      
        
          | void heap_dealloc | ( | void * | v, | 
        
          |  |  | uword | handle | 
        
          |  | ) |  |  | 
      
 
 
  
  | 
        
          | static uword heap_elts | ( | void * | v | ) |  |  | inlinestatic | 
 
 
  
  | 
        
          | static uword heap_get_max_len | ( | void * | v | ) |  |  | inlinestatic | 
 
 
  
  | 
        
          | static uword heap_header_bytes | ( |  | ) |  |  | inlinestatic | 
 
 
  
  | 
        
          | static uword heap_is_free_handle | ( | void * | v, |  
          |  |  | uword | heap_handle |  
          |  | ) |  |  |  | inlinestatic | 
 
 
  
  | 
        
          | static void heap_set_max_len | ( | void * | v, |  
          |  |  | uword | max_len |  
          |  | ) |  |  |  | inlinestatic | 
 
 
      
        
          | void heap_validate | ( | void * | v | ) |  |