void cilkred_map::make_buckets(__cilkrts_worker *w, size_t new_nbuckets) { nbuckets = new_nbuckets; CILK_ASSERT(is_power_of_2(nbuckets)); #if defined __GNUC__ && defined __ICC /* bug workaround -- suppress calls to _intel_fast_memset */ bucket *volatile*new_buckets = (bucket *volatile*) #else bucket **new_buckets = (bucket **) #endif __cilkrts_frame_malloc(w, nbuckets * sizeof(*(buckets))); #if REDPAR_DEBUG >= 1 fprintf(stderr, "W=%d, desc=make_buckets, new_buckets=%p, new_nbuckets=%zd\n", w->self, new_buckets, new_nbuckets); #endif for (size_t i = 0; i < new_nbuckets; ++i) new_buckets[i] = 0; #if defined __GNUC__ && defined __ICC buckets = (bucket **)new_buckets; #else buckets = new_buckets; #endif nelem = 0; }
static bucket *alloc_bucket(__cilkrts_worker *w, size_t nmax) { bucket *b = (bucket *) __cilkrts_frame_malloc(w, sizeof_bucket(nmax)); b->nmax = nmax; return b; }
cilkred_map *__cilkrts_make_reducer_map(__cilkrts_worker *w) { CILK_ASSERT(w); cilkred_map *h; size_t nbuckets = 1; /* default value */ h = (cilkred_map *)__cilkrts_frame_malloc(w, sizeof(*h)); #if REDPAR_DEBUG >= 1 fprintf(stderr, "[W=%d, desc=make_reducer_frame_malloc_reducer_map, h=%p]\n", w->self, h); #endif h->g = w ? w->g : 0; h->make_buckets(w, nbuckets); h->merging = false; h->is_leftmost = false; return h; }
COMMON_PORTABLE full_frame *__cilkrts_make_full_frame(__cilkrts_worker *w, __cilkrts_stack_frame *sf) { full_frame *ff; START_INTERVAL(w, INTERVAL_ALLOC_FULL_FRAME) { ff = (full_frame *)__cilkrts_frame_malloc(w, sizeof(*ff)); __cilkrts_mutex_init(&ff->lock); ff->full_frame_magic_0 = FULL_FRAME_MAGIC_0; ff->join_counter = 0; ff->parent = 0; ff->rightmost_child = 0; ff->left_sibling = ff->right_sibling = 0; ff->call_stack = sf; ff->is_call_child = 0; ff->simulated_stolen = 0; ff->children_reducer_map = ff->right_reducer_map = 0; ff->pending_exception = ff->child_pending_exception = ff->right_pending_exception = NULL; ff->sync_sp = 0; #ifdef _WIN32 ff->exception_sp = 0; ff->trylevel = (unsigned long)-1; ff->registration = 0; #endif ff->frame_size = 0; ff->fiber_self = 0; ff->fiber_child = 0; ff->sync_master = 0; /*__cilkrts_init_full_frame_sysdep(w, ff);*/ ff->full_frame_magic_1 = FULL_FRAME_MAGIC_1; } STOP_INTERVAL(w, INTERVAL_ALLOC_FULL_FRAME);
static void save_exception_info(__cilkrts_worker *w, __cxa_eh_globals *state, _Unwind_Exception *exc, bool rethrow, const char *why) { struct pending_exception_info *info = (struct pending_exception_info *)__cilkrts_frame_malloc(w, sizeof (struct pending_exception_info)); CILK_ASSERT(info); info->make(state, exc, rethrow); #if DEBUG_EXCEPTIONS { char buf[40]; decode_exceptions(buf, sizeof buf, info); fprintf(stderr, "make exception info W%u %p %s (%s)\n", w->self, info, buf, why); } #endif CILK_ASSERT(w->l->pending_exception == 0); w->l->pending_exception = info; }