tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
gc.c File Reference
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#include "portable_defns.h"
#include "gc.h"
Include dependency graph for gc.c:

Classes

struct  chunk_st
 
struct  gc_global_st
 
struct  gc_st
 

Macros

#define INVALID_BYTE   0
 
#define INITIALISE_NODES(_p, _c)   memset((_p), INVALID_BYTE, (_c));
 
#define MAX_SIZES   20
 
#define MAX_HOOKS   4
 
#define ALLOC_CHUNKS_PER_LIST   10
 
#define ENTRIES_PER_RECLAIM_ATTEMPT   100
 
#define NR_EPOCHS   3
 
#define BLKS_PER_CHUNK   100
 
#define MEM_FAIL(_s)
 
#define CHUNKS_PER_ALLOC   1000
 
#define gc_async_barrier(_g)   ((void)0)
 

Typedefs

typedef struct chunk_st chunk_t
 

Functions

static chunk_talloc_more_chunks (void)
 
static void add_chunks_to_list (chunk_t *ch, chunk_t *head)
 
static chunk_tget_empty_chunks (int n)
 
static chunk_tget_filled_chunks (int n, int sz)
 
static chunk_tget_alloc_chunk (gc_t *gc, int i)
 
static void gc_reclaim (void)
 
void * fr_gc_alloc (ptst_t *ptst, int alloc_id)
 
static chunk_tchunk_from_cache (gc_t *gc)
 
void fr_gc_free (ptst_t *ptst, void *p, int alloc_id)
 
void fr_gc_add_ptr_to_hook_list (ptst_t *ptst, void *ptr, int hook_id)
 
void fr_gc_unsafe_free (ptst_t *ptst, void *p, int alloc_id)
 
void fr_gc_enter (ptst_t *ptst)
 
void fr_gc_exit (ptst_t *ptst)
 
gc_tfr_gc_init (void)
 
int fr_gc_add_allocator (int alloc_size)
 
void fr_gc_remove_allocator (int alloc_id)
 
int fr_gc_add_hook (hook_fn_t fn)
 
void fr_gc_remove_hook (int hook_id)
 
void fr_destroy_gc_subsystem (void)
 
void fr_init_gc_subsystem (void)
 

Variables

static struct gc_global_st gc_global
 

Macro Definition Documentation

#define ALLOC_CHUNKS_PER_LIST   10
#define BLKS_PER_CHUNK   100
#define CHUNKS_PER_ALLOC   1000
#define ENTRIES_PER_RECLAIM_ATTEMPT   100
#define gc_async_barrier (   _g)    ((void)0)
#define INITIALISE_NODES (   _p,
  _c 
)    memset((_p), INVALID_BYTE, (_c));
#define INVALID_BYTE   0
#define MAX_HOOKS   4
#define MAX_SIZES   20
#define MEM_FAIL (   _s)
Value:
do { \
fprintf(stderr, "OUT OF MEMORY: %d bytes at line %d\n", (_s), __LINE__); \
exit(1); \
} while ( 0 )
#define NR_EPOCHS   3

Typedef Documentation

typedef struct chunk_st chunk_t

Function Documentation

static void add_chunks_to_list ( chunk_t ch,
chunk_t head 
)
static

Here is the caller graph for this function:

static chunk_t* alloc_more_chunks ( void  )
static

Here is the caller graph for this function:

static chunk_t* chunk_from_cache ( gc_t gc)
static

Here is the call graph for this function:

Here is the caller graph for this function:

void fr_destroy_gc_subsystem ( void  )

Here is the caller graph for this function:

int fr_gc_add_allocator ( int  alloc_size)

Here is the call graph for this function:

Here is the caller graph for this function:

int fr_gc_add_hook ( hook_fn_t  fn)
void fr_gc_add_ptr_to_hook_list ( ptst_t ptst,
void *  ptr,
int  hook_id 
)

Here is the call graph for this function:

void* fr_gc_alloc ( ptst_t ptst,
int  alloc_id 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void fr_gc_enter ( ptst_t ptst)

Here is the call graph for this function:

Here is the caller graph for this function:

void fr_gc_exit ( ptst_t ptst)
void fr_gc_free ( ptst_t ptst,
void *  p,
int  alloc_id 
)

Here is the call graph for this function:

Here is the caller graph for this function:

gc_t* fr_gc_init ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

void fr_gc_remove_allocator ( int  alloc_id)

Here is the caller graph for this function:

void fr_gc_remove_hook ( int  hook_id)
void fr_gc_unsafe_free ( ptst_t ptst,
void *  p,
int  alloc_id 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void fr_init_gc_subsystem ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

static void gc_reclaim ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static chunk_t* get_alloc_chunk ( gc_t gc,
int  i 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static chunk_t* get_empty_chunks ( int  n)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static chunk_t* get_filled_chunks ( int  n,
int  sz 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

struct gc_global_st gc_global
static