Cyclone Scheme  0.28.0
Data Structures | Macros | Typedefs | Enumerations | Functions

Major GC is responsible for removing unused objects from the heap. More...

Data Structures

struct  gc_free_list_t
 
struct  gc_header_type_t
 
struct  gc_heap_root_t
 
struct  gc_heap_t
 
struct  gc_thread_data_t
 
struct  mark_buffer_t
 

Macros

#define DEBUG_SHOW_DIAG   0
 
#define GC_COLLECT_UNDER_UNSWEPT_HEAP_COUNT   3
 
#define GC_COLLECTION_THRESHOLD   0.0125
 
#define gc_color_blue   2
 
#define gc_color_red   0
 
#define GC_DEBUG_SHOW_SWEEP_DIAG   0
 
#define GC_DEBUG_TRACE   0
 
#define GC_DEBUG_VERBOSE   0
 
#define GC_FREE_THRESHOLD   0.40
 
#define gc_is_stack_obj(low_limit, thd, obj)
 Determine if object lives on the thread's stack. More...
 
#define GC_SAFETY_CHECKS   0
 
#define grayed(x)   (((list) x)->hdr.grayed)
 
#define GROW_HEAP_BY_SIZE   (2 * 1024 * 1024)
 
#define HEAP_SIZE   (8 * 1024 * 1024)
 
#define immutable(x)   (((list) x)->hdr.immutable)
 
#define INITIAL_HEAP_SIZE   (3 * 1024 * 1024)
 
#define LAST_FIXED_SIZE_HEAP_TYPE   HEAP_96
 
#define mark(x)   (((list) x)->hdr.mark)
 
#define MAX_STACK_TRACES   10
 
#define NANOSECONDS_PER_MILLISECOND   1000000
 
#define NUM_HEAP_TYPES   (HEAP_HUGE + 1)
 
#define return_thread_runnable(d, r)   gc_mutator_thread_runnable(((gc_thread_data *)d), (r), NULL)
 Return from a blocked thread. More...
 
#define return_thread_runnable_with_obj(d, r, maybe_copied)   gc_mutator_thread_runnable(((gc_thread_data *)d), (r), maybe_copied)
 Return from a blocked thread with an object that may have been copied. If the object was copied we need to check and may need to copy it again. More...
 
#define set_thread_blocked(d, c)   gc_mutator_thread_blocked(((gc_thread_data *)d), (c))
 

Typedefs

typedef struct gc_free_list_t gc_free_list
 
typedef struct gc_header_type_t gc_header_type
 
typedef struct gc_heap_t gc_heap
 Contains data for a single page of the heap. More...
 
typedef struct gc_heap_root_t gc_heap_root
 
typedef struct gc_thread_data_t gc_thread_data
 Each thread is given an instance of this struct to maintain its state. More...
 
typedef struct mark_buffer_t mark_buffer
 

Enumerations

enum  cyc_thread_state_type {
  CYC_THREAD_STATE_NEW, CYC_THREAD_STATE_RUNNABLE, CYC_THREAD_STATE_BLOCKED, CYC_THREAD_STATE_BLOCKED_COOPERATING,
  CYC_THREAD_STATE_TERMINATED
}
 
enum  gc_heap_type {
  HEAP_SM = 0, HEAP_64, HEAP_96, HEAP_REST,
  HEAP_HUGE
}
 
enum  gc_stage_type { STAGE_CLEAR_OR_MARKING, STAGE_TRACING, STAGE_SWEEPING, STAGE_RESTING }
 
enum  gc_status_type { STATUS_ASYNC, STATUS_SYNC1, STATUS_SYNC2 }
 

Functions

void Cyc_make_shared_object (void *data, object k, object obj)
 
void gc_add_mutator (gc_thread_data *thd)
 Add data for a new mutator that is starting to run. More...
 
void gc_add_new_unrunning_mutator (gc_thread_data *thd)
 Add data for a new mutator that is not yet scheduled to run. This is done so there is a record in the system even if the thread is not running, to prevent race conditions for any functions (EG: thread-join!) that need to access the thread. More...
 
void * gc_alloc (gc_heap_root *h, size_t size, char *obj, gc_thread_data *thd, int *heap_grown)
 Allocate memory on the heap for an object. More...
 
void * gc_alloc_bignum (gc_thread_data *data)
 A convenience function for allocating bignums. More...
 
void * gc_alloc_rest (gc_heap_root *hrt, size_t size, char *obj, gc_thread_data *thd, int *heap_grown)
 
size_t gc_allocated_bytes (object obj, gc_free_list *q, gc_free_list *r)
 Get the number of bytes that will be allocated for obj. More...
 
