# HG changeset patch # User Sean Halle # Date 1362749661 28800 # Node ID 2fc69e6c14eac85925eaf0d2a7889f7e4b82e6f0 # Parent 1d7ea1b0f1762c0a2697e878fd4a5c5f0942aa76 Dev_ML -- works in both sequential and concurrent modes diff -r 1d7ea1b0f176 -r 2fc69e6c14ea AnimationMaster.c --- a/AnimationMaster.c Mon Mar 04 00:40:38 2013 -0800 +++ b/AnimationMaster.c Fri Mar 08 05:34:21 2013 -0800 @@ -74,9 +74,11 @@ if( slot->workIsDone ) { slot->workIsDone = FALSE; slot->needsWorkAssigned = TRUE; +printf("top handle request: %d | reqType: %d\n", slot->coreSlotIsOn, (int32)req->reqType );fflush(stdin); //An Idle VP has no request to handle, so skip to assign.. - if( slot->slaveAssignedToSlot->typeOfVP != IdleVP ) + if( slot->slaveAssignedToSlot->typeOfVP != IdleVP && + slot->slaveAssignedToSlot->typeOfVP != ShutdownVP) { HOLISTIC__Record_AppResponder_start; //TODO: update to check which process for each slot MEAS__startReqHdlr; @@ -93,7 +95,8 @@ //Handle task create and end first -- they're special cases.. switch( req->reqType ) - { case TaskEnd: + { + case TaskEnd: { //do PR handler, which calls lang's hdlr and does recycle of // free task slave if needed -- PR handler checks for free task Slv PRHandle__EndTask( req, slave ); break; @@ -121,6 +124,11 @@ MEAS__endReqHdlr; HOLISTIC__Record_AppResponder_end; }//if not idleVP + else if( slot->slaveAssignedToSlot->typeOfVP == ShutdownVP ) + { //ShutdownVP used, essentially, as a flag, to cause terminate here + PR_int__release_master_lock(); + terminateCoreCtlr( slot->slaveAssignedToSlot ); + } } //if have request to be handled //NOTE: IF statement is leftover from when master managed many slots diff -r 1d7ea1b0f176 -r 2fc69e6c14ea CoreController.c --- a/CoreController.c Mon Mar 04 00:40:38 2013 -0800 +++ b/CoreController.c Fri Mar 08 05:34:21 2013 -0800 @@ -121,7 +121,7 @@ HOLISTIC__CoreCtrl_Setup; - DEBUG__printf1(TRUE, "started coreCtrlr", thisCoresIdx ); + DEBUG__printf1(TRUE, "started coreCtrlr %d", thisCoresIdx ); //====================== The Core Controller ====================== while(1) @@ -180,7 +180,6 @@ { numTriesToGetLock = 0; pthread_yield(); } } //while( currVP == NULL ) MEAS__Capture_Post_Master_Lock_Point; - //have master lock, perform master function, which manages request // handling and assigning work to this core's slot foundWork = @@ -214,7 +213,7 @@ terminateCoreCtlr(SlaveVP *currSlv) { //first, free shutdown Slv that jumped here, then end the pthread - PR_int__recycle_slaveVP( currSlv ); +// PR_int__free_slaveVP( currSlv ); pthread_exit( NULL ); } diff -r 1d7ea1b0f176 -r 2fc69e6c14ea PR.c --- a/PR.c Mon Mar 04 00:40:38 2013 -0800 +++ b/PR.c Fri Mar 08 05:34:21 2013 -0800 @@ -160,12 +160,14 @@ return process; } +void PR__end_seedVP( SlaveVP *seedSlv ) { PR_WL__send_end_slave_req( NULL, (RequestHandler)&PRServ__handleDissipateSeed, seedSlv, PRServ_MAGIC_NUMBER ); } +void PR__end_process_from_inside( SlaveVP *seedSlv ) { PR_WL__send_lang_request( NULL, (RequestHandler)&PRServ__handle_end_process_from_inside, diff -r 1d7ea1b0f176 -r 2fc69e6c14ea PR__SS.c --- a/PR__SS.c Mon Mar 04 00:40:38 2013 -0800 +++ b/PR__SS.c Fri Mar 08 05:34:21 2013 -0800 @@ -401,7 +401,8 @@ SlaveVP *shutDownSlv; AnimSlot **animSlots; //create the shutdown processors, one for each core controller -- put them - // directly into the Q -- each core will die when gets one + // directly into the slots + PR_int__get_master_lock(); for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) { //Note, this is running in the master shutDownSlv = PR_SS__create_shutdown_slave(); @@ -409,20 +410,22 @@ // shut down slave into first animulng slot. animSlots = _PRTopEnv->allAnimSlots[ coreIdx ]; animSlots[0]->slaveAssignedToSlot = shutDownSlv; - animSlots[0]->needsWorkAssigned = FALSE; - shutDownSlv->coreAnimatedBy = coreIdx; - shutDownSlv->animSlotAssignedTo = animSlots[ 0 ]; + animSlots[0]->workIsDone = TRUE; + animSlots[0]->needsWorkAssigned = FALSE; + shutDownSlv->coreAnimatedBy = coreIdx; + shutDownSlv->animSlotAssignedTo = animSlots[ 0 ]; } + PR_int__release_master_lock(); } -SlaveVP* PR_SS__create_shutdown_slave() +SlaveVP* PR_SS__create_shutdown_slave(int32 coreNum) { SlaveVP* shutdownVP; - shutdownVP = PR_int__create_slaveVP_helper( &endOSThreadFn, NULL ); - shutdownVP->typeOfVP = ShutdownVP; - + shutdownVP = PR_int__create_slaveVP_helper( &idle_fn, NULL ); + shutdownVP->typeOfVP = ShutdownVP; + return shutdownVP; } @@ -494,6 +497,7 @@ #ifdef DEBUG__TURN_ON_SEQUENTIAL_MODE asmTerminateCoreCtlrSeq(animatingSlv); #else + return; asmTerminateCoreCtlr(animatingSlv); #endif } diff -r 1d7ea1b0f176 -r 2fc69e6c14ea PR__WL.c --- a/PR__WL.c Mon Mar 04 00:40:38 2013 -0800 +++ b/PR__WL.c Fri Mar 08 05:34:21 2013 -0800 @@ -239,7 +239,7 @@ PR_WL__throw_exception( char *msgStr, SlaveVP *reqstSlv, PRExcp *excpData ) { PRReqst req; PRServiceReq langReq; - + printf("exception"); req.reqType = Language; req.langReq = &langReq; req.nextReqst = reqstSlv->request; //gab any other preceeding diff -r 1d7ea1b0f176 -r 2fc69e6c14ea PR__int.c --- a/PR__int.c Mon Mar 04 00:40:38 2013 -0800 +++ b/PR__int.c Fri Mar 08 05:34:21 2013 -0800 @@ -709,7 +709,7 @@ PRCollElem **coll; //Note using size of a pointer to a coll element int32 numBytes = sizeof(int32) + numInColl * sizeof(PRCollElem *); - prolog = PR_WL__malloc( numBytes ); + prolog = PR_int__malloc( numBytes ); //operation of collection relies upon initial entries being NULL memset(prolog, ZERO, numBytes>>2); //BUG: if size not multiple of 4 diff -r 1d7ea1b0f176 -r 2fc69e6c14ea PR__structs.h --- a/PR__structs.h Mon Mar 04 00:40:38 2013 -0800 +++ b/PR__structs.h Fri Mar 08 05:34:21 2013 -0800 @@ -121,17 +121,17 @@ enum PRReqstType //avoid starting enums at 0, for debug reasons { TaskCreate = 1, - TaskEnd, - SlvCreate, - SlvDissipate, - Language, - Service, //To invoke a PR provided equivalent of a language request (ex: probe) - Hardware, - IO, - OSCall, - LangShutdown, - ProcessEnd, - PRShutdown + TaskEnd = 2, + SlvCreate = 3, + SlvDissipate = 4, + Language = 5, + Service = 6, //To invoke a PR provided equivalent of a language request (ex: probe) + Hardware = 7, + IO = 8, + OSCall = 9, + LangShutdown = 10, + ProcessEnd = 11, + PRShutdown = 12 };