Refactoring

This commit is contained in:
Justin Ethier 2019-03-21 17:16:21 -04:00
parent 17cecfe834
commit 3706647583
3 changed files with 17 additions and 18 deletions

16
gc.c
View file

@ -1753,22 +1753,6 @@ void gc_thr_grow_move_buffer(gc_thread_data * d)
#endif
}
/**
* @brief Add an object to the move buffer
* @param d Mutator data object containing the buffer
* @param alloci Pointer to the next open slot in the buffer
* @param obj Object to add
*/
void gc_thr_add_to_move_buffer(gc_thread_data * d, int *alloci, object obj)
{
if (*alloci == d->moveBufLen) {
gc_thr_grow_move_buffer(d);
}
d->moveBuf[*alloci] = obj;
(*alloci)++;
}
// END heap definitions
// Tri-color GC section

View file

@ -381,7 +381,6 @@ void gc_mark_globals(object globals, object global_table);
//size_t gc_sweep(gc_heap * h, int heap_type, size_t * sum_freed_ptr, gc_thread_data *thd);
gc_heap *gc_sweep(gc_heap * h, int heap_type, gc_thread_data *thd);
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, int mut_num, char *stack_base,
long stack_size);
void gc_thread_data_free(gc_thread_data * thd);

View file

@ -5325,7 +5325,23 @@ void gc_request_mark_globals(void)
gc_mark_globals(Cyc_global_variables, global_table);
}
char *gc_fixup_moved_obj(gc_thread_data * thd, int *alloci, char *obj,
/**
* @brief Add an object to the move buffer
* @param d Mutator data object containing the buffer
* @param alloci Pointer to the next open slot in the buffer
* @param obj Object to add
*/
static void gc_thr_add_to_move_buffer(gc_thread_data * d, int *alloci, object obj)
{
if (*alloci == d->moveBufLen) {
gc_thr_grow_move_buffer(d);
}
d->moveBuf[*alloci] = obj;
(*alloci)++;
}
static char *gc_fixup_moved_obj(gc_thread_data * thd, int *alloci, char *obj,
object hp)
{
int acquired_lock = 0;