From daa96b31e2d64f4ec07f4a140e312c78aabbfc4c Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 10 May 2011 20:49:37 +0000 Subject: [PATCH] let's avoid using pointer parameters when possible --- Robust/src/Runtime/bamboo/multicoremsg.c | 32 +++++++++++++----------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/Robust/src/Runtime/bamboo/multicoremsg.c b/Robust/src/Runtime/bamboo/multicoremsg.c index 67459fc5..07189da4 100644 --- a/Robust/src/Runtime/bamboo/multicoremsg.c +++ b/Robust/src/Runtime/bamboo/multicoremsg.c @@ -59,31 +59,27 @@ int msgsizearray[] = { -1 //MSGEND }; -INLINE unsigned int checkMsgLength_I(unsigned int * type) { +INLINE unsigned int checkMsgLength_I(unsigned int realtype) { #if (defined(TASK)||defined(MULTICORE_GC)) - unsigned int realtype = msgdata[msgdataindex]; - *type=realtype&0xff; + unsigned int type = realtype & 0xff; #else - *type = msgdata[msgdataindex]; + unsigned int type = realtype; #endif - if(*type>MSGEND) { - // invalid msg type - BAMBOO_EXIT(); - } + BAMBOO_ASSERT(type<=MSGEND, 0x1234); #ifdef TASK #ifdef MULTICORE_GC - if(*type==TRANSOBJ||*type==GCLOBJINFO) { + if(type==TRANSOBJ||type==GCLOBJINFO) { #else - if(*type==TRANSOBJ) { + if(type==TRANSOBJ) { #endif #elif MULTICORE_GC - if (*type==GCLOBJINFO) { + if (type==GCLOBJINFO) { #endif #if (defined(TASK)||defined(MULTICORE_GC)) return realtype>>8; } #endif - return msgsizearray[*type]; + return msgsizearray[type]; } #ifdef TASK @@ -731,9 +727,15 @@ processmsg: } //we only ever read the first word - MSGTYPE type; - unsigned int msglength = checkMsgLength_I((unsigned int*)(&type)); - + unsigned int realtype = msgdata[msgdataindex]; + unsigned int msglength = checkMsgLength_I(realtype); + +#if (defined(TASK)||defined(MULTICORE_GC)) + unsigned int type = realtype & 0xff; +#else + unsigned int type = realtype; +#endif + if(msglength <= size) { // have some whole msg MSG_INDEXINC_I(); -- 2.34.1