Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison VMS.h @ 233:a0ac58d8201c
cleaning -- more general rearrangement, moving things and adding comments
| author | Some Random Person <seanhalle@yahoo.com> |
|---|---|
| date | Fri, 16 Mar 2012 09:39:53 -0700 |
| parents | 421bde2a07d7 |
| children | 0ee1a3c8972d |
comparison
equal
deleted
inserted
replaced
| 113:6e60a66eef42 | 114:4ce93ecb5e1e |
|---|---|
| 27 #include "Defines/VMS_defs.h" | 27 #include "Defines/VMS_defs.h" |
| 28 | 28 |
| 29 | 29 |
| 30 //================================ Typedefs ================================= | 30 //================================ Typedefs ================================= |
| 31 // | 31 // |
| 32 typedef unsigned long long TSCount; | 32 typedef unsigned long long TSCount; |
| 33 typedef union | |
| 34 { uint32 lowHigh[2]; | |
| 35 uint64 longVal; | |
| 36 } | |
| 37 TSCountLowHigh; | |
| 38 | 33 |
| 39 typedef struct _SchedSlot SchedSlot; | 34 typedef struct _SchedSlot SchedSlot; |
| 40 typedef struct _VMSReqst VMSReqst; | 35 typedef struct _VMSReqst VMSReqst; |
| 41 typedef struct _SlaveVP SlaveVP; | 36 typedef struct _SlaveVP SlaveVP; |
| 42 typedef struct _MasterVP MasterVP; | 37 typedef struct _MasterVP MasterVP; |
| 52 //============================ HW Dependent Fns ================================ | 47 //============================ HW Dependent Fns ================================ |
| 53 | 48 |
| 54 #include "Hardware_Dependent/VMS__HW_measurement.h" | 49 #include "Hardware_Dependent/VMS__HW_measurement.h" |
| 55 #include "Hardware_Dependent/VMS__primitives.h" | 50 #include "Hardware_Dependent/VMS__primitives.h" |
| 56 | 51 |
| 57 //============================= Statistics ================================== | |
| 58 | |
| 59 inline TSCount getTSCount(); | |
| 60 | 52 |
| 61 //============= Request Related =========== | 53 //============= Request Related =========== |
| 62 // | 54 // |
| 63 | 55 |
| 64 enum VMSReqstType //avoid starting enums at 0, for debug reasons | 56 enum VMSReqstType //avoid starting enums at 0, for debug reasons |
| 111 int coreOfSlot; | 103 int coreOfSlot; |
| 112 SlotPerfInfo *perfInfo; //used by assigner to pick best slave for core | 104 SlotPerfInfo *perfInfo; //used by assigner to pick best slave for core |
| 113 }; | 105 }; |
| 114 //SchedSlot | 106 //SchedSlot |
| 115 | 107 |
| 116 /*WARNING: re-arranging this data structure could cause Slv switching | 108 /*This structure embodies the state of a slaveVP. It is reused for masterVP |
| 117 * assembly code to fail -- hard-codes offsets of fields | 109 * and shutdownVPs. |
| 118 */ | 110 */ |
| 119 struct _SlaveVP | 111 struct _SlaveVP |
| 120 { int slaveID; //each slave given a unique ID | 112 { //The offsets of these fields are hard-coded into assembly |
| 121 int coreAnimatedBy; | 113 void *stackPtr; //save the core's stack ptr when suspend |
| 122 void *startOfStack; | 114 void *framePtr; //save core's frame ptr when suspend |
| 123 void *stackPtr; | 115 void *resumeInstrPtr; //save core's program-counter when suspend |
| 124 void *framePtr; | |
| 125 void *resumeInstrPtr; | |
| 126 | |
| 127 void *coreCtlrStartPt; //allows proto-runtime to be linked later | |
| 128 void *coreCtlrFramePtr; //restore before jmp back to core controller | 116 void *coreCtlrFramePtr; //restore before jmp back to core controller |
| 129 void *coreCtlrStackPtr; //restore before jmp back to core controller | 117 void *coreCtlrStackPtr; //restore before jmp back to core controller |
| 130 | 118 |
| 131 SchedSlot *schedSlot; | 119 //============ below this, no fields are used in asm ============= |
| 132 VMSReqst *requests; | 120 int slaveID; //each slave given a globally unique ID |
| 133 | 121 int coreAnimatedBy; |
| 134 void *semanticData; //this is live for the life of Slv | 122 void *startOfStack; //used to free, and to point slave to Fn |
| 135 void *dataRetFromReq;//Used to return vals from plugin to Wrapper Lib | 123 |
| 124 //for comm -- between master and coreCtlr & btwn wrapper lib and plugin | |
| 125 SchedSlot *schedSlotAssignedTo; | |
| 126 VMSReqst *requests; //wrapper lib puts in requests, plugin takes out | |
| 127 void *dataRetFromReq;//Return vals from plugin to Wrapper Lib | |
| 128 | |
| 129 //Slave used as carrier for data | |
| 130 void *semanticData; //Lang saves lang-specific things in slave here | |
| 136 | 131 |
| 137 //=========== MEASUREMENT STUFF ========== | 132 //=========== MEASUREMENT STUFF ========== |
| 138 MEAS__Insert_Meas_Fields_into_Slave; | 133 MEAS__Insert_Meas_Fields_into_Slave; |
| 139 //======================================== | 134 //======================================== |
| 140 | 135 |
| 141 float64 createPtInSecs; //have space but don't use on some configs | 136 float64 createPtInSecs; //have space but don't use on some configs |
| 142 }; | 137 }; |
| 143 //SlaveVP | 138 //SlaveVP |
| 144 | 139 |
| 145 /*The one and only global variable, holds many odds and ends | 140 |
| 141 /* The one and only global variable, holds many odds and ends | |
| 146 */ | 142 */ |
| 147 typedef struct | 143 typedef struct |
| 148 { //The offsets of these fields are hard-coded into assembly | 144 { //The offsets of these fields are hard-coded into assembly |
| 149 void *coreCtlrReturnPt; //offset of field used in asm | 145 void *coreCtlrReturnPt; //offset of field used in asm |
| 150 int32 masterLock __align_to_cacheline__; //used in asm | 146 int32 masterLock __align_to_cacheline__; //used in asm |
| 151 | 147 |
| 152 //============ below this, no asm uses the field offsets ============= | 148 //============ below this, no fields are used in asm ============= |
| 153 | 149 |
| 154 //Basic VMS infrastructure | 150 //Basic VMS infrastructure |
| 155 SlaveVP **masterVPs; | 151 SlaveVP **masterVPs; |
| 156 SchedSlot ***allSchedSlots; | 152 SchedSlot ***allSchedSlots; |
| 157 | 153 |
| 212 | 208 |
| 213 //============================= Global Vars ================================ | 209 //============================= Global Vars ================================ |
| 214 | 210 |
| 215 volatile MasterEnv *_VMSMasterEnv __align_to_cacheline__; | 211 volatile MasterEnv *_VMSMasterEnv __align_to_cacheline__; |
| 216 | 212 |
| 213 //these are global, but only used for startup and shutdown | |
| 217 pthread_t coreCtlrThdHandles[ NUM_CORES ]; //pthread's virt-procr state | 214 pthread_t coreCtlrThdHandles[ NUM_CORES ]; //pthread's virt-procr state |
| 218 ThdParams *coreCtlrThdParams [ NUM_CORES ]; | 215 ThdParams *coreCtlrThdParams [ NUM_CORES ]; |
| 219 | 216 |
| 220 pthread_mutex_t suspendLock; | 217 pthread_mutex_t suspendLock; |
| 221 pthread_cond_t suspendCond; | 218 pthread_cond_t suspendCond; |
| 222 | 219 |
| 223 //========================= Function Prototypes =========================== | 220 //========================= Function Prototypes =========================== |
| 224 | 221 /* MEANING OF WL PI SS int VMSOS |
| 225 /* MEANING OF WL PI SS int | |
| 226 * These indicate which places the function is safe to use. They stand for: | 222 * These indicate which places the function is safe to use. They stand for: |
| 227 * WL: Wrapper Library | 223 * |
| 228 * PI: Plugin | 224 * WL Wrapper Library -- wrapper lib code should only use these |
| 229 * SS: Startup and Shutdown | 225 * PI Plugin -- plugin code should only use these |
| 230 * int: internal to the VMS implementation | 226 * SS Startup and Shutdown -- designates these relate to startup & shutdown |
| 227 * int internal to VMS -- should not be used in wrapper lib or plugin | |
| 228 * VMSOS means "OS functions for applications to use" | |
| 229 * | |
| 230 * VMS_int__ functions touch internal VMS data structs and are only safe | |
| 231 * to be used inside the master lock. However, occasionally, they appear | |
| 232 * in wrapper-lib or plugin code. In those cases, very careful analysis | |
| 233 * has been done to be sure no concurrency issues could arise. | |
| 234 * | |
| 235 * VMS_WL__ functions are all safe for use outside the master lock. | |
| 236 * | |
| 237 * VMSOS are only safe for applications to use -- they're like a second | |
| 238 * language mixed in -- but they can't be used inside plugin code, and | |
| 239 * aren't meant for use in wrapper libraries, because they are themselves | |
| 240 * wrapper-library calls! | |
| 231 */ | 241 */ |
| 232 | 242 //========== Startup and shutdown ========== |
| 233 //========== Setup and shutdown ========== | |
| 234 void | 243 void |
| 235 VMS_SS__init(); | 244 VMS_SS__init(); |
| 236 | 245 |
| 237 void | 246 void |
| 238 VMS_SS__start_the_work_then_wait_until_done(); | 247 VMS_SS__start_the_work_then_wait_until_done(); |
