Exemplo n.º 1
0
static void TTDINIT()
{
	yarn_thread_data* ttd = (yarn_thread_data*)yalloc(sizeof(yarn_thread_data));
	ttd->yarn_current = NULL;
	ttd->runtime = 0;
	pthread_setspecific(_ttd, ttd);
}
Exemplo n.º 2
0
static void prepare_context ( yarn* active_yarn, void (*routine)(void*), void* udata )
{
	yarn_launch_data* ld = yalloc(sizeof(yarn_launch_data));
	yarn_context_t* uctx = &active_yarn->context;
	ld->active_yarn = active_yarn;
	ld->routine = routine;
	ld->udata = udata;
	DEBUG("running yarn_context_make on ctx: %p\n", uctx);
	//yarn_context_make(uctx, basic_launch, 0);
	yarn_context_make(uctx, (void (*)(void*))yarn_launcher, ld);
}
Exemplo n.º 3
0
void fifo_enqueue ( fifo* q, unsigned long val )
{
	if (!q->head)
	{
		q->head = q->tail = (fifo_segment*)yalloc(sizeof(fifo_segment));
		q->head->count = 1;
		q->head->elements[0] = val;
	}
	else
	{
		if (q->tail->count == FIFO_ELEMENTS_PER_SEGMENT)
		{
			q->tail->next = (fifo_segment*)yalloc(sizeof(fifo_segment));
			q->tail = q->tail->next;
			q->tail->count = 1;
			q->tail->elements[0] = val;
		}
		else
		{
			q->tail->elements[q->tail->count++] = val;
		}
	}
	q->length++;
}
Exemplo n.º 4
0
cpfir() {
  /* compute an array with the first of nonterminals */
  int i, ch, **s, **t, changes, *p;

  pfirst = (struct looksets **)yalloc(nnonter+1);
  for (i=0;i<=nnonter;i++) {
    aryfil( wsets[i].ws, tbitset, 0 );
    t = pres[i+1];
    for( s=pres[i]; s<t; ++s ){ /* initially fill the sets */
      for( p = *s; (ch = *p) > 0 ; ++p ) {
        if( ch < NTBASE ) {
          wsets[i].ws[ch>>4] |= (1 << (ch&017) );
          break;
          }
        else if( !pempty[ch-NTBASE] ) break;
        }
      }
Exemplo n.º 5
0
cpres(){ /* conpute an array with the beginnings of  productions yielding given nonterminals
	The array pres points to these lists */
	int i,j,c;
	pres = (int ***)yalloc(nnonter+1);
	for(i=0;i<=nnonter;i++){
		c = i+NTBASE;
		pres[i] = (int **)mem;
		fatfl = 0;  /* make undefined  symbols  nonfatal */
		for(j=0;j<nprod;j++)
		if (*prdptr[j] == c) *mem++ =  (int)(prdptr[j]+1);
		if(pres[i] == (int **)mem){
			error("nonterminal %s not defined!", nontrst[i].name);
			}
		}
	pres[i] = (int **)mem;
	fatfl = 1;
	if( nerrors ){
		summary();
		cexit(1);
		}
	}
Exemplo n.º 6
0
fifo* fifo_new ()
{
	fifo* f = (fifo*)yalloc(sizeof(fifo));
	return f;
}