1 #ifndef RBS_MARKSWEEP_H
2 #define RBS_MARKSWEEP_H
12 struct ms_header
*object
;
16 struct ms_entry
*entry
;
25 struct ms_entry
*entries
;
26 struct ms_chunk
*next
;
29 typedef struct ms_chunk ms_chunk
;
31 struct _mark_sweep_gc
{
32 struct ms_chunk
*chunks
;
35 ptr_array remember_set
;
38 OBJECT become_from
, become_to
;
39 ptr_array seen_weak_refs
;
44 unsigned int allocated_bytes
;
45 int next_collection_objects
;
46 unsigned int last_allocated
;
47 unsigned int allocated_objects
;
48 int next_collection_bytes
;
53 struct ms_entry
*free_list
;
56 typedef struct _mark_sweep_gc
*mark_sweep_gc
;
58 #define MS_CHUNKSIZE 0x20000
59 #define MS_COLLECTION_FREQUENCY 500 // 500 fields
61 mark_sweep_gc
mark_sweep_new();
62 void mark_sweep_adjust_extremes(mark_sweep_gc ms
, ms_chunk
*new);
63 void mark_sweep_add_chunk(mark_sweep_gc ms
);
64 void mark_sweep_free_chunk(mark_sweep_gc ms
, ms_chunk
*chunk
);
65 OBJECT
mark_sweep_allocate(mark_sweep_gc ms
, int obj_fields
);
66 void mark_sweep_free(mark_sweep_gc ms
, OBJECT obj
);
67 void mark_sweep_free_fast(STATE
, mark_sweep_gc ms
, OBJECT obj
);
68 int mark_sweep_contains_p(mark_sweep_gc ms
, OBJECT obj
);
69 void mark_sweep_mark_phase(STATE
, mark_sweep_gc ms
, ptr_array roots
);
70 void mark_sweep_sweep_phase(STATE
, mark_sweep_gc ms
);
71 void mark_sweep_collect(STATE
, mark_sweep_gc ms
, ptr_array roots
);
72 void mark_sweep_describe(mark_sweep_gc ms
);
73 void mark_sweep_collect_references(STATE
, mark_sweep_gc ms
, OBJECT mark
, ptr_array refs
);
74 void mark_sweep_mark_context(STATE
, mark_sweep_gc ms
, OBJECT iobj
);
75 void mark_sweep_clear_mark(STATE
, OBJECT iobj
);
76 void mark_sweep_destroy(mark_sweep_gc ms
);
78 #endif /* __MARKSWEEP_H__ */