From 5a3d9b2da4fe54709d9d0e0e580cb6118429a0b8 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Thu, 30 Jun 2011 11:41:07 +0000 Subject: [PATCH] do synchronization after message handlers are up --- Robust/src/Runtime/bamboo/multicoremsg.c | 25 ++++++++++++++++++++ Robust/src/Runtime/bamboo/multicoremsg.h | 4 +++- Robust/src/Runtime/bamboo/multicoreruntime.c | 16 ++++++++++++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/Robust/src/Runtime/bamboo/multicoremsg.c b/Robust/src/Runtime/bamboo/multicoremsg.c index a9fd40c7..420a6a80 100644 --- a/Robust/src/Runtime/bamboo/multicoremsg.c +++ b/Robust/src/Runtime/bamboo/multicoremsg.c @@ -10,6 +10,8 @@ int msgsizearray[] = { 0, //MSGSTART, + 1, //REQNOTIFYSTART + 1, //NOTIFYSTART -1, //TRANSOBJ, // 0xD1 4, //TRANSTALL, // 0xD2 5, //LOCKREQUEST, // 0xD3 @@ -706,6 +708,19 @@ INLINE void processmsg_gcfinishpref_I() { #endif // GC_CACHE_ADAPT #endif // #ifdef MULTICORE_GC +void processmg_req_notify_start() { + startflag=true; + if(BAMBOO_CHECK_SEND_MODE()) { + cache_msg_1_I(STARTUPCORE,NOTIFYSTART); + } else { + send_msg_1_I(STARTUPCORE,NOTIFYSTART); + } +} + +void processmg_notify_start() { + numconfirm--; +} + // receive object transferred from other cores // or the terminate message from other cores // Should be invoked in critical sections!! @@ -762,6 +777,16 @@ processmsg: msgdatafull = false; switch(type) { + case REQNOTIFYSTART: { + processmsg_req_notify_start(); + break; + } + + case NOTIFYSTART: { + processmsg_notify_start(); + break; + } + #ifdef TASK case TRANSOBJ: { // receive a object transfer msg diff --git a/Robust/src/Runtime/bamboo/multicoremsg.h b/Robust/src/Runtime/bamboo/multicoremsg.h index 03fa5c55..7f9fed18 100644 --- a/Robust/src/Runtime/bamboo/multicoremsg.h +++ b/Robust/src/Runtime/bamboo/multicoremsg.h @@ -16,7 +16,7 @@ int outmsgindex; int outmsglast; int outmsgleft; volatile bool isMsgHanging; - +volatile bool startflag; #define MSG_INDEXINC_I() \ msgdataindex = (msgdataindex + 1) & (BAMBOO_MSG_BUF_MASK) @@ -153,6 +153,8 @@ volatile bool isMsgHanging; */ typedef enum { MSGSTART = 0x0, // 0xD0 + REQNOTIFYSTART, + NOTIFYSTART, TRANSOBJ, // 0xD1 TRANSTALL, // 0xD2 LOCKREQUEST, // 0xD3 diff --git a/Robust/src/Runtime/bamboo/multicoreruntime.c b/Robust/src/Runtime/bamboo/multicoreruntime.c index 4d8e5f0e..73835dd3 100644 --- a/Robust/src/Runtime/bamboo/multicoreruntime.c +++ b/Robust/src/Runtime/bamboo/multicoreruntime.c @@ -753,13 +753,27 @@ inline void run(int argc, char** argv) { bool sendStall = false; bool isfirst = true; bool tocontinue = false; - + startflag = false; corenum = BAMBOO_GET_NUM_OF_CORE(); // initialize runtime data structures initruntimedata(); initCommunication(); + if (BAMBOO_NUM_OF_CORE==STARTUPCORE) { + numconfirm=NUMCORES-1; + for(int i=0;i