void gc_collector_trace ()
 The collector's tracing algorithm. More...
 
char * gc_copy_obj (object hp, char *obj, gc_thread_data *thd)
 Copy given object into given heap object. More...
 
void gc_empty_collector_stack ()
 Empty the collector's mark stack. More...
 
gc_heapgc_grow_heap (gc_heap *h, size_t size, gc_thread_data *thd)
 Grow a heap by allocating a new page. More...
 
void gc_handshake (gc_status_type s)
 Called by the collector thread to perform a handshake with all of the mutators. More...
 
gc_heapgc_heap_create (int heap_type, size_t size, gc_thread_data *thd)
 Create a new heap page. The caller must hold the necessary locks. More...
 
void gc_heap_create_rest (gc_heap *h, gc_thread_data *thd)
 
gc_heapgc_heap_free (gc_heap *page, gc_heap *prev_page)
 Free a page of the heap. More...
 
gc_heapgc_heap_last (gc_heap *h)
 Get the heap's last page. More...
 
void gc_heap_merge (gc_heap *hdest, gc_heap *hsrc)
 Merge one heap into another. More...
 
void gc_init_fixed_size_free_list (gc_heap *h)
 Initialize free lists within a single heap page. Assumes that there is no data currently on the heap page! More...
 
void gc_init_heap (long heap_size)
 Perform one-time heap initializations for the program. More...
 
void gc_initialize (void)
 Perform one-time initialization before mutators can be executed. More...
 
int gc_is_mutator_active (gc_thread_data *thd)
 Determine if the given mutator is in the list of active threads. More...
 
int gc_is_mutator_new (gc_thread_data *thd)
 Determine if the given mutator is in the list of new threads. More...
 
void gc_mark_globals (object globals, object global_table)
 Mark globals as part of the tracing collector. More...
 
void gc_mark_gray (gc_thread_data *thd, object obj)
 Mark the given object gray if it is on the heap. More...
 
void gc_mark_gray2 (gc_thread_data *thd, object obj)
 Add a pending write to the mark buffer. More...
 
void gc_merge_all_heaps (gc_thread_data *dest, gc_thread_data *src)
 Merge all thread heaps into another. More...
 
void gc_mut_cooperate (gc_thread_data *thd, int buf_len)
 Called by a mutator to cooperate with the collector thread. More...
 
void gc_mut_update (gc_thread_data *thd, object old_obj, object value)
 Write barrier for updates to heap-allocated objects. More...
 
void gc_mutator_thread_blocked (gc_thread_data *thd, object cont)
 Called explicitly from a mutator thread to let the collector know it (may) block for an unknown period of time. More...
 
void gc_mutator_thread_runnable (gc_thread_data *thd, object result, object maybe_copied)
 Called explicitly from a mutator thread to let the collector know that it has finished blocking. More...
 
void gc_post_handshake (gc_status_type s)
 Change GC status to the given type. More...
 
void gc_print_stats (gc_heap *h)
 Print heap usage information. Before calling this function the current thread must have the heap lock. More...
 
void gc_remove_mutator (gc_thread_data *thd)
 Remove selected mutator from the mutator list. This is done for terminated threads. Note data is queued to be freed, to prevent accidentally freeing it while the collector thread is potentially accessing it. More...
 
void gc_request_mark_globals (void)
 A helper function for calling gc_mark_globals. More...
 
void gc_sleep_ms (int ms)
 A high-resolution sleep function. More...
 
void gc_start_collector ()
 Spawn the collector thread. More...
 
gc_heapgc_sweep (gc_heap *h, gc_thread_data *thd)
 Sweep portion of the GC algorithm. More...
 
void gc_thr_grow_move_buffer (gc_thread_data *d)
 Increase the size of the mutator's move buffer. More...
 
void gc_thread_data_free (gc_thread_data *thd)
 Free all data for the given mutator. More...
 
void gc_thread_data_init (gc_thread_data *thd, int mut_num, char *stack_base, long stack_size)
 Initialize runtime data structures for a thread. More...
 
void * gc_try_alloc (gc_heap *h, size_t size, char *obj, gc_thread_data *thd)
 Attempt to allocate a new heap slot for the given object. More...
 
void * gc_try_alloc_rest (gc_heap *h, size_t size, char *obj, gc_thread_data *thd)
 
void * gc_try_alloc_slow (gc_heap *h_passed, gc_heap *h, size_t size, char *obj, gc_thread_data *thd)
 
void gc_wait_handshake ()
 Wait for all mutators to handshake. More...
 

Detailed Description

Major GC is responsible for removing unused objects from the heap.

gc_thread_data_t
Definition: types.h:322
stack_overflow
#define stack_overflow(x, y)
Definition: types.h:517