/*@null@*/ void * rpmioFreePoolItem(/*@killref@*/ /*@null@*/ rpmioItem item, const char * msg, const char * fn, unsigned ln) /*@modifies item @*/ { rpmioPool pool; if (item == NULL) return NULL; #ifdef NOTYET assert(item->pool != NULL); /* XXX (*pool->fini) is likely necessary */ #endif yarnPossess(item->use); ANNOTATE_HAPPENS_AFTER(item); if ((pool = (rpmioPool) item->pool) != NULL && pool->flags && msg != NULL) { const char * imsg = (pool->dbg ? (*pool->dbg)((void *)item) : ""); /*@-modfilesys@*/ fprintf(stderr, "--> %s %p -- %ld %s at %s:%u%s\n", pool->name, item, yarnPeekLock(item->use), msg, fn, ln, imsg); /*@=modfilesys@*/ } if (yarnPeekLock(item->use) <= 1L) { VALGRIND_HG_CLEAN_MEMORY(item, pool->size); if (pool != NULL && pool->fini != NULL) (*pool->fini) ((void *)item); VALGRIND_MEMPOOL_FREE(pool, item + 1); item = rpmioPutPool(item); } else yarnTwist(item->use, BY, -1); /*@-retalias@*/ /* XXX returning the deref'd item is used to detect nrefs = 0 */ return (void *) item; /*@=retalias@*/ }
int starpu_profiling_status_get(void) { int ret; ANNOTATE_HAPPENS_AFTER(&_starpu_profiling); ret = _starpu_profiling; ANNOTATE_HAPPENS_BEFORE(&_starpu_profiling); return ret; }
int starpu_profiling_status_set(int status) { ANNOTATE_HAPPENS_AFTER(&_starpu_profiling); int prev_value = _starpu_profiling; _starpu_profiling = status; ANNOTATE_HAPPENS_BEFORE(&_starpu_profiling); _STARPU_TRACE_SET_PROFILING(status); /* If we enable profiling, we reset the counters. */ if (status == STARPU_PROFILING_ENABLE) { _starpu_profiling_reset_counters(); } return prev_value; }
pony_msg_t* ponyint_messageq_pop(messageq_t* q) { pony_msg_t* tail = q->tail; pony_msg_t* next = atomic_load_explicit(&tail->next, memory_order_relaxed); if(next != NULL) { q->tail = next; atomic_thread_fence(memory_order_acquire); #ifdef USE_VALGRIND ANNOTATE_HAPPENS_AFTER(&tail->next); ANNOTATE_HAPPENS_BEFORE_FORGET_ALL(tail); #endif ponyint_pool_free(tail->index, tail); } return next; }
static void signal_handler(int sig) { if(sig >= MAX_SIGNAL) return; asio_backend_t* b = ponyint_asio_get_backend(); pony_assert(b != NULL); asio_event_t* ev = atomic_load_explicit(&b->sighandlers[sig], memory_order_acquire); #ifdef USE_VALGRIND ANNOTATE_HAPPENS_AFTER(&b->sighandlers[sig]); #endif if(ev == NULL) return; eventfd_write(ev->fd, 1); }
/*@-internalglobs@*/ rpmioItem rpmioUnlinkPoolItem(rpmioItem item, const char * msg, const char * fn, unsigned ln) { rpmioPool pool; if (item == NULL) return NULL; yarnPossess(item->use); ANNOTATE_HAPPENS_AFTER(item); if ((pool = (rpmioPool) item->pool) != NULL && pool->flags && msg != NULL) { const char * imsg = (pool->dbg ? (*pool->dbg)((void *)item) : ""); /*@-modfilesys@*/ fprintf(stderr, "--> %s %p -- %ld %s at %s:%u%s\n", pool->name, item, yarnPeekLock(item->use), msg, fn, ln, imsg); /*@=modfilesys@*/ } yarnTwist(item->use, BY, -1); /*@-retalias@*/ /* XXX returning the deref'd item is used to detect nrefs = 0 */ return item; /*@=retalias@*/ }
void _starpu_profiling_init(void) { const char *env; int worker; for (worker = 0; worker < STARPU_NMAXWORKERS; worker++) { STARPU_PTHREAD_MUTEX_INIT(&worker_info_mutex[worker], NULL); } _starpu_profiling_reset_counters(); if ((env = getenv("STARPU_PROFILING")) && atoi(env)) { ANNOTATE_HAPPENS_AFTER(&_starpu_profiling); _starpu_profiling = STARPU_PROFILING_ENABLE; ANNOTATE_HAPPENS_BEFORE(&_starpu_profiling); } }
static struct PupThreadInfo *threadinfo_next( struct PupThreadInfo *tinfo ) { ANNOTATE_HAPPENS_AFTER(&tinfo->next); return (struct PupThreadInfo *)AO_load(&tinfo->next); }
static struct PupHeapRegion *region_next(struct PupHeapRegion *r) { ANNOTATE_HAPPENS_AFTER(&r->next); return (struct PupHeapRegion *)AO_load(&r->next); }
static pthread_t get_thread(const struct PupThreadInfo *tinfo) { ANNOTATE_HAPPENS_AFTER(&tinfo->tid); return AO_load(&tinfo->tid); }
static struct PupGCState *get_gc_state(struct PupHeap *heap) { ANNOTATE_HAPPENS_AFTER(&heap->gc_state); return (struct PupGCState *)AO_load((AO_t *)&heap->gc_state); }