# HG changeset patch # User Merten Sach # Date 1315410305 -7200 # Node ID 24466227d8bbf0b251751edeb53e53248ada14b8 # Parent 11740002decf122703b2612afe5f2219df9f79df bugs fixed, code is now compiling diff -r 11740002decf -r 24466227d8bb MasterLoop.c --- a/MasterLoop.c Wed Sep 07 13:07:23 2011 +0200 +++ b/MasterLoop.c Wed Sep 07 17:45:05 2011 +0200 @@ -11,12 +11,19 @@ #include "VMS.h" #include "ProcrContext.h" -#include "Master_Request_Handlers.h" +#include "inter_VMS_request_handlers.h" //=========================================================================== void inline stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ, - VirtProcr *masterPr ); + VirtProcr *masterPr); + +void inline +handleInterMasterReq( InterMasterReqst *currReq, void *_semEnv, + VirtProcr *masterPr); + +void inline +handleInterVMSCoreReq( InterVMSCoreReqst *currReq, VirtProcr *masterPr); //=========================================================================== @@ -91,8 +98,6 @@ //First animation of each MasterVP will in turn animate this part // of setup code.. (VP creator sets up the stack as if this function // was called normally, but actually get here by jmp) - //So, setup values about stack ptr, jmp pt and all that - //masterPr->nextInstrPt = &&masterLoopStartPt; //Sept 2011 //Old code jumped directly to this point, but doesn't work on x64 @@ -123,12 +128,13 @@ semanticEnv = masterEnv->semanticEnv; //First, check for requests from other MasterVPs, and handle them - if( currReq = masterEnv->interMasterRequestsFor[thisCoresIdx] ) - { do - { handleInterMasterReq( currReq, semanticEnv, masterPr ); - } - while( currReq = currReq->nextReqst ); - } + InterMasterReqst* currReq = masterEnv->interMasterRequestsFor[thisCoresIdx]; + while(currReq) + { + handleInterMasterReq( currReq, semanticEnv, masterPr ); + currReq = currReq->nextReqst; + } + //Now, take care of the SlaveVPs //Go through the slots -- if Slave there newly suspended, handle its request // then, either way, ask assigner to fill each slot @@ -201,30 +207,33 @@ void inline handleInterMasterReq( InterMasterReqst *currReq, void *_semEnv, VirtProcr *masterPr ) - { switch( currReq->reqType ) - { case destVMSCore: - handleInterVMSCoreReq( (InterVMSCoreReqst *)currReq, masterPr); + { + + switch( currReq->reqType ) + { + case destVMSCore: + handleInterVMSCoreReq( (InterVMSCoreReqst *)currReq, masterPr); break; case destPlugin: - (*interPluginReqHdlr)( ((InterPluginReqst *)currReq)->pluginReq, - _semEnv ); - break; + _VMSMasterEnv->interPluginReqHdlr( ((InterPluginReqst *)currReq)->pluginReq, + _semEnv ); + break; default: break; } } void inline -handleInterVMSReq( InterVMSCoreReqst *currReq, VirtProcr *masterPr ) +handleInterVMSCoreReq( InterVMSCoreReqst *currReq, VirtProcr *masterPr ) { switch( currReq->reqType ) { case transfer_free_ptr: handleTransferFree( currReq, masterPr ); break; + default: + break; } - } - - +} /*Work Stealing Alg -- racy one *This algorithm has a race condition -- the coreloops are accessing their diff -r 11740002decf -r 24466227d8bb VMS.h --- a/VMS.h Wed Sep 07 13:07:23 2011 +0200 +++ b/VMS.h Wed Sep 07 17:45:05 2011 +0200 @@ -113,6 +113,7 @@ typedef struct _SchedSlot SchedSlot; typedef struct _VMSReqst VMSReqst; +typedef struct _VirtProcr VirtProcr; typedef struct _InterMasterReqst InterMasterReqst; typedef struct _IntervalProbe IntervalProbe; typedef struct _GateStruc GateStruc; @@ -189,28 +190,28 @@ transfer_free_ptr = 1 //avoid starting enums at 0, for debug reasons }; -typedef struct //Doing a trick to save space & time -- allocate space - { // for this, cast first as InterMaster then as this +//Doing a trick to save space & time -- allocate space +// for this, cast first as InterMaster then as this +typedef struct + { enum InterMasterReqstType reqType; //duplicate InterMasterReqst at top InterMasterReqst *nextReqst; enum InterVMSCoreReqType secondReqType; void *freePtr; //pile up fields, add as needed - } -InterVMSCoreReqst; - + } InterVMSCoreReqst; //This is for requests between plugins on different cores // Here, after casting, the pluginReq is extracted and handed to plugin -typedef struct //Doing a trick to save space & time -- allocate space - { // for this, cast first as InterMaster then as this +//Doing a trick to save space & time -- allocate space +// for this, cast first as InterMaster then as this +typedef struct + { enum InterMasterReqstType reqType; //copy InterMasterReqst at top InterMasterReqst *nextReqst; void *pluginReq; //plugin will cast to approp type - } -InterPluginReqst; - + } InterPluginReqst; //==================== Core data structures =================== @@ -270,7 +271,7 @@ RequestHandler requestHandler; SchedSlot ***allSchedSlots; - VMSQueueStruc **readyToAnimateQs; + VMSQueueStruc **readyToAnimateQs; VirtProcr **masterVPs; void *semanticEnv; @@ -287,27 +288,30 @@ GateStruc *workStealingGates[ NUM_CORES ]; //concurrent work-steal int32 workStealingLock; - int32 numProcrsCreated; //gives ordering to processor creation + InterMasterReqst* interMasterRequestsFor[NUM_CORES]; + RequestHandler interPluginReqHdlr; + + int32 numProcrsCreated; //gives ordering to processor creation //=========== MEASUREMENT STUFF ============= - IntervalProbe **intervalProbes; - PrivDynArrayInfo *dynIntervalProbesInfo; - HashTable *probeNameHashTbl; - int32 masterCreateProbeID; - float64 createPtInSecs; - Histogram **measHists; - PrivDynArrayInfo *measHistsInfo; + IntervalProbe **intervalProbes; + PrivDynArrayInfo *dynIntervalProbesInfo; + HashTable *probeNameHashTbl; + int32 masterCreateProbeID; + float64 createPtInSecs; + Histogram **measHists; + PrivDynArrayInfo *measHistsInfo; #ifdef MEAS__TIME_PLUGIN - Histogram *reqHdlrLowTimeHist; - Histogram *reqHdlrHighTimeHist; + Histogram *reqHdlrLowTimeHist; + Histogram *reqHdlrHighTimeHist; #endif #ifdef MEAS__TIME_MALLOC - Histogram *mallocTimeHist; - Histogram *freeTimeHist; + Histogram *mallocTimeHist; + Histogram *freeTimeHist; #endif #ifdef MEAS__TIME_MASTER_LOCK - Histogram *masterLockLowTimeHist; - Histogram *masterLockHighTimeHist; + Histogram *masterLockLowTimeHist; + Histogram *masterLockHighTimeHist; #endif } MasterEnv; diff -r 11740002decf -r 24466227d8bb inter_VMS_request_handlers.c --- a/inter_VMS_request_handlers.c Wed Sep 07 13:07:23 2011 +0200 +++ b/inter_VMS_request_handlers.c Wed Sep 07 17:45:05 2011 +0200 @@ -7,10 +7,10 @@ #include #include -#include "VMS/VMS.h" -#include "VMS/Queue_impl/PrivateQueue.h" -#include "VMS/Hash_impl/PrivateHash.h" -#include "VMS/vmalloc.h" +#include "VMS.h" +#include "Queue_impl/PrivateQueue.h" +#include "Hash_impl/PrivateHash.h" +#include "vmalloc.h" @@ -20,8 +20,8 @@ * chunk over. Simply call VMS__free here. */ inline void -handleTransferFree( MasterReq *masterReq, VirtProcr *masterPr ) +handleTransferFree( InterVMSCoreReqst *masterReq, VirtProcr *masterPr ) { - VMS__free( masterReq->ptrToFree ); + VMS__free( masterReq->freePtr ); } diff -r 11740002decf -r 24466227d8bb inter_VMS_request_handlers.h --- a/inter_VMS_request_handlers.h Wed Sep 07 13:07:23 2011 +0200 +++ b/inter_VMS_request_handlers.h Wed Sep 07 17:45:05 2011 +0200 @@ -16,7 +16,7 @@ */ inline void -handleTransferFree( MasterReq *masterReq, VirtProcr *masterPr ); +handleTransferFree( InterVMSCoreReqst *masterReq, VirtProcr *masterPr ); #endif /* _MASTER_REQ_H */