mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-21 22:59:16 +02:00
Stub for migrating to gc struct
This commit is contained in:
parent
2b493b15f0
commit
c49044fce6
2 changed files with 16 additions and 0 deletions
9
gc.c
9
gc.c
|
@ -674,6 +674,15 @@ void gc_thread_data_init(gc_thread_data *thd)
|
|||
// TODO: }
|
||||
}
|
||||
|
||||
void gc_thread_data_free(gc_thread_data *thd)
|
||||
{
|
||||
if (thd) {
|
||||
if (thd->moveBuf) free(thd->moveBuf);
|
||||
if (thd->mark_buffer) free(thd->mark_buffer);
|
||||
free(thd);
|
||||
}
|
||||
}
|
||||
|
||||
//// Unit testing:
|
||||
//int main(int argc, char **argv) {
|
||||
// int a = 1, b = 2, c = 3, i;
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
typedef void *object;
|
||||
|
||||
/* Thread data structures */
|
||||
typedef struct gc_thread_stack_t gc_thread_stack;
|
||||
struct gc_thread_stack {
|
||||
char *begin;
|
||||
// TODO: move moveBuf stuff over here?
|
||||
};
|
||||
|
||||
typedef struct gc_thread_data_t gc_thread_data;
|
||||
struct gc_thread_data_t {
|
||||
void **moveBuf; /* list of objects moved to heap during GC */
|
||||
|
@ -113,6 +119,7 @@ size_t gc_collect(gc_heap *h, size_t *sum_freed);
|
|||
void gc_thr_grow_move_buffer(gc_thread_data *d);
|
||||
void gc_thr_add_to_move_buffer(gc_thread_data *d, int *alloci, object obj);
|
||||
void gc_thread_data_init(gc_thread_data *thd);
|
||||
void gc_thread_data_free(gc_thread_data *thd);
|
||||
// Prototypes for mutator/collector:
|
||||
void gc_mark_gray(gc_thread_data *thd, object obj);
|
||||
void gc_collector_trace();
|
||||
|
|
Loading…
Add table
Reference in a new issue