Example #1
0
//Refer to FIGURE 7.4 (P168)
//struct {T_stm left, right;} SEQ;  T_stm_
//struct {T_stm stm; T_exp exp;} ESEQ;  T_exp_
void Tr_recordExp_app(Tr_exp te, Tr_exp init, bool last){
debug("Tr_recordExp_app %s", last==TRUE?"(LAST)":"");
	//1) Retrieve T_stm, which should be an ESEQ
	T_exp ex = unEx(te);

	//2) Prepare for iteration
	//The first sub-node for field initialization 
	T_stm* right = &(ex->u.ESEQ.stm->u.SEQ.right);
	//The register saving the base addr of record var
	T_exp temp = ex->u.ESEQ.exp;

	//3) Iterate over the SEQs, until the rightmost node is found, which should be NULL
	int i = 0;
	while(*right!=NULL){
		right = &((*right)->u.SEQ.right);
		i++;
	}

	//4) Create a new sub-node to initialize the next field
	T_stm move = T_Move(T_Mem(T_Binop(T_plus, temp, T_Const(i*F_wordSize))), unEx(init));

	//5) Substitue the rightmode node
	if(!last){
		*right = T_Seq(move, NULL);
	} else {
		*right = move;
	}	

}
Example #2
0
Tr_exp Tr_assignExp(Tr_exp lvalue, Tr_exp right){
debug("Tr_assignExp");

	if(right!=NULL){
		return Tr_Nx(T_Move(unEx(lvalue), unEx(right)));
	} else {
		return lvalue;
	}
}
Example #3
0
Tr_exp Tr_arrayExp(Tr_exp size, Tr_exp init){
debug("Tr_arrayExp");

/* Dynamic array creation
		T_Move   var <- 0
		T_Label  start
		T_CJump	 var < size, t, f
		T_Label(t)
		T_Move   offset <- base + var * wordSize
		T_Move   Mem(offset) <- init
		T_Move   var <- var + 1
		T_Jump	 start
		T_Label(f)
*/
/*
	T_exp call = F_externalCall("malloc", T_ExpList(unEx(size), NULL));
	Temp_temp _var = Temp_newtemp();
	Temp_temp _offset = Temp_newtemp();
	Temp_temp _base = Temp_newtemp();
	T_exp var = T_Temp(_var);
	T_exp offset = T_Temp(_offset);
	T_exp base = T_Temp(_base);
	Temp_label t = Temp_newlabel();
	Temp_label f = Temp_newlabel();
	Temp_label start = Temp_newlabel();

	T_exp ex =
		T_Eseq(T_Move(base, call),						//Allocate the memory; base := starting address of the allocated mem
		T_Eseq(T_Move(var, T_Const(0)),					//var := 0
		T_Eseq(T_Label(start),							//start:
		T_Eseq(T_Cjump(T_lt, var, unEx(size), t, f),	//if var < size then jump t else jump f
		T_Eseq(T_Label(t),								//t:
		T_Eseq(T_Move(offset, T_Binop(T_plus, base, T_Binop(T_mul, var, T_Const(F_wordSize)))),
														//offset := base + var * wordSize
		T_Eseq(T_Move(T_Mem(offset), unEx(init)),		//MEM[offset] := init
		T_Eseq(T_Move(var, T_Binop(T_plus, var, T_Const(1))),
														//var := var + 1
		T_Eseq(T_Jump(T_Name(start), Temp_LabelList(start, NULL)),
														//jump t
			T_Eseq(T_Label(f),							//f:
				base
			)
		)))))))));
*/

	//Use system function initArray, which returns pointer to the allocated memory
	T_exp ex = F_externalCall("initArray", T_ExpList(unEx(size), T_ExpList(unEx(init), NULL)));

	return Tr_Ex(ex);
}
Example #4
0
Tr_exp Tr_seqExp(Tr_exp* array, int size){
    T_exp _pex = (T_exp)checked_malloc(sizeof(struct T_exp_));
	T_exp *pex = &_pex;//Always point to the rightmost node in the tree during the spanning
	T_exp ex_head;

	int i = 0;
	int last = size - 1;
	while(i<size){
Tr_printTrExp(array[i]);
		if(i!=last){
			//Not the last one: substitute the rightmost node by T_Eseq (stm-exp pair),
			//where stm is the Tr_exp
			*pex = T_Eseq(unNx(array[i]), NULL);
		} else {
			//Last one: substitute the rightmost node by Tr_exp itself
			*pex = unEx(array[i]);
		}

		//In case of first node, remember it
		if(i==0){
			ex_head = *pex;
		}

		//Not the last one: let pex point to the rightmost node again
		if(i!=last){
			pex = &((*pex)->u.ESEQ.exp);
		} 
		
		i++;
	}
//debug("Tr_seqExp done");
	return Tr_Ex(ex_head);
}
Example #5
0
Tr_exp Tr_forExp(Tr_exp var, Tr_exp low, Tr_exp high, Tr_exp body){
debug("Tr_forExp");

	T_stm st;
	T_exp v = unEx(var);
	Temp_label t = Temp_newlabel();
	Temp_label f = LL_peek();//Get done label from the list, which should have been prepared before this function is called.
	Temp_label start = Temp_newlabel();

	T_stm cond = T_Cjump(T_le, v, unEx(high), t, f);

	/*
		T_Move   var <- low
		T_Label  start
		T_CJump	 var <= high, t, f
		T_Label(t)
		body
		T_Move   var + 1
		T_Jump	 start
		T_Label(f)
	*/
	st = T_Seq(T_Move(v, unEx(low)),
			T_Seq(T_Label(start),
				T_Seq(cond,
					T_Seq(T_Label(t),
						T_Seq(unNx(body),
							T_Seq(T_Move(v, T_Binop(T_plus, v, T_Const(1))),
								T_Seq(
									T_Jump(
										T_Name(start), 
										Temp_LabelList(start, NULL)
									),
									T_Label(f)
								)
							)
						)
					)
				)
			)
		);

	//Pop the label as it's no longer used
	LL_pop();

	return Tr_Nx(st);
}
Example #6
0
void Tr_procEntryExit(Tr_level level, Tr_exp body, Tr_accessList formals, Temp_label label){
	T_stm stm;

	stm = 
		T_Seq(
			T_Label(label),
			T_Move(T_Temp(F_RV()), unEx(body))
		);

	//Put the frag into the list
	F_Proc(stm, level->frame);
}
Example #7
0
//-----------------------------------------------------------------------------
void Consumer::removeSubscription(const char* type_name)
{
    ACS_TRACE("Consumer::removeSubscription");
    
    
    CosNotification::EventTypeSeq added(0);
    CosNotification::EventTypeSeq removed(1);
    added.length(0);
    removed.length(1);
    
    removed[0].domain_name = getChannelDomain();
    removed[0].type_name   = CORBA::string_dup(type_name);
    
    ACS_SHORT_LOG((LM_INFO, "Consumer::removeSubscription unsubscribing from '%s' events for the '%s' channel!",
		   static_cast<const char *>(added[0].type_name), channelName_mp));
    
    try
    {
    	consumerAdmin_m->subscription_change(added, removed);
    }
    catch(CORBA::SystemException &ex)
    {
    	ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__, "nc::Consumer::removeSubscription");
    	corbaProblemEx.setMinor(ex.minor());
    	corbaProblemEx.setCompletionStatus(ex.completed());
    	corbaProblemEx.setInfo(ex._info().c_str());
    	acsncErrType::RemoveSubscriptionProblemExImpl aspEx(corbaProblemEx, __FILE__,__LINE__,"nc::Consumer::removeSubscription");
    	aspEx.setEvent(static_cast<const char *>(added[0].type_name));
    	aspEx.setChannel(channelName_mp);
    	aspEx.log(LM_DEBUG);
    	throw aspEx;
    }
    catch(CORBA::Exception &ex)
    {
    	ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__, "nc::Consumer::removeSubscription");
    	corbaProblemEx.setInfo(ex._info().c_str());
    	acsncErrType::RemoveSubscriptionProblemExImpl aspEx(corbaProblemEx, __FILE__,__LINE__,"nc::Consumer::removeSubscription");
    	aspEx.setEvent(static_cast<const char *>(added[0].type_name));
    	aspEx.setChannel(channelName_mp);
    	aspEx.log(LM_DEBUG);
    	throw aspEx;
    }
    catch(...)
    {
    	ACSErrTypeCommon::UnknownExImpl unEx(__FILE__, __LINE__, "nc::Consumer::removeSubscription");
    	acsncErrType::RemoveSubscriptionProblemExImpl aspEx(unEx, __FILE__,__LINE__,"nc::Consumer::removeSubscription");
    	aspEx.setEvent(static_cast<const char *>(added[0].type_name));
    	aspEx.setChannel(channelName_mp);
    	aspEx.log(LM_DEBUG);
    	throw aspEx;
    }
}//removeSubscription
Example #8
0
Tr_exp Tr_arithExp(A_oper oper, Tr_exp left, Tr_exp right){
	T_exp exp;

	switch(oper){
	case A_plusOp:
		exp = T_Binop(T_plus, unEx(left), unEx(right));
		break;
	case A_minusOp:
		exp = T_Binop(T_minus, unEx(left), unEx(right));
		break;
	case A_timesOp:
		exp = T_Binop(T_mul, unEx(left), unEx(right));
		break;
	case A_divideOp:
		exp = T_Binop(T_div, unEx(left), unEx(right));
		break;
	default:
		//Should not reach here
		printf("Illegal arithmetic operator");
		exit(2);
	}

	return Tr_Ex(exp);
}
Example #9
0
Tr_exp Tr_logicExp(A_oper oper, Tr_exp left, Tr_exp right, bool isStrCompare){
	T_stm stm;
	patchList tl;
	patchList fl;

	if(isStrCompare){
		T_exp call = F_externalCall("stringEqual", T_ExpList(unEx(left), T_ExpList(unEx(right), NULL)));
		switch(oper){
		case A_eqOp:
			stm = T_Cjump(T_eq, call, T_Const(1), NULL, NULL);
			break;
		case A_neqOp:
			stm = T_Cjump(T_eq, call, T_Const(0), NULL, NULL);
			break;
		default:
			//Should not reach here
			printf("Illegal logic operator on string comparison");
			exit(2);
		}
	} else {
		switch(oper){
		case A_eqOp:
			stm = T_Cjump(T_eq, unEx(left), unEx(right), NULL, NULL);
			break;
		case A_neqOp:
			stm = T_Cjump(T_ne, unEx(left), unEx(right), NULL, NULL);
			break;
		case A_ltOp:
			stm = T_Cjump(T_lt, unEx(left), unEx(right), NULL, NULL);
			break;
		case A_gtOp:
			stm = T_Cjump(T_gt, unEx(left), unEx(right), NULL, NULL);
			break;
		case A_leOp:
			stm = T_Cjump(T_le, unEx(left), unEx(right), NULL, NULL);
			break;
		case A_geOp:
			stm = T_Cjump(T_ge, unEx(left), unEx(right), NULL, NULL);
			break;
		default:
			//Should not reach here
			printf("Illegal logic operator");
			exit(2);
		}
	}

	tl = PatchList(&stm->u.CJUMP.true, NULL);
	fl = PatchList(&stm->u.CJUMP.false, NULL);
	return Tr_Cx(tl, fl, stm);
}
Example #10
0
Tr_exp Tr_callExp(Tr_level caller_lvl, Tr_level callee_lvl, Temp_label fun_label, Tr_exp* argv, int args){

int z = 0;
int cnt = 0;
debug("caller = %d; callee = %d", caller_lvl->depth, callee_lvl->depth);
	//1) Get the static link for the called function
	T_exp slk;
	if(caller_lvl!=callee_lvl){
debug("  (Tr_callExp: Follow static link %d)", ++cnt);
		//Follow the static link
		slk = F_Exp(F_staticLink(), T_Temp(F_FP()));
		caller_lvl = caller_lvl->parent;
		//TODO check: caller_lvl cannot be null
		while(caller_lvl!=callee_lvl){
debug("  (Tr_callExp: Follow static link %d)", ++cnt);
			slk = F_Exp(F_staticLink(), slk);			
			caller_lvl = caller_lvl->parent;
			//TODO check: caller_lvl cannot be null
		}
	} else {
debug("  (Tr_callExp: Don't follow link)");
		//Just use the current frame pointer
		slk = F_Exp(F_staticLink(), T_Temp(F_FP()));
	}
debug("Static link done");

	//2) Create the argument list, including the static link
	//2.1) Allocate memory
	T_expList listp_head = NULL;
	if(args>0){
/* Problematic on 64-bit machine
		int node_size = sizeof(struct T_expList_)/8;
		T_expList listp = (T_expList)checked_malloc((args+1) * sizeof(struct T_expList_));
		listp_head = listp;

		//2.2) Initialize
		listp->head = slk;
		listp->tail = listp + node_size;
		listp = listp->tail;
		int i = 0;
		while(i < args){
			//Let head point to the next argument
			listp->head = unEx(*argv);

			//Let tail point to next head
			listp->tail = listp + node_size;

			//Move the base pointer over one node
			if(i<args-1){
				listp = listp->tail;
				argv++;
			}
			i++;
		}
		listp->tail = NULL;
*/
		T_expList listp = (T_expList)checked_malloc(sizeof(struct T_expList_));
		listp_head = listp;
		//2.2) Initialize
		listp->head = slk;
		listp->tail = NULL;
		int i = 0;		
		while(i < args){
			//Create new list on the tail
			listp->tail = (T_expList)checked_malloc(sizeof(struct T_expList_));
			listp = listp->tail;

			//Let head point to the next argument
			listp->head = unEx(*argv);

			//Let tail point to next head
			listp->tail = NULL;

			//Get next argument
			argv++;

			i++;
		}
	}
debug("argument list prepared");

	//3) Generate IR
	T_exp exp = T_Call(T_Name(fun_label), listp_head);

/*
int i = 0;
while(listp_head!=NULL){
printf("arg %d\n", i++);listp_head=listp_head->tail;
}
*/

debug("call done");
	return Tr_Ex(exp);
}
Example #11
0
Tr_exp Tr_arrayVar(Tr_exp base, Tr_exp offset_exp){
	return Tr_Ex(T_Mem(T_Binop(T_plus, unEx(base), T_Binop(T_mul, unEx(offset_exp), T_Const(F_wordSize)))));
}
Example #12
0
//@@@ print Tr_exp
void print(Tr_exp et, FILE * out) {
    if (et->kind == Tr_ex) printExp(unEx(et), out);
	if (et->kind == Tr_nx) printStm(unNx(et), out);
	if (et->kind == Tr_cx) printStm(unCx(et).stm, out);
} 
Example #13
0
Tr_exp Tr_ifExp(Tr_exp cond, Tr_exp thenb, Tr_exp elseb){
	T_exp ex;
	T_stm st;
	Tr_exp ret;
	struct Cx cx_cond = unCx(cond);

	Temp_label t = Temp_newlabel();
	Temp_label f = Temp_newlabel();
	Temp_label join = Temp_newlabel();

	doPatch(cx_cond.trues, t);
	doPatch(cx_cond.falses, f);
	
	if(elseb==NULL){
	//case 1: if-then
debug("Tr_ifExp: if-then");
		st = T_Seq(cx_cond.stm,
				T_Seq(T_Label(t),
					T_Seq(unNx(thenb),
						T_Label(f)
					)
				)
			);
		ret = Tr_Nx(st);
	} else {
	//case 2: if-then-else
		if(thenb->kind==Tr_nx && elseb->kind==Tr_nx){
debug("Tr_ifExp: if-then-else (2 nx)");
			//special case: two statements
			st = T_Seq(cx_cond.stm,
					T_Seq(T_Label(t),
						T_Seq(unNx(thenb),
							T_Seq(
								T_Jump(
									T_Name(join), 
									Temp_LabelList(join, NULL)
								),
								T_Seq(T_Label(f),
									T_Seq(unNx(elseb),
										T_Label(join)
									)
								)
							)
						)
					)
				);
			ret = Tr_Nx(st);
//TODO: special case - two cx.
		} else {
debug("Tr_ifExp: if-then-else");
			Temp_temp r = Temp_newtemp();
			ex = T_Eseq(cx_cond.stm,
					T_Eseq(T_Label(t),
						T_Eseq(T_Move(T_Temp(r), unEx(thenb)),
							T_Eseq(
								T_Jump(
									T_Name(join), 
									Temp_LabelList(join, NULL)
								),
								T_Eseq(T_Label(f),
									T_Eseq(T_Move(T_Temp(r), unEx(elseb)),
										T_Eseq(T_Label(join),
											T_Temp(r)
										)
									)
								)
							)
						)
					)
				);
			ret = Tr_Ex(ex);
		}

	}
	
	return ret;
}
Example #14
0
//-----------------------------------------------------------------------------
void 
RTSupplier::worker(void* param_p)
{
    //sanity check
    if (param_p == 0) 
	{
	return;
	}
    
    //get access to ourself...
    BACIThreadParameter *baciParameter_p = static_cast<BACIThreadParameter *>(param_p);
    BACIThread *myself_p = baciParameter_p->getBACIThread();
    
    // Variables have to be passed explicitly
    RTSupplier *supplier_p = static_cast<RTSupplier *>(const_cast<void *>(baciParameter_p->getParameter()));
    
    if (BACIThread::InitThread != 0) 
	{
	BACIThread::InitThread("worker");
	}
    
    // Control loop
    while(myself_p->check() == true)
	{
	//there are unpublished events
        if((myself_p->isSuspended() == false) && (supplier_p->unpublishedEvents_m.empty() != true))
        {	
            //Now we rush through and publish any events in the queue
            while(supplier_p->unpublishedEvents_m.empty() != true)
            {
                try
                {
                    //no need for the mutex here (reads are thread safe)
                    supplier_p->publishEvent(supplier_p->unpublishedEvents_m.front().event);

                    //must use a mutex for any STL write operation
                    ACE_Guard<ACE_Thread_Mutex> guard(supplier_p->eventQueueMutex_m);//.acquire();
                    supplier_p->unpublishedEvents_m.pop();
                }
                catch(ACSErrTypeCommon::CORBAProblemEx &_ex)
                {
                    char strlog[1024];
                    Logging::Logger::LoggerSmartPtr logger = getLogger();
                    sprintf(strlog, " %s channel - problem (ACSErrTypeCommon::CORBAProblemEx) publishing a saved event!",
                            supplier_p->channelName_mp);
                    supplier_p->rtSupGuardb->log(logger, Logging::Logger::LM_ERROR,
                            strlog, __FILE__, __LINE__, "RTSupplier::worker()");
                    ACSErrTypeCommon::CORBAProblemExImpl ex(_ex);
                    supplier_p->rtSupGuardex->log(ex);
                    supplier_p->unpublishedEvents_m.front().tries++;
                    //Use the callback to to notify the user that the message is dropped
                    if(supplier_p->unpublishedEvents_m.front().tries > 5){
                        struct unpublishedEventData data = 
                            supplier_p->unpublishedEvents_m.front();
                        supplier_p->unpublishedEvents_m.pop();
                        if(data.callback != NULL){
                            ::CORBA::Any event = data.event.filterable_data[0].value;
                            data.callback->eventDropped(&event);
                        }
                    }
                }
                catch(ACSErr::ACSbaseExImpl &_ex) //ACS exception ?
                {
                	char strlog[1024];
                	Logging::Logger::LoggerSmartPtr logger = getLogger();
                	sprintf(strlog, " %s channel - problem (ACSErr::ACSbaseEXImpl) publishing a saved event!",
                			supplier_p->channelName_mp);
                	supplier_p->rtSupGuardb->log(logger, Logging::Logger::LM_ERROR,
                			strlog, __FILE__, __LINE__, "RTSupplier::worker()");
                	supplier_p->rtSupGuardex->log(_ex);
                	supplier_p->unpublishedEvents_m.front().tries++;
                	//Use the callback to to notify the user that the message is dropped
                	if(supplier_p->unpublishedEvents_m.front().tries > 5){
                		struct unpublishedEventData data =
                				supplier_p->unpublishedEvents_m.front();
                		supplier_p->unpublishedEvents_m.pop();
                		if(data.callback != NULL){
                			::CORBA::Any event = data.event.filterable_data[0].value;
                			data.callback->eventDropped(&event);
                		}
                	}
                }
                catch(CORBA::SystemException &ex)
                {
                    //tbd: we have to improve here the erro handling. Now we print out more that is necessary
                    char strlog[1024];
                    Logging::Logger::LoggerSmartPtr logger = getLogger();
                    sprintf(strlog, " %s channel - problem (CORBA::SystemException) publishing a saved event!",
                            supplier_p->channelName_mp);
                    supplier_p->rtSupGuardb->log(logger, Logging::Logger::LM_ERROR,
                            strlog, __FILE__, __LINE__, "RTSupplier::worker()");
                    ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__,
                            "RTSupplier::worker()");
                    corbaProblemEx.setMinor(ex.minor());
                    corbaProblemEx.setCompletionStatus(ex.completed());
                    corbaProblemEx.setInfo(ex._info().c_str());
                    supplier_p->rtSupGuardex->log(corbaProblemEx);
                    supplier_p->unpublishedEvents_m.front().tries++;
                    //Use the callback to to notify the user that the message is dropped
                    if(supplier_p->unpublishedEvents_m.front().tries > 5){
                        struct unpublishedEventData data = 
                            supplier_p->unpublishedEvents_m.front();
                        supplier_p->unpublishedEvents_m.pop();
                        if(data.callback != NULL){
                            ::CORBA::Any event = data.event.filterable_data[0].value;
                            data.callback->eventDropped(&event);
                        }
                    }
                }
                catch(CORBA::Exception &ex)
                {
                	//tbd: we have to improve here the erro handling. Now we print out more that is necessary
                	char strlog[1024];
                	Logging::Logger::LoggerSmartPtr logger = getLogger();
                	sprintf(strlog, " %s channel - problem (CORBA::Exception) publishing a saved event!",
                			supplier_p->channelName_mp);
                	supplier_p->rtSupGuardb->log(logger, Logging::Logger::LM_ERROR,
                			strlog, __FILE__, __LINE__, "RTSupplier::worker()");
                	ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__,
                			"RTSupplier::worker()");
                	corbaProblemEx.addData("Name", ex._name());
                	corbaProblemEx.addData("RepId", ex._rep_id());
                	supplier_p->rtSupGuardex->log(corbaProblemEx);
                	supplier_p->unpublishedEvents_m.front().tries++;
                	//Use the callback to to notify the user that the message is dropped
                	if(supplier_p->unpublishedEvents_m.front().tries > 5){
                		struct unpublishedEventData data =
                				supplier_p->unpublishedEvents_m.front();
                		supplier_p->unpublishedEvents_m.pop();
                		if(data.callback != NULL){
                			::CORBA::Any event = data.event.filterable_data[0].value;
                			data.callback->eventDropped(&event);
                		}
                	}
                }
                catch(std::exception &ex)
                {
                	//tbd: we have to improve here the erro handling. Now we print out more that is necessary
                	char strlog[1024];
                	Logging::Logger::LoggerSmartPtr logger = getLogger();
                	sprintf(strlog, " %s channel - problem (std::exception) publishing a saved event!",
                			supplier_p->channelName_mp);
                	supplier_p->rtSupGuardb->log(logger, Logging::Logger::LM_ERROR,
                			strlog, __FILE__, __LINE__, "RTSupplier::worker()");

                	ACSErrTypeCommon::StdExceptionExImpl stdEx(__FILE__, __LINE__, "RTSupplier::worker()");
                	stdEx.setWhat(ex.what());
                	supplier_p->rtSupGuardex->log(stdEx);

                	supplier_p->unpublishedEvents_m.front().tries++;
                	//Use the callback to to notify the user that the message is dropped
                	if(supplier_p->unpublishedEvents_m.front().tries > 5){
                		struct unpublishedEventData data =
                				supplier_p->unpublishedEvents_m.front();
                		supplier_p->unpublishedEvents_m.pop();
                		if(data.callback != NULL){
                			::CORBA::Any event = data.event.filterable_data[0].value;
                			data.callback->eventDropped(&event);
                		}
                	}
                }
                catch(...)
                {
                    char strlog[1024];
                    Logging::Logger::LoggerSmartPtr logger = getLogger();
                    sprintf(strlog, " %s channel - problem (unknown exception) publishing a saved event!",
                            supplier_p->channelName_mp);
                    supplier_p->rtSupGuardb->log(logger, Logging::Logger::LM_ERROR,
                            strlog, __FILE__, __LINE__, "RTSupplier::worker()");
                    ACSErrTypeCommon::UnknownExImpl unEx(__FILE__, __LINE__, "RTSupplier::worker()");
                    supplier_p->rtSupGuardex->log(unEx);

                    supplier_p->unpublishedEvents_m.front().tries++;
                    //Use the callback to to notify the user that the message is dropped
                    if(supplier_p->unpublishedEvents_m.front().tries > 5){
                        struct unpublishedEventData data = 
                            supplier_p->unpublishedEvents_m.front();
                        supplier_p->unpublishedEvents_m.pop();
                        if(data.callback != NULL){
                            ::CORBA::Any event = data.event.filterable_data[0].value;
                            data.callback->eventDropped(&event);
                        }
                    }
                }
            }
        }
        myself_p->sleep();
    }
    
    if (BACIThread::DoneThread != 0) 
    {
        BACIThread::DoneThread();
    }
    delete baciParameter_p;
    myself_p->setStopped();
}
Example #15
0
//-----------------------------------------------------------------------------
void Consumer::addSubscription(const char* type_name)
{
	ACS_TRACE("Consumer::addSubscription");

	CosNotification::EventTypeSeq added(1);
	CosNotification::EventTypeSeq removed(0);
	added.length(1);
	removed.length(0);
   
	added[0].domain_name = getChannelDomain();
	added[0].type_name   = CORBA::string_dup(type_name);
   
	ACS_SHORT_LOG((LM_INFO, "Consumer::addSubscription subscribing to '%s' events for the '%s' channel!",
	static_cast<const char *>(added[0].type_name), channelName_mp));

	if(CORBA::is_nil(consumerAdmin_m))
	{
		// log an error, then throw an exception to prevent segfault dereferencing nil consumerAdmin_m
		ACSErrTypeCORBA::CORBAReferenceNilExImpl nEx(__FILE__, __LINE__, "nc::Consumer::addSubscription");
		nEx.setVariable("consumerAdmin_m");
		nEx.setContext("was init() called?");

		acsncErrType::AddSubscriptionProblemExImpl aspEx(nEx, __FILE__,__LINE__,"nc::Consumer::addSubscription");
		aspEx.setEvent(static_cast<const char *>(added[0].type_name));
		aspEx.setChannel(channelName_mp);
		aspEx.log(LM_DEBUG);
		throw aspEx;
	}//if
	try
	{
		consumerAdmin_m->subscription_change(added, removed);
	} 
	catch(CORBA::SystemException &ex)
	{

		ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__, "nc::Consumer::addSubscription");
		corbaProblemEx.setMinor(ex.minor());
		corbaProblemEx.setCompletionStatus(ex.completed());
		corbaProblemEx.setInfo(ex._info().c_str());
		acsncErrType::AddSubscriptionProblemExImpl aspEx(corbaProblemEx, __FILE__,__LINE__,"nc::Consumer::addSubscription");
		aspEx.setEvent(static_cast<const char *>(added[0].type_name));
		aspEx.setChannel(channelName_mp);
		aspEx.log(LM_DEBUG);
		throw aspEx;
	}
	catch(CORBA::Exception &ex)
	{
		ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__, "nc::Consumer::addSubscription");
		corbaProblemEx.setInfo(ex._info().c_str());
		acsncErrType::AddSubscriptionProblemExImpl aspEx(corbaProblemEx, __FILE__,__LINE__,"nc::Consumer::addSubscription");
		aspEx.setEvent(static_cast<const char *>(added[0].type_name));
		aspEx.setChannel(channelName_mp);
		aspEx.log(LM_DEBUG);
		throw aspEx;
	}
	catch(...)
	{
		ACSErrTypeCommon::UnknownExImpl unEx(__FILE__, __LINE__, "nc::Consumer::addSubscription");
		acsncErrType::AddSubscriptionProblemExImpl aspEx(unEx, __FILE__,__LINE__,"nc::Consumer::addSubscription");
		aspEx.setEvent(static_cast<const char *>(added[0].type_name));
		aspEx.setChannel(channelName_mp);
		aspEx.log(LM_DEBUG);
		throw aspEx;
	}
}//addSubscription
Example #16
0
Tr_exp Tr_fieldVar(Tr_exp base, int field_offset){
	return Tr_Ex(T_Mem(T_Binop(T_plus, unEx(base), T_Const(field_offset * F_wordSize))));
}
Example #17
0
/*
static void display_l(Tr_level l) {
	static int lnum;
	if (l->parent) {
		printf("parent: %s\n", Temp_labelstring(l->parent->name));
	} else {
		printf("parent: root\n");
	}
	printf("addr: %s\n", Temp_labelstring(l->name));
	display_f(l->frame);
}

static void display_ac(Tr_access ac) {
	printf("level: %s\n", Temp_labelstring(ac->level->name));	
	dis_ac(ac->access);
}
*/
T_exp public_unEx(Tr_exp e) {
	return unEx(e);
}