void gc_mark_token( gbg_collector_t *gc, token_t *token ){ if ( token ){ gc_move_upwards( gc, token, GC_COLOR_GREY ); if ( token->type == TYPE_PROCEDURE ){ procedure_t *proc = token->proc; gc_move_upwards( gc, proc, GC_COLOR_GREY ); gc_move_upwards( gc, proc->env, GC_COLOR_GREY ); gc_move_upwards( gc, proc->body, GC_COLOR_GREY ); gc_move_upwards( gc, proc->args, GC_COLOR_GREY ); } if ( token->type == TYPE_HASHMAP ){ hashmap_t *map = shared_get( token->data ); gc_mark_hashmap( gc, map ); } if ( token->type == TYPE_VECTOR ){ dlist_t *dlst = shared_get( token->data ); gc_mark_vector( gc, dlst ); } if ( token->type == TYPE_CONTINUATION ){ gc_move_upwards( gc, token->cont, GC_COLOR_GREY ); } gc_move_upwards( gc, token->down, GC_COLOR_GREY ); gc_move_upwards( gc, token->next, GC_COLOR_GREY ); } }
int main_replay(const char *root) { if (!root) root = "/"; if (!enough_ram()) { log_info("Disabling readahead replay due to low memory."); return EXIT_SUCCESS; } shared = shared_get(); if (!shared) return EXIT_FAILURE; shared->replay = getpid(); __sync_synchronize(); if (replay(root) < 0) return EXIT_FAILURE; return EXIT_SUCCESS; }