/** Initialize task memory */ static void task_init(task_env *t) { link_init(&t->l, type_hash("task_env")); link_init(&t->all, type_hash("task_env")); t->heap_pos = 0; /* assert(ash_nazg_gimbatul.suc > (linkage*)0x8000000); */ /* assert(ash_nazg_gimbatul.pred > (linkage*)0x8000000); */ assert(ash_nazg_gimbatul.type == type_hash("task_env")); /* #ifdef __sun */ /* mem_watch(&ash_nazg_gimbatul,sizeof(&ash_nazg_gimbatul), 0); */ /* #endif */ link_into(&t->all, &ash_nazg_gimbatul); /* Put it in the list of all tasks */ /* #ifdef __sun */ /* mem_watch(&ash_nazg_gimbatul,sizeof(&ash_nazg_gimbatul), WA_WRITE); */ /* #endif */ assert(ash_nazg_gimbatul.type == type_hash("task_env")); /* assert(ash_nazg_gimbatul.suc > (linkage*)0x8000000); */ /* assert(ash_nazg_gimbatul.pred > (linkage*)0x8000000); */ t->terminate = RUN; t->refcnt = 0; t->taskret = 0; t->time = 0.0; t->arg = null_arg; t->where = t->buf; t->stack_top = &t->buf[TASK_POOL_ELEMS-1]; t->sp = t->stack_top; memset(t->buf, 0, TASK_POOL_ELEMS * sizeof(TaskAlign)); }
/* Basic operations on tasks */ static task_env *activate(task_env *t) { if (t) { MAY_DBG(FN; STRLIT("activating task "); PTREXP(t); STREXP(t->name); NDBG(t->heap_pos, d); NDBG(t->time, f); ); assert(ash_nazg_gimbatul.type == type_hash("task_env")); if (t->heap_pos) task_queue_remove(&task_time_q, t->heap_pos); link_into(&t->l, &tasks); t->time = 0.0; t->heap_pos = 0; assert(ash_nazg_gimbatul.type == type_hash("task_env")); }
unsigned decl_hash(const decl *d) { unsigned hash = type_hash(d->ref); hash ^= d->store; if(d->spel) hash ^= dynmap_strhash(d->spel); return hash; }