Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
changeset 127:24466227d8bb Inter-Master Requests
bugs fixed, code is now compiling
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Wed, 07 Sep 2011 17:45:05 +0200 |
| parents | 11740002decf |
| children | dbfc8382d546 |
| files | MasterLoop.c VMS.h inter_VMS_request_handlers.c inter_VMS_request_handlers.h |
| diffstat | 4 files changed, 65 insertions(+), 52 deletions(-) [+] |
line diff
1.1 --- a/MasterLoop.c Wed Sep 07 13:07:23 2011 +0200 1.2 +++ b/MasterLoop.c Wed Sep 07 17:45:05 2011 +0200 1.3 @@ -11,12 +11,19 @@ 1.4 1.5 #include "VMS.h" 1.6 #include "ProcrContext.h" 1.7 -#include "Master_Request_Handlers.h" 1.8 +#include "inter_VMS_request_handlers.h" 1.9 1.10 //=========================================================================== 1.11 void inline 1.12 stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ, 1.13 - VirtProcr *masterPr ); 1.14 + VirtProcr *masterPr); 1.15 + 1.16 +void inline 1.17 +handleInterMasterReq( InterMasterReqst *currReq, void *_semEnv, 1.18 + VirtProcr *masterPr); 1.19 + 1.20 +void inline 1.21 +handleInterVMSCoreReq( InterVMSCoreReqst *currReq, VirtProcr *masterPr); 1.22 1.23 //=========================================================================== 1.24 1.25 @@ -91,8 +98,6 @@ 1.26 //First animation of each MasterVP will in turn animate this part 1.27 // of setup code.. (VP creator sets up the stack as if this function 1.28 // was called normally, but actually get here by jmp) 1.29 - //So, setup values about stack ptr, jmp pt and all that 1.30 - //masterPr->nextInstrPt = &&masterLoopStartPt; 1.31 1.32 //Sept 2011 1.33 //Old code jumped directly to this point, but doesn't work on x64 1.34 @@ -123,12 +128,13 @@ 1.35 semanticEnv = masterEnv->semanticEnv; 1.36 1.37 //First, check for requests from other MasterVPs, and handle them 1.38 - if( currReq = masterEnv->interMasterRequestsFor[thisCoresIdx] ) 1.39 - { do 1.40 - { handleInterMasterReq( currReq, semanticEnv, masterPr ); 1.41 - } 1.42 - while( currReq = currReq->nextReqst ); 1.43 - } 1.44 + InterMasterReqst* currReq = masterEnv->interMasterRequestsFor[thisCoresIdx]; 1.45 + while(currReq) 1.46 + { 1.47 + handleInterMasterReq( currReq, semanticEnv, masterPr ); 1.48 + currReq = currReq->nextReqst; 1.49 + } 1.50 + 1.51 //Now, take care of the SlaveVPs 1.52 //Go through the slots -- if Slave there newly suspended, handle its request 1.53 // then, either way, ask assigner to fill each slot 1.54 @@ -201,30 +207,33 @@ 1.55 void inline 1.56 handleInterMasterReq( InterMasterReqst *currReq, void *_semEnv, 1.57 VirtProcr *masterPr ) 1.58 - { switch( currReq->reqType ) 1.59 - { case destVMSCore: 1.60 - handleInterVMSCoreReq( (InterVMSCoreReqst *)currReq, masterPr); 1.61 + { 1.62 + 1.63 + switch( currReq->reqType ) 1.64 + { 1.65 + case destVMSCore: 1.66 + handleInterVMSCoreReq( (InterVMSCoreReqst *)currReq, masterPr); 1.67 break; 1.68 case destPlugin: 1.69 - (*interPluginReqHdlr)( ((InterPluginReqst *)currReq)->pluginReq, 1.70 - _semEnv ); 1.71 - break; 1.72 + _VMSMasterEnv->interPluginReqHdlr( ((InterPluginReqst *)currReq)->pluginReq, 1.73 + _semEnv ); 1.74 + break; 1.75 default: 1.76 break; 1.77 } 1.78 } 1.79 1.80 void inline 1.81 -handleInterVMSReq( InterVMSCoreReqst *currReq, VirtProcr *masterPr ) 1.82 +handleInterVMSCoreReq( InterVMSCoreReqst *currReq, VirtProcr *masterPr ) 1.83 { 1.84 switch( currReq->reqType ) 1.85 { 1.86 case transfer_free_ptr: handleTransferFree( currReq, masterPr ); 1.87 break; 1.88 + default: 1.89 + break; 1.90 } 1.91 - } 1.92 - 1.93 - 1.94 +} 1.95 1.96 /*Work Stealing Alg -- racy one 1.97 *This algorithm has a race condition -- the coreloops are accessing their
2.1 --- a/VMS.h Wed Sep 07 13:07:23 2011 +0200 2.2 +++ b/VMS.h Wed Sep 07 17:45:05 2011 +0200 2.3 @@ -113,6 +113,7 @@ 2.4 2.5 typedef struct _SchedSlot SchedSlot; 2.6 typedef struct _VMSReqst VMSReqst; 2.7 +typedef struct _VirtProcr VirtProcr; 2.8 typedef struct _InterMasterReqst InterMasterReqst; 2.9 typedef struct _IntervalProbe IntervalProbe; 2.10 typedef struct _GateStruc GateStruc; 2.11 @@ -189,28 +190,28 @@ 2.12 transfer_free_ptr = 1 //avoid starting enums at 0, for debug reasons 2.13 }; 2.14 2.15 -typedef struct //Doing a trick to save space & time -- allocate space 2.16 - { // for this, cast first as InterMaster then as this 2.17 +//Doing a trick to save space & time -- allocate space 2.18 +// for this, cast first as InterMaster then as this 2.19 +typedef struct 2.20 + { 2.21 enum InterMasterReqstType reqType; //duplicate InterMasterReqst at top 2.22 InterMasterReqst *nextReqst; 2.23 2.24 enum InterVMSCoreReqType secondReqType; 2.25 void *freePtr; //pile up fields, add as needed 2.26 - } 2.27 -InterVMSCoreReqst; 2.28 - 2.29 + } InterVMSCoreReqst; 2.30 2.31 //This is for requests between plugins on different cores 2.32 // Here, after casting, the pluginReq is extracted and handed to plugin 2.33 -typedef struct //Doing a trick to save space & time -- allocate space 2.34 - { // for this, cast first as InterMaster then as this 2.35 +//Doing a trick to save space & time -- allocate space 2.36 +// for this, cast first as InterMaster then as this 2.37 +typedef struct 2.38 + { 2.39 enum InterMasterReqstType reqType; //copy InterMasterReqst at top 2.40 InterMasterReqst *nextReqst; 2.41 2.42 void *pluginReq; //plugin will cast to approp type 2.43 - } 2.44 -InterPluginReqst; 2.45 - 2.46 + } InterPluginReqst; 2.47 2.48 //==================== Core data structures =================== 2.49 2.50 @@ -270,7 +271,7 @@ 2.51 RequestHandler requestHandler; 2.52 2.53 SchedSlot ***allSchedSlots; 2.54 - VMSQueueStruc **readyToAnimateQs; 2.55 + VMSQueueStruc **readyToAnimateQs; 2.56 VirtProcr **masterVPs; 2.57 2.58 void *semanticEnv; 2.59 @@ -287,27 +288,30 @@ 2.60 GateStruc *workStealingGates[ NUM_CORES ]; //concurrent work-steal 2.61 int32 workStealingLock; 2.62 2.63 - int32 numProcrsCreated; //gives ordering to processor creation 2.64 + InterMasterReqst* interMasterRequestsFor[NUM_CORES]; 2.65 + RequestHandler interPluginReqHdlr; 2.66 + 2.67 + int32 numProcrsCreated; //gives ordering to processor creation 2.68 2.69 //=========== MEASUREMENT STUFF ============= 2.70 - IntervalProbe **intervalProbes; 2.71 - PrivDynArrayInfo *dynIntervalProbesInfo; 2.72 - HashTable *probeNameHashTbl; 2.73 - int32 masterCreateProbeID; 2.74 - float64 createPtInSecs; 2.75 - Histogram **measHists; 2.76 - PrivDynArrayInfo *measHistsInfo; 2.77 + IntervalProbe **intervalProbes; 2.78 + PrivDynArrayInfo *dynIntervalProbesInfo; 2.79 + HashTable *probeNameHashTbl; 2.80 + int32 masterCreateProbeID; 2.81 + float64 createPtInSecs; 2.82 + Histogram **measHists; 2.83 + PrivDynArrayInfo *measHistsInfo; 2.84 #ifdef MEAS__TIME_PLUGIN 2.85 - Histogram *reqHdlrLowTimeHist; 2.86 - Histogram *reqHdlrHighTimeHist; 2.87 + Histogram *reqHdlrLowTimeHist; 2.88 + Histogram *reqHdlrHighTimeHist; 2.89 #endif 2.90 #ifdef MEAS__TIME_MALLOC 2.91 - Histogram *mallocTimeHist; 2.92 - Histogram *freeTimeHist; 2.93 + Histogram *mallocTimeHist; 2.94 + Histogram *freeTimeHist; 2.95 #endif 2.96 #ifdef MEAS__TIME_MASTER_LOCK 2.97 - Histogram *masterLockLowTimeHist; 2.98 - Histogram *masterLockHighTimeHist; 2.99 + Histogram *masterLockLowTimeHist; 2.100 + Histogram *masterLockHighTimeHist; 2.101 #endif 2.102 } 2.103 MasterEnv;
3.1 --- a/inter_VMS_request_handlers.c Wed Sep 07 13:07:23 2011 +0200 3.2 +++ b/inter_VMS_request_handlers.c Wed Sep 07 17:45:05 2011 +0200 3.3 @@ -7,10 +7,10 @@ 3.4 #include <stdio.h> 3.5 #include <stdlib.h> 3.6 3.7 -#include "VMS/VMS.h" 3.8 -#include "VMS/Queue_impl/PrivateQueue.h" 3.9 -#include "VMS/Hash_impl/PrivateHash.h" 3.10 -#include "VMS/vmalloc.h" 3.11 +#include "VMS.h" 3.12 +#include "Queue_impl/PrivateQueue.h" 3.13 +#include "Hash_impl/PrivateHash.h" 3.14 +#include "vmalloc.h" 3.15 3.16 3.17 3.18 @@ -20,8 +20,8 @@ 3.19 * chunk over. Simply call VMS__free here. 3.20 */ 3.21 inline void 3.22 -handleTransferFree( MasterReq *masterReq, VirtProcr *masterPr ) 3.23 +handleTransferFree( InterVMSCoreReqst *masterReq, VirtProcr *masterPr ) 3.24 { 3.25 - VMS__free( masterReq->ptrToFree ); 3.26 + VMS__free( masterReq->freePtr ); 3.27 } 3.28
4.1 --- a/inter_VMS_request_handlers.h Wed Sep 07 13:07:23 2011 +0200 4.2 +++ b/inter_VMS_request_handlers.h Wed Sep 07 17:45:05 2011 +0200 4.3 @@ -16,7 +16,7 @@ 4.4 */ 4.5 4.6 inline void 4.7 -handleTransferFree( MasterReq *masterReq, VirtProcr *masterPr ); 4.8 +handleTransferFree( InterVMSCoreReqst *masterReq, VirtProcr *masterPr ); 4.9 4.10 4.11 #endif /* _MASTER_REQ_H */
