C:/Users/Dennis/src/lang/russell.orig/src/gc/misc.c File Reference

#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 Documentation

#define ADD_SLOP ( bytes   )     (bytes)

Definition at line 117 of file misc.c.

Referenced by GC_realloc().

#define CLEAR_SIZE   213

Definition at line 129 of file misc.c.

Referenced by GC_clear_stack_inner().

#define CLEAR_THRESHOLD   10000

Definition at line 130 of file misc.c.

#define COOLER_THAN   >

Definition at line 137 of file misc.c.

Referenced by GC_clear_stack(), and GC_clear_stack_inner().

#define DEBUG

Definition at line 12 of file misc.c.

#define DEGRADE_RATE   50

Definition at line 131 of file misc.c.

Referenced by GC_clear_stack().

#define HOTTER_THAN   <

Definition at line 138 of file misc.c.

Referenced by GC_clear_stack().

#define I_HIDE_POINTERS

Definition at line 19 of file misc.c.

#define MAKE_COOLER ( x,
 ) 

Value:

if ((word)(x)+(y) > (word)(x)) {(x) += (y);} \
                            else {(x) = (ptr_t)ONES;}

Definition at line 139 of file misc.c.

Referenced by GC_clear_stack().

#define MAKE_HOTTER ( x,
 )     (x) -= (y)

Definition at line 141 of file misc.c.

#define ROUNDED_UP_WORDS (  )     BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1) - 1)

Definition at line 56 of file misc.c.

#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().

#define VERBOSE

Definition at line 14 of file misc.c.


Function Documentation

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 
)

Definition at line 656 of file misc.c.

void GC_err_puts ( char *  s  ) 

Definition at line 674 of file misc.c.

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.

ptr_t GC_generic_malloc ( word  lb,
int  k 
)

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.

ptr_t GC_generic_malloc_words_small ( word  lw,
int  k 
)

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 (  ) 

Definition at line 523 of file misc.c.

Referenced by main().

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 
)

Definition at line 638 of file misc.c.

References ABORT.

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  ) 

Definition at line 471 of file misc.c.

References HDR, and WORDS_TO_BYTES.


Variable Documentation

struct _GC_arrays GC_arrays = { 0 }

Definition at line 31 of file misc.c.

bool GC_dont_gc = 0

Definition at line 49 of file misc.c.

Referenced by GC_collect_or_expand(), and main().

ptr_t GC_high_water

Definition at line 148 of file misc.c.

Referenced by GC_clear_stack().

word GC_hincr

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().

signed_word GC_mem_found

Definition at line 15 of file reclaim.c.

ptr_t GC_min_sp

Definition at line 133 of file misc.c.

Referenced by GC_clear_stack(), and GC_clear_stack_inner().

int GC_n_kinds = 2

Definition at line 47 of file misc.c.

Referenced by GC_gcollect_inner(), and GC_start_reclaim().

struct obj_kind GC_obj_kinds[MAXOBJKINDS]

Initial value:

Definition at line 36 of file misc.c.

word GC_stack_last_cleared = 0

Definition at line 128 of file misc.c.

Referenced by GC_clear_stack().

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().


Generated on Fri Jan 25 10:39:49 2008 for russell by  doxygen 1.5.4