#include <stdio.h>
#include <signal.h>
#include "gc_private.h"
Go to the source code of this file.
Defines | |
#define | DEBUG |
#define | VERBOSE |
#define | I_HIDE_POINTERS |
#define | ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1) - 1) |
#define | SMALL_OBJ(bytes) ((bytes) <= WORDS_TO_BYTES(MAXOBJSZ)) |
#define | ADD_SLOP(bytes) (bytes) |
#define | CLEAR_SIZE 213 |
#define | CLEAR_THRESHOLD 10000 |
#define | DEGRADE_RATE 50 |
#define | COOLER_THAN > |
#define | HOTTER_THAN < |
#define | MAKE_COOLER(x, y) |
#define | MAKE_HOTTER(x, y) (x) -= (y) |
Functions | |
void | GC_init_size_map () |
void | GC_clear_stack_inner (word *d) |
void | GC_clear_stack () |
ptr_t | GC_generic_malloc (word lb, int k) |
ptr_t | GC_generic_malloc_words_small (word lw, int k) |
extern_ptr_t | GC_malloc_atomic (size_t lb) |
extern_ptr_t | GC_malloc (size_t lb) |
extern_ptr_t | GC_realloc (extern_ptr_t p, size_t lb) |
extern_ptr_t | GC_base (extern_ptr_t p) |
size_t | GC_size (extern_ptr_t p) |
void | GC_free (extern_ptr_t p) |
void | GC_init () |
void | GC_init_inner () |
void | GC_printf (char *format, long a, long b, long c, long d, long e, long f) |
void | GC_err_printf (char *format, long a, long b, long c, long d, long e, long f) |
void | GC_err_puts (char *s) |
Variables | |
struct _GC_arrays | GC_arrays = { 0 } |
struct obj_kind | GC_obj_kinds [MAXOBJKINDS] |
ptr_t | GC_stackbottom = 0 |
word | GC_hincr |
int | GC_n_kinds = 2 |
bool | GC_dont_gc = 0 |
signed_word | GC_mem_found |
word | GC_stack_last_cleared = 0 |
ptr_t | GC_min_sp |
ptr_t | GC_high_water |
bool | GC_is_initialized = FALSE |
#define ADD_SLOP | ( | bytes | ) | (bytes) |
#define CLEAR_SIZE 213 |
#define COOLER_THAN > |
#define DEGRADE_RATE 50 |
#define HOTTER_THAN < |
#define MAKE_COOLER | ( | x, | |||
y | ) |
#define ROUNDED_UP_WORDS | ( | n | ) | BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1) - 1) |
#define SMALL_OBJ | ( | bytes | ) | ((bytes) <= WORDS_TO_BYTES(MAXOBJSZ)) |
Definition at line 116 of file misc.c.
Referenced by GC_generic_malloc(), GC_malloc(), and GC_malloc_atomic().
extern_ptr_t GC_base | ( | extern_ptr_t | p | ) |
Definition at line 427 of file misc.c.
References GC_invalid_map, HBLKPTR, HDR, HDR_BYTES, HDR_WORDS, IS_FORWARDING_ADDR_OR_NIL, MAXOBJSZ, and WORDS_TO_BYTES.
void GC_clear_stack | ( | ) |
Definition at line 167 of file misc.c.
References COOLER_THAN, DEGRADE_RATE, dummy, GC_clear_stack_inner(), GC_gc_no, GC_high_water, GC_min_sp, GC_stack_last_cleared, GC_stackbottom, HOTTER_THAN, MAKE_COOLER, and WORDS_TO_BYTES.
Referenced by GC_generic_malloc(), and GC_generic_malloc_words_small().
void GC_clear_stack_inner | ( | word * | d | ) |
Definition at line 152 of file misc.c.
References bzero, CLEAR_SIZE, COOLER_THAN, dummy, GC_min_sp, and GC_noop().
Referenced by GC_clear_stack().
void GC_err_printf | ( | char * | format, | |
long | a, | |||
long | b, | |||
long | c, | |||
long | d, | |||
long | e, | |||
long | f | |||
) |
void GC_free | ( | extern_ptr_t | p | ) |
Definition at line 490 of file misc.c.
References bzero, GC_freehblk(), GC_mem_freed, HBLKPTR, HDR, MAXOBJSZ, obj_link, obj_kind::ok_freelist, obj_kind::ok_init, and WORDS_TO_BYTES.
Definition at line 194 of file misc.c.
References DCL_LOCK_STATE, DISABLE_SIGNALS, divHBLKSZ, ENABLE_SIGNALS, GC_allochblk(), GC_allocobj(), GC_clear_stack(), GC_collect_or_expand(), GC_generic_malloc(), GC_init_inner(), GC_is_initialized, GC_size_map, GC_words_allocd, hblk::hb_body, LOCK, obj_link, obj_kind::ok_freelist, ROUNDED_UP_WORDS, SMALL_OBJ, and UNLOCK.
Definition at line 257 of file misc.c.
References DCL_LOCK_STATE, DISABLE_SIGNALS, ENABLE_SIGNALS, GC_allocobj(), GC_clear_stack(), GC_init_inner(), GC_is_initialized, GC_words_allocd, LOCK, obj_link, obj_kind::ok_freelist, and UNLOCK.
void GC_init_inner | ( | ) |
Definition at line 535 of file misc.c.
Referenced by GC_expand_hp(), GC_gcollect(), GC_generic_malloc(), and GC_generic_malloc_words_small().
void GC_init_size_map | ( | ) |
Definition at line 72 of file misc.c.
References GC_size_map, MAXOBJSZ, ROUNDED_UP_WORDS, and WORDS_TO_BYTES.
extern_ptr_t GC_malloc | ( | size_t | lb | ) |
Definition at line 325 of file misc.c.
References DCL_LOCK_STATE, FASTLOCK, FASTLOCK_SUCCEEDED, FASTUNLOCK, GC_generic_malloc(), GC_objfreelist, GC_size_map, GC_words_allocd, NORMAL, obj_link, ROUNDED_UP_WORDS, and SMALL_OBJ.
extern_ptr_t GC_malloc_atomic | ( | size_t | lb | ) |
Definition at line 290 of file misc.c.
References DCL_LOCK_STATE, FASTLOCK, FASTLOCK_SUCCEEDED, FASTUNLOCK, GC_aobjfreelist, GC_generic_malloc(), GC_size_map, GC_words_allocd, obj_link, PTRFREE, ROUNDED_UP_WORDS, and SMALL_OBJ.
void GC_printf | ( | char * | format, | |
long | a, | |||
long | b, | |||
long | c, | |||
long | d, | |||
long | e, | |||
long | f | |||
) |
extern_ptr_t GC_realloc | ( | extern_ptr_t | p, | |
size_t | lb | |||
) |
Definition at line 364 of file misc.c.
References ADD_SLOP, bcopy, BYTES_TO_WORDS, bzero, GC_free(), GC_generic_malloc(), GC_malloc(), HBLKMASK, HBLKPTR, HBLKSIZE, HDR, HDR_BYTES, MAXOBJSZ, and WORDS_TO_BYTES.
size_t GC_size | ( | extern_ptr_t | p | ) |
struct _GC_arrays GC_arrays = { 0 } |
bool GC_dont_gc = 0 |
Definition at line 45 of file misc.c.
Referenced by GC_collect_or_expand(), and GC_expand_hp_inner().
bool GC_is_initialized = FALSE |
Definition at line 521 of file misc.c.
Referenced by GC_expand_hp(), GC_gcollect(), GC_generic_malloc(), and GC_generic_malloc_words_small().
int GC_n_kinds = 2 |
struct obj_kind GC_obj_kinds[MAXOBJKINDS] |
Initial value:
{ { &GC_aobjfreelist[0], &GC_areclaim_list[0], GC_no_mark_proc, FALSE }, { &GC_objfreelist[0], &GC_reclaim_list[0], GC_normal_mark_proc, TRUE }, }
ptr_t GC_stackbottom = 0 |
Definition at line 43 of file misc.c.
Referenced by GC_clear_stack(), GC_mark_roots(), and min_words_allocd().