Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison VMS.h @ 120:d4c881c7f03a
Added fn to send inter-master requests, and cleaned up code
| author | Me@portablequad |
|---|---|
| date | Sat, 03 Sep 2011 20:41:51 -0700 |
| parents | efb55f1b5fb9 |
| children | 24466227d8bb |
comparison
equal
deleted
inserted
replaced
| 46:1fd39103fbf1 | 54:1ecbcb5e6626 |
|---|---|
| 111 //=========================================================================== | 111 //=========================================================================== |
| 112 typedef unsigned long long TSCount; | 112 typedef unsigned long long TSCount; |
| 113 | 113 |
| 114 typedef struct _SchedSlot SchedSlot; | 114 typedef struct _SchedSlot SchedSlot; |
| 115 typedef struct _VMSReqst VMSReqst; | 115 typedef struct _VMSReqst VMSReqst; |
| 116 typedef struct _VirtProcr VirtProcr; | 116 typedef struct _InterMasterReqst InterMasterReqst; |
| 117 typedef struct _IntervalProbe IntervalProbe; | 117 typedef struct _IntervalProbe IntervalProbe; |
| 118 typedef struct _GateStruc GateStruc; | 118 typedef struct _GateStruc GateStruc; |
| 119 | 119 |
| 120 | 120 |
| 121 typedef VirtProcr * (*SlaveScheduler) ( void *, int ); //semEnv, coreIdx | 121 typedef VirtProcr * (*SlaveScheduler) ( void *, int ); //semEnv, coreIdx |
| 126 | 126 |
| 127 | 127 |
| 128 //============= Requests =========== | 128 //============= Requests =========== |
| 129 // | 129 // |
| 130 | 130 |
| 131 enum VMSReqstType //avoid starting enums at 0, for debug reasons | 131 //VMS Request is the carrier for Slave to Master requests |
| 132 { | 132 // it has an embedded sub-type request that is pulled out |
| 133 semantic = 1, | 133 // inside the plugin's request handler |
| 134 enum VMSReqstType //For Slave->Master requests | |
| 135 { | |
| 136 semantic = 1, //avoid starting enums at 0, for debug reasons | |
| 134 createReq, | 137 createReq, |
| 135 dissipate, | 138 dissipate, |
| 136 VMSSemantic //goes with VMSSemReqst below | 139 VMSSemantic //goes with VMSSemReqst below |
| 137 }; | 140 }; |
| 138 | 141 |
| 143 | 146 |
| 144 VMSReqst *nextReqst; | 147 VMSReqst *nextReqst; |
| 145 }; | 148 }; |
| 146 //VMSReqst | 149 //VMSReqst |
| 147 | 150 |
| 151 //This is a sub-type of Slave->Master requests. | |
| 152 // It's for Slaves to invoke built-in VMS-core functions that have language-like | |
| 153 // behavior. | |
| 148 enum VMSSemReqstType //These are equivalent to semantic requests, but for | 154 enum VMSSemReqstType //These are equivalent to semantic requests, but for |
| 149 { // VMS's services available directly to app, like OS | 155 { // VMS's services available directly to app, like OS |
| 150 createProbe = 1, // and probe services -- like a VMS-wide built-in lang | 156 createProbe = 1, // and probe services -- like a VMS-wide built-in lang |
| 151 openFile, | 157 openFile, |
| 152 otherIO | 158 otherIO |
| 155 typedef struct | 161 typedef struct |
| 156 { enum VMSSemReqstType reqType; | 162 { enum VMSSemReqstType reqType; |
| 157 VirtProcr *requestingPr; | 163 VirtProcr *requestingPr; |
| 158 char *nameStr; //for create probe | 164 char *nameStr; //for create probe |
| 159 } | 165 } |
| 160 VMSSemReq; | 166 VMSSemReq; |
| 167 | |
| 168 //These are for Master to Master requests | |
| 169 // They get re-cast to the appropriate sub-type of request | |
| 170 enum InterMasterReqstType //For Master->Master | |
| 171 { | |
| 172 destVMSCore = 1, //avoid starting enums at 0, for debug reasons | |
| 173 destPlugin | |
| 174 }; | |
| 175 | |
| 176 struct _InterMasterReqst //Doing a trick to save space & time -- allocate | |
| 177 { // space for a sub-type then cast first as InterMaster then as sub-type | |
| 178 enum InterMasterReqstType reqType; | |
| 179 InterMasterReqst *nextReqst; | |
| 180 }; | |
| 181 //InterMasterReqst (defined above in typedef block) | |
| 182 | |
| 183 | |
| 184 //These are a sub-type of InterMaster requests. The inter-master req gets | |
| 185 // re-cast to be of this type, after checking | |
| 186 //This ones for requests between internals of VMS-core.. such as malloc | |
| 187 enum InterVMSCoreReqType | |
| 188 { | |
| 189 transfer_free_ptr = 1 //avoid starting enums at 0, for debug reasons | |
| 190 }; | |
| 191 | |
| 192 typedef struct //Doing a trick to save space & time -- allocate space | |
| 193 { // for this, cast first as InterMaster then as this | |
| 194 enum InterMasterReqstType reqType; //duplicate InterMasterReqst at top | |
| 195 InterMasterReqst *nextReqst; | |
| 196 | |
| 197 enum InterVMSCoreReqType secondReqType; | |
| 198 void *freePtr; //pile up fields, add as needed | |
| 199 } | |
| 200 InterVMSCoreReqst; | |
| 201 | |
| 202 | |
| 203 //This is for requests between plugins on different cores | |
| 204 // Here, after casting, the pluginReq is extracted and handed to plugin | |
| 205 typedef struct //Doing a trick to save space & time -- allocate space | |
| 206 { // for this, cast first as InterMaster then as this | |
| 207 enum InterMasterReqstType reqType; //copy InterMasterReqst at top | |
| 208 InterMasterReqst *nextReqst; | |
| 209 | |
| 210 void *pluginReq; //plugin will cast to approp type | |
| 211 } | |
| 212 InterPluginReqst; | |
| 161 | 213 |
| 162 | 214 |
| 163 //==================== Core data structures =================== | 215 //==================== Core data structures =================== |
| 164 | 216 |
| 165 struct _SchedSlot | 217 struct _SchedSlot |
| 207 float64 createPtInSecs; //have space but don't use on some configs | 259 float64 createPtInSecs; //have space but don't use on some configs |
| 208 }; | 260 }; |
| 209 //VirtProcr | 261 //VirtProcr |
| 210 | 262 |
| 211 | 263 |
| 212 /*WARNING: re-arranging this data structure could cause VP-switching | 264 /*Master Env is the only global variable -- has entry points for any other |
| 213 * assembly code to fail -- hard-codes offsets of fields | 265 * data needed. |
| 214 * (because -O3 messes with things otherwise) | |
| 215 */ | 266 */ |
| 216 typedef struct | 267 typedef struct |
| 217 { | 268 { |
| 218 SlaveScheduler slaveScheduler; | 269 SlaveScheduler slaveScheduler; |
| 219 RequestHandler requestHandler; | 270 RequestHandler requestHandler; |
| 366 VMS__send_dissipate_req( VirtProcr *prToDissipate ); | 417 VMS__send_dissipate_req( VirtProcr *prToDissipate ); |
| 367 | 418 |
| 368 inline void | 419 inline void |
| 369 VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr ); | 420 VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr ); |
| 370 | 421 |
| 422 | |
| 423 void inline | |
| 424 VMS__send_inter_plugin_req( void *reqData, int32 targetMaster, | |
| 425 VirtProcr *requestingMaster ); | |
| 426 void inline | |
| 427 VMS__send_inter_VMSCore_req( InterVMSCoreReqst *reqData, int32 targetMaster, | |
| 428 VirtProcr *requestingMaster ); | |
| 429 | |
| 371 VMSReqst * | 430 VMSReqst * |
| 372 VMS__take_next_request_out_of( VirtProcr *procrWithReq ); | 431 VMS__take_next_request_out_of( VirtProcr *procrWithReq ); |
| 373 | 432 |
| 374 inline void * | 433 inline void * |
| 375 VMS__take_sem_reqst_from( VMSReqst *req ); | 434 VMS__take_sem_reqst_from( VMSReqst *req ); |
