Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison PR.h @ 261:dafae55597ce
Getting closer -- added PRServ as built-in langlet (but still just copy)
about to rework a lot of the Master code.. possibly eliminate core controller
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Tue, 23 Oct 2012 23:46:17 -0700 |
| parents | 999f2966a3e5 |
| children | a5fa1e087c7e |
comparison
equal
deleted
inserted
replaced
| 0:b13e745dfc18 | 1:a716ed044c8d |
|---|---|
| 30 | 30 |
| 31 //================================ Typedefs ================================= | 31 //================================ Typedefs ================================= |
| 32 // | 32 // |
| 33 typedef unsigned long long TSCount; | 33 typedef unsigned long long TSCount; |
| 34 | 34 |
| 35 typedef struct _AnimSlot AnimSlot; | 35 typedef struct _AnimSlot AnimSlot; |
| 36 typedef struct _PRReqst PRReqst; | 36 typedef struct _PRReqst PRReqst; |
| 37 typedef struct _SlaveVP SlaveVP; | 37 typedef struct _SlaveVP SlaveVP; |
| 38 typedef struct _MasterVP MasterVP; | 38 typedef struct _MasterVP MasterVP; |
| 39 typedef struct _IntervalProbe IntervalProbe; | 39 typedef struct _IntervalProbe IntervalProbe; |
| 40 typedef struct _PRMetaTask PRMetaTask; | |
| 40 | 41 |
| 41 | 42 |
| 42 typedef SlaveVP *(*SlaveAssigner) ( void *, AnimSlot*); //semEnv, slot for HW info | 43 typedef SlaveVP *(*SlaveAssigner) ( void *, AnimSlot*); //semEnv, slot for HW info |
| 43 typedef void (*RequestHandler) ( SlaveVP *, void * ); //prWReqst, semEnv | 44 typedef void (*RequestHandler) ( SlaveVP *, void * ); //prWReqst, semEnv |
| 45 typedef void (*IndivReqHandler)( SlaveVP *, void * ); //prWReqst, semEnv | |
| 44 typedef void (*TopLevelFnPtr) ( void *, SlaveVP * ); //initData, animSlv | 46 typedef void (*TopLevelFnPtr) ( void *, SlaveVP * ); //initData, animSlv |
| 45 typedef void TopLevelFn ( void *, SlaveVP * ); //initData, animSlv | 47 typedef void TopLevelFn ( void *, SlaveVP * ); //initData, animSlv |
| 46 typedef void (*ResumeSlvFnPtr) ( SlaveVP *, void * ); | 48 typedef void (*ResumeSlvFnPtr) ( SlaveVP *, void * ); |
| 47 //=========== MEASUREMENT STUFF ========== | 49 //=========== MEASUREMENT STUFF ========== |
| 48 MEAS__Insert_Counter_Handler | 50 MEAS__Insert_Counter_Handler |
| 55 | 57 |
| 56 | 58 |
| 57 //============= Request Related =========== | 59 //============= Request Related =========== |
| 58 // | 60 // |
| 59 | 61 |
| 60 enum PRReqstType //avoid starting enums at 0, for debug reasons | 62 enum PRReqstType //avoid starting enums at 0, for debug reasons |
| 61 { | 63 { |
| 62 semantic = 1, | 64 TaskCreate = 1, |
| 63 createReq, | 65 TaskEnd, |
| 64 dissipate, | 66 SlvCreate, |
| 65 PRSemantic //goes with PRSemReqst below | 67 SlvDissipate, |
| 68 Language, | |
| 69 Service, //To invoke a PR provided equivalent of a language request (ex: probe) | |
| 70 Hardware, | |
| 71 IO, | |
| 72 OSCall | |
| 66 }; | 73 }; |
| 67 | 74 |
| 68 struct _PRReqst | 75 struct _PRReqst |
| 69 { | 76 { |
| 70 enum PRReqstType reqType;//used for dissipate and in future for IO requests | 77 enum PRReqstType reqType;//used for special forms that have PR behavior |
| 71 void *semReqData; | 78 void *semReq; |
| 72 | 79 PRProcess *processReqIsIn; |
| 80 int32 langMagicNumber; | |
| 81 PRMetaTask *metaTask; | |
| 82 TopLevelFn topLevelFn; | |
| 83 void *initData; | |
| 84 int32 *ID; | |
| 85 | |
| 86 //The request handling structure is a bit messy.. for special forms, | |
| 87 // such as create and dissipate, the language inserts pointer to handler | |
| 88 // fn directly into the request.. might change to this for all requests | |
| 89 IndivReqHandler handler; //pointer to handler fn for create, dissip, etc | |
| 90 | |
| 73 PRReqst *nextReqst; | 91 PRReqst *nextReqst; |
| 74 }; | 92 }; |
| 75 //PRReqst | 93 //PRReqst |
| 76 | 94 |
| 77 enum PRSemReqstType //These are equivalent to semantic requests, but for | 95 enum PRServReqType //These are equivalent to semantic requests, but for |
| 78 { // PR's services available directly to app, like OS | 96 { // PR's services available directly to app, like OS |
| 79 make_probe = 1, // and probe services -- like a PR-wide built-in lang | 97 make_probe = 1, // and probe services -- like a PR-wide built-in lang |
| 80 throw_excp, | 98 throw_excp, |
| 81 openFile, | 99 openFile, |
| 82 otherIO | 100 otherIO |
| 83 }; | 101 }; |
| 84 | 102 |
| 85 typedef struct | 103 typedef struct |
| 86 { enum PRSemReqstType reqType; | 104 { enum PRServReqType reqType; |
| 87 SlaveVP *requestingSlv; | 105 SlaveVP *requestingSlv; |
| 88 char *nameStr; //for create probe | 106 char *nameStr; //for create probe |
| 89 char *msgStr; //for exception | 107 char *msgStr; //for exception |
| 90 void *exceptionData; | 108 void *exceptionData; |
| 91 } | 109 } |
| 92 PRSemReq; | 110 PRServReq; |
| 93 | 111 |
| 94 | 112 |
| 95 //==================== Core data structures =================== | 113 //==================== Core data structures =================== |
| 96 | 114 |
| 97 typedef struct | 115 typedef struct |
| 112 }; | 130 }; |
| 113 //AnimSlot | 131 //AnimSlot |
| 114 | 132 |
| 115 enum VPtype | 133 enum VPtype |
| 116 { TaskSlotSlv = 1,//Slave tied to an anim slot, only animates tasks | 134 { TaskSlotSlv = 1,//Slave tied to an anim slot, only animates tasks |
| 117 TaskExtraSlv, //When a suspended task ends, the slave becomes this | 135 TaskFreeSlv, //When a suspended task ends, the slave becomes this |
| 118 PersistentSlv, //the VP is explicitly seen in the app code, or task suspends | 136 GenericSlv, //the VP is explicitly seen in the app code, or task suspends |
| 119 Slave, //to be removed | |
| 120 Master, | 137 Master, |
| 121 Shutdown, | 138 Shutdown, |
| 122 Idle | 139 Idle |
| 123 }; | 140 }; |
| 124 | 141 |
| 133 void *coreCtlrFramePtr; //restore before jmp back to core controller | 150 void *coreCtlrFramePtr; //restore before jmp back to core controller |
| 134 void *coreCtlrStackPtr; //restore before jmp back to core controller | 151 void *coreCtlrStackPtr; //restore before jmp back to core controller |
| 135 | 152 |
| 136 //============ below this, no fields are used in asm ============= | 153 //============ below this, no fields are used in asm ============= |
| 137 | 154 |
| 155 void *startOfStack; //used to free, and to point slave to Fn | |
| 156 PRProcess *processSlaveIsIn; | |
| 157 PRMetaTask *metaTask; | |
| 158 enum VPtype typeOfVP; //Slave vs Master vs Shutdown.. | |
| 138 int slaveID; //each slave given a globally unique ID | 159 int slaveID; //each slave given a globally unique ID |
| 139 int coreAnimatedBy; | 160 int coreAnimatedBy; |
| 140 void *startOfStack; //used to free, and to point slave to Fn | 161 int numTimesAssignedToASlot; //Each assign is for one work-unit, so is an ID |
| 141 enum VPtype typeOfVP; //Slave vs Master vs Shutdown.. | |
| 142 int assignCount; //Each assign is for one work-unit, so IDs it | |
| 143 //note, a scheduling decision is uniquely identified by the triple: | 162 //note, a scheduling decision is uniquely identified by the triple: |
| 144 // <slaveID, coreAnimatedBy, assignCount> -- used in record & replay | 163 // <slaveID, coreAnimatedBy, numTimesAssignedToASlot> -- used in record & replay |
| 145 | 164 |
| 146 //for comm -- between master and coreCtlr & btwn wrapper lib and plugin | 165 //for comm -- between master and coreCtlr & btwn wrapper lib and plugin |
| 147 AnimSlot *animSlotAssignedTo; | 166 AnimSlot *animSlotAssignedTo; |
| 148 PRReqst *request; //wrapper lib puts in requests, plugin takes out | 167 PRReqst *request; //wrapper lib puts in requests, plugin takes out |
| 149 void *dataRetFromReq;//Return vals from plugin to Wrapper Lib | 168 void *dataRetFromReq;//Return vals from plugin to Wrapper Lib |
| 150 | 169 |
| 151 //For using Slave as carrier for data | 170 //For language specific data that needs to be in the slave |
| 152 void *semanticData; //Lang saves lang-specific things in slave here | 171 void *semanticData; //Lang saves lang-specific things in slave here |
| 153 | 172 |
| 173 //Task related stuff | |
| 174 bool needsTaskAssigned; | |
| 175 | |
| 154 //=========== MEASUREMENT STUFF ========== | 176 //=========== MEASUREMENT STUFF ========== |
| 155 MEAS__Insert_Meas_Fields_into_Slave; | 177 MEAS__Insert_Meas_Fields_into_Slave; |
| 156 float64 createPtInSecs; //time VP created, in seconds | 178 float64 createPtInSecs; //time VP created, in seconds |
| 157 //======================================== | 179 //======================================== |
| 158 }; | 180 }; |
| 170 //============ below this, no fields are used in asm ============= | 192 //============ below this, no fields are used in asm ============= |
| 171 | 193 |
| 172 //Basic PR infrastructure | 194 //Basic PR infrastructure |
| 173 SlaveVP **masterVPs; | 195 SlaveVP **masterVPs; |
| 174 AnimSlot ***allAnimSlots; | 196 AnimSlot ***allAnimSlots; |
| 175 | 197 |
| 176 //plugin related | 198 PRProcess **processes; |
| 177 PRSemEnv **langlets; | 199 |
| 178 | 200 //move to processEnv //Slave creation -- global count of slaves existing, across langs and processes |
| 179 //Slave creation -- global count of slaves existing, across langs and processes | |
| 180 int32 numSlavesCreated; //used to give unique ID to processor | 201 int32 numSlavesCreated; //used to give unique ID to processor |
| 181 //no reasonable way to do fail-safe when have mult langlets and processes.. have to detect for each langlet separately | 202 int32 numTasksCreated; //to give unique ID to a task |
| 182 // int32 numSlavesAlive; //used to detect fail-safe shutdown | |
| 183 | 203 |
| 184 //Initialization related | 204 //Initialization related |
| 185 int32 setupComplete; //use while starting up coreCtlr | 205 int32 setupComplete; //use while starting up coreCtlr |
| 186 | 206 |
| 187 //Memory management related | 207 //Memory management related |
| 190 | 210 |
| 191 //Random number seeds -- random nums used in various places | 211 //Random number seeds -- random nums used in various places |
| 192 uint32_t seed1; | 212 uint32_t seed1; |
| 193 uint32_t seed2; | 213 uint32_t seed2; |
| 194 | 214 |
| 215 These_Prob_belong_in_PRPRocess; | |
| 216 // SlaveVP *slotTaskSlvs[NUM_CORES][NUM_ANIM_SLOTS]; | |
| 217 // int32 numLiveFreeTaskSlvs; | |
| 218 // int32 numLiveThreadSlvs; | |
| 219 // bool32 *coreIsDone; | |
| 220 // int32 numCoresDone; | |
| 221 | |
| 222 // SlaveVP* idleSlv[NUM_CORES][NUM_ANIM_SLOTS]; | |
| 223 // int shutdownInitiated; | |
| 224 | |
| 195 //=========== MEASUREMENT STUFF ============= | 225 //=========== MEASUREMENT STUFF ============= |
| 196 IntervalProbe **intervalProbes; | 226 IntervalProbe **intervalProbes; |
| 197 PtrToPrivDynArray *dynIntervalProbesInfo; | 227 PrivDynArrayInfo *dynIntervalProbesInfo; |
| 198 HashTable *probeNameHashTbl; | 228 HashTable *probeNameHashTbl; |
| 199 int32 masterCreateProbeID; | 229 int32 masterCreateProbeID; |
| 200 float64 createPtInSecs; //real-clock time PR initialized | 230 float64 createPtInSecs; //real-clock time PR initialized |
| 201 Histogram **measHists; | 231 Histogram **measHists; |
| 202 PtrToPrivDynArray *measHistsInfo; | 232 PrivDynArrayInfo *measHistsInfo; |
| 203 MEAS__Insert_Susp_Meas_Fields_into_MasterEnv; | 233 MEAS__Insert_Susp_Meas_Fields_into_MasterEnv; |
| 204 MEAS__Insert_Master_Meas_Fields_into_MasterEnv; | 234 MEAS__Insert_Master_Meas_Fields_into_MasterEnv; |
| 205 MEAS__Insert_Master_Lock_Meas_Fields_into_MasterEnv; | 235 MEAS__Insert_Master_Lock_Meas_Fields_into_MasterEnv; |
| 206 MEAS__Insert_Malloc_Meas_Fields_into_MasterEnv; | 236 MEAS__Insert_Malloc_Meas_Fields_into_MasterEnv; |
| 207 MEAS__Insert_Plugin_Meas_Fields_into_MasterEnv; | 237 MEAS__Insert_Plugin_Meas_Fields_into_MasterEnv; |
| 211 } | 241 } |
| 212 MasterEnv; | 242 MasterEnv; |
| 213 | 243 |
| 214 //===================== | 244 //===================== |
| 215 typedef struct | 245 typedef struct |
| 216 { int32 langletID; //acts as index into array of langlets in master env | 246 { int32 langMagicNumber; //indexes into hash array of semEnvs in PRProcess |
| 217 void *langletSemEnv; | 247 PRSemEnv *chainedSemEnv; //chains to semEnvs with same hash |
| 218 int32 langMagicNumber; | 248 void *langSemEnv; |
| 219 SlaveAssigner slaveAssigner; | 249 |
| 220 RequestHandler requestHandler; | 250 SlaveAssigner slaveAssigner; |
| 221 EndTaskHandler endTaskHandler; | 251 RequestHandler requestHdlr; |
| 222 | 252 |
| 223 //Tack slaves created, separately for each langlet (in each process) | 253 RequestHandler createTaskHdlr; |
| 224 int32 numSlavesCreated; //gives ordering to processor creation | 254 RequestHandler endTaskHdlr; |
| 225 int32 numSlavesAlive; //used to detect fail-safe shutdown | 255 RequestHandler createSlaveHdlr; |
| 256 RequestHandler dissipateSlaveHdlr; | |
| 257 RequestHandler semDataCreator; | |
| 258 RequestHandler semDataInitializer; | |
| 259 | |
| 260 | |
| 261 //Track slaves created, separately for each langlet? (in each process) | |
| 262 // int32 numSlavesCreated; //gives ordering to processor creation | |
| 263 // int32 numSlavesAlive; //used to detect fail-safe shutdown | |
| 226 | 264 |
| 227 //when multi-lang, master polls sem env's to find one with work in it.. | 265 //when multi-lang, master polls sem env's to find one with work in it.. |
| 228 // in single-lang case, flag ignored, master always asks lang for work | 266 // in single-lang case, flag ignored, master always asks lang for work |
| 229 int32 hasWork; | 267 int32 hasWork; |
| 230 } | 268 } |
| 231 PRSemEnv; | 269 PRSemEnv; |
| 232 | 270 |
| 233 //===================== Top Processor level Data Strucs ====================== | 271 //The semantic env of every langlet must start with these two fields, so that |
| 234 typedef struct | 272 // PR can cast the void * to this struct, in order to access these two fields |
| 273 typedef struct | |
| 274 { int32 langMagicNumber; | |
| 275 PRSemEnv *protoSemEnv; | |
| 276 } | |
| 277 PRLangSemEnv; | |
| 278 | |
| 279 //can cast any langlet's sem env to one of these, so PR can access values | |
| 280 typedef struct | |
| 281 { int32 langMagicNumber; | |
| 282 PRSemEnv *protoSemEnv; | |
| 283 } | |
| 284 PRServSemEnv; | |
| 285 | |
| 286 enum PRTaskType | |
| 287 { GenericSlave = 1, | |
| 288 AtomicTask, | |
| 289 SuspendedTask | |
| 290 }; | |
| 291 | |
| 292 struct _PRMetaTask | |
| 235 { | 293 { |
| 236 | 294 PRTaskType taskType; |
| 237 } | 295 RequestHandler reqHandler; //Lang-specific hdlr for create, end, etc |
| 238 PRProcess; | 296 int32 *taskID; //is standard PR ID |
| 297 SlaveVP *slaveAssignedTo; //no valid until task animated | |
| 298 TopLevelFn topLevelFn; //This is the Fn executes as the task | |
| 299 void *initData; //The data taken by the function | |
| 300 void *langMetaTask; | |
| 301 | |
| 302 //NOTE: info needed for "wait" functionality is inside lang's metaTask | |
| 303 }; | |
| 304 //PRMetaTask | |
| 305 | |
| 306 /*The language's meta task is cast to this struct, inside PR, then the | |
| 307 * back pointer to protoMetaTask is set. Keeps existence of PRMetaTask hidden | |
| 308 * from plugin -- so can change later. | |
| 309 */ | |
| 310 typedef struct | |
| 311 { int32 langMagicNumber; | |
| 312 PRMetaTask *protoMetaTask; | |
| 313 } | |
| 314 PRLangMetaTask; | |
| 315 | |
| 316 typedef struct | |
| 317 { | |
| 318 void (*freeFn)(void *); | |
| 319 } | |
| 320 PRSemDataTemplate; | |
| 321 | |
| 322 typedef struct | |
| 323 { PRSemDataTemplate **semDatas; | |
| 324 PRSemDataTemplate **semDatasIter; | |
| 325 int32 numSemDatas; | |
| 326 } | |
| 327 PRSemDataHolder; | |
| 328 //===================== Top Process level Data Strucs ====================== | |
| 329 | |
| 239 /*This structure holds all the information PR needs to manage a program. PR | 330 /*This structure holds all the information PR needs to manage a program. PR |
| 240 * stores information about what percent of CPU time the program is getting, | 331 * stores information about what percent of CPU time the program is getting, |
| 241 * | 332 * |
| 242 */ | 333 */ |
| 243 typedef struct | 334 typedef struct |
| 244 { //void *semEnv; | 335 { |
| 245 //RequestHdlrFnPtr requestHandler; | 336 PRSemEnv semEnvs[NUM_SEM_ENVS_IN_PROCESS]; //used as a hash table |
| 246 //SlaveAssignerFnPtr slaveAssigner; | 337 PRSemEnv semEnvList[NUM_SEM_ENVS_IN_PROCESS]; //lines up the semEnvs, so can iterate through |
| 247 int32 numSlavesLive; | 338 int32 numSemEnvs; //must be less than num sem envs.. used to iterate through |
| 248 void *resultToReturn; | 339 |
| 340 int32 numLiveGenericSlaves; | |
| 341 int32 numLiveFreeTaskSlaves; | |
| 342 int32 numLiveTasks; | |
| 343 bool32 coreIsDone[NUM_CORES][CACHE_LINE_SZ]; //Fixes false sharing | |
| 344 | |
| 345 void *resultToReturn; | |
| 249 | 346 |
| 250 SlaveVP *seedSlv; | 347 SlaveVP *seedSlv; |
| 251 | 348 |
| 252 //These are used to coordinate within the main function..? | 349 //These are used to coord with OS thread waiting for process to end |
| 253 bool32 executionIsComplete; | 350 bool32 executionIsComplete; |
| 254 pthread_mutex_t doneLock; //? not sure need these..? | 351 pthread_mutex_t doneLock; |
| 255 pthread_cond_t doneCond; | 352 pthread_cond_t doneCond; |
| 256 } | 353 } |
| 257 PRProcess; | 354 PRProcess; |
| 258 | 355 |
| 259 | 356 |
| 278 } | 375 } |
| 279 ThdParams; | 376 ThdParams; |
| 280 | 377 |
| 281 //============================= Global Vars ================================ | 378 //============================= Global Vars ================================ |
| 282 | 379 |
| 283 volatile MasterEnv *_PRMasterEnv __align_to_cacheline__; | 380 volatile MasterEnv *_PRTopEnv __align_to_cacheline__; |
| 284 | 381 |
| 285 //these are global, but only used for startup and shutdown | 382 //these are global, but only used for startup and shutdown |
| 286 pthread_t coreCtlrThdHandles[ NUM_CORES ]; //pthread's virt-procr state | 383 pthread_t coreCtlrThdHandles[ NUM_CORES ]; //pthread's virt-procr state |
| 287 ThdParams *coreCtlrThdParams [ NUM_CORES ]; | 384 ThdParams *coreCtlrThdParams [ NUM_CORES ]; |
| 288 | 385 |
| 313 */ | 410 */ |
| 314 //========== Startup and shutdown ========== | 411 //========== Startup and shutdown ========== |
| 315 void | 412 void |
| 316 PR__start(); | 413 PR__start(); |
| 317 | 414 |
| 318 void | |
| 319 PR_SS__start_the_work_then_wait_until_done(); | |
| 320 | |
| 321 SlaveVP* | 415 SlaveVP* |
| 322 PR_SS__create_shutdown_slave(); | 416 PR_SS__create_shutdown_slave(); |
| 323 | 417 |
| 324 void | 418 void |
| 325 PR_SS__shutdown(); | 419 PR_SS__shutdown(); |
| 326 | 420 |
| 327 void | 421 void |
| 328 PR_SS__cleanup_at_end_of_shutdown(); | 422 PR_SS__cleanup_at_end_of_shutdown(); |
| 329 | 423 |
| 330 void | 424 void |
| 331 PR_SS__register_langlets_semEnv( PRSemEnv *semEnv, int32 VSs_MAGIC_NUMBER, | 425 PR_SS__register_langlets_semEnv( PRSemEnv *semEnv, SlaveVP *seedVP, int32 VSs_MAGIC_NUMBER ); |
| 332 SlaveVP *seedVP ); | |
| 333 | 426 |
| 334 | 427 |
| 335 //============== =============== | 428 //============== =============== |
| 336 | 429 |
| 337 inline SlaveVP * | 430 inline SlaveVP * |
| 338 PR_int__create_slaveVP( TopLevelFnPtr fnPtr, void *dataParam ); | 431 PR_int__create_slaveVP( TopLevelFnPtr fnPtr, void *dataParam ); |
| 339 #define PR_PI__create_slaveVP PR_int__create_slaveVP | 432 #define PR_PI__create_slaveVP PR_int__create_slaveVP |
| 340 #define PR_WL__create_slaveVP PR_int__create_slaveVP | 433 #define PR_WL__create_slaveVP PR_int__create_slaveVP |
| 341 | 434 |
| 342 //Use this to create processor inside entry point & other places outside | 435 inline |
| 343 // the PR system boundary (IE, don't animate with a SlaveVP or MasterVP) | |
| 344 SlaveVP * | 436 SlaveVP * |
| 345 PR_ext__create_slaveVP( TopLevelFnPtr fnPtr, void *dataParam ); | 437 PR_int__create_slot_slave(); |
| 346 | 438 |
| 347 inline SlaveVP * | 439 inline |
| 440 SlaveVP * | |
| 348 PR_int__create_slaveVP_helper( SlaveVP *newSlv, TopLevelFnPtr fnPtr, | 441 PR_int__create_slaveVP_helper( SlaveVP *newSlv, TopLevelFnPtr fnPtr, |
| 349 void *dataParam, void *stackLocs ); | 442 void *dataParam, void *stackLocs ); |
| 350 | 443 |
| 351 inline void | 444 inline |
| 445 PRMetaTask * | |
| 446 PR_int__create_generic_slave_meta_task( void *initData ); | |
| 447 | |
| 448 inline | |
| 449 void | |
| 352 PR_int__reset_slaveVP_to_TopLvlFn( SlaveVP *slaveVP, TopLevelFnPtr fnPtr, | 450 PR_int__reset_slaveVP_to_TopLvlFn( SlaveVP *slaveVP, TopLevelFnPtr fnPtr, |
| 353 void *dataParam); | 451 void *dataParam); |
| 354 | 452 |
| 355 inline void | 453 inline |
| 454 void | |
| 356 PR_int__point_slaveVP_to_OneParamFn( SlaveVP *slaveVP, void *fnPtr, | 455 PR_int__point_slaveVP_to_OneParamFn( SlaveVP *slaveVP, void *fnPtr, |
| 357 void *param); | 456 void *param); |
| 358 | 457 |
| 359 inline void | 458 inline |
| 459 void | |
| 360 PR_int__point_slaveVP_to_TwoParamFn( SlaveVP *slaveVP, void *fnPtr, | 460 PR_int__point_slaveVP_to_TwoParamFn( SlaveVP *slaveVP, void *fnPtr, |
| 361 void *param1, void *param2); | 461 void *param1, void *param2); |
| 362 | 462 |
| 463 inline | |
| 363 void | 464 void |
| 364 PR_int__dissipate_slaveVP( SlaveVP *slaveToDissipate ); | 465 PR_int__dissipate_slaveVP( SlaveVP *slaveToDissipate ); |
| 365 #define PR_PI__dissipate_slaveVP PR_int__dissipate_slaveVP | 466 #define PR_PI__dissipate_slaveVP PR_int__dissipate_slaveVP |
| 366 //WL: dissipate a SlaveVP by sending a request | 467 //WL: dissipate a SlaveVP by sending a request |
| 367 | 468 |
| 368 void | 469 inline |
| 369 PR_ext__dissipate_slaveVP( SlaveVP *slaveToDissipate ); | 470 void |
| 370 | 471 PR_int__dissipate_slaveVP_multilang( SlaveVP *slaveToDissipate ); |
| 472 | |
| 473 inline | |
| 371 void | 474 void |
| 372 PR_int__throw_exception( char *msgStr, SlaveVP *reqstSlv, PRExcp *excpData ); | 475 PR_int__throw_exception( char *msgStr, SlaveVP *reqstSlv, PRExcp *excpData ); |
| 373 #define PR_PI__throw_exception PR_int__throw_exception | 476 #define PR_PI__throw_exception PR_int__throw_exception |
| 374 void | 477 void |
| 375 PR_WL__throw_exception( char *msgStr, SlaveVP *reqstSlv, PRExcp *excpData ); | 478 PR_WL__throw_exception( char *msgStr, SlaveVP *reqstSlv, PRExcp *excpData ); |
| 376 #define PR_App__throw_exception PR_WL__throw_exception | 479 #define PR_App__throw_exception PR_WL__throw_exception |
| 377 | 480 |
| 481 inline | |
| 378 void * | 482 void * |
| 379 PR_int__give_sem_env_for( SlaveVP *animSlv ); | 483 PR_int__give_sem_env_for_slave( SlaveVP *slave, int32 magicNumber ); |
| 380 #define PR_PI__give_sem_env_for PR_int__give_sem_env_for | 484 #define PR_PI__give_sem_env_for PR_int__give_sem_env_for_slave |
| 381 #define PR_SS__give_sem_env_for PR_int__give_sem_env_for | 485 #define PR_SS__give_sem_env_for_slave PR_int__give_sem_env_for_slave |
| 382 //No WL version -- not safe! if use in WL, be sure data rd & wr is stable | 486 //No WL version -- not safe! if use env in WL, be sure data rd & wr is stable |
| 383 | 487 inline |
| 488 PRSemEnv * | |
| 489 PR_int__give_proto_sem_env_for_slave( SlaveVP *slave, int32 magicNumber ); | |
| 490 #define PR_PI__give_proto_sem_env_for PR_int__give_proto_sem_env_for_slave | |
| 491 #define PR_SS__give_proto_sem_env_for_slave PR_int__give_proto_sem_env_for_slave | |
| 492 //No WL version -- not safe! if use env in WL, be sure data rd & wr is stable | |
| 493 inline | |
| 494 void * | |
| 495 PR_int__give_sem_env_from_process( PRProcess *process, int32 magicNumer ); | |
| 496 #define PR_PI__give_sem_env_from_process PR_int__give_sem_env_from_process | |
| 497 #define PR_SS__give_sem_env_from_process PR_int__give_sem_env_from_process | |
| 498 //#define PR_WL__give_sem_env_from_process PR_int__give_sem_env_from_process | |
| 499 //No WL version -- not safe! if use env in WL, be sure data rd & wr is stable | |
| 500 | |
| 501 inline | |
| 502 void * | |
| 503 PR_int__give_sem_data( SlaveVP *slave, int32 magicNumer ); | |
| 504 #define PR_PI__give_sem_data PR_int__give_sem_data | |
| 505 #define PR_SS__give_sem_data PR_int__give_sem_data | |
| 506 #define PR_WL__give_sem_data PR_int__give_sem_data | |
| 507 | |
| 508 | |
| 509 #define PR_int__give_lang_meta_task( slave, magicNumber )\ | |
| 510 slave->metaTask->langMetaTask; | |
| 511 #define PR_PI__give_lang_meta_task PR_int__give_lang_meta_task | |
| 512 #define PR_SS__give_lang_meta_task PR_int__give_lang_meta_task | |
| 513 #define PR_WL__give_lang_meta_task PR_int__give_lang_meta_task | |
| 514 | |
| 515 inline | |
| 516 SlaveVP * | |
| 517 PR_PI__give_slave_assigned_to( PRLangMetaTask *langMetaTask ); | |
| 518 | |
| 519 void | |
| 520 idle_fn(void* data, SlaveVP *animatingSlv); | |
| 384 | 521 |
| 385 inline void | 522 inline void |
| 386 PR_int__get_master_lock(); | 523 PR_int__get_master_lock(); |
| 387 | 524 |
| 388 #define PR_int__release_master_lock() _PRMasterEnv->masterLock = UNLOCKED | 525 #define PR_int__release_master_lock() _PRTopEnv->masterLock = UNLOCKED |
| 389 | 526 |
| 390 inline uint32_t | 527 inline uint32_t |
| 391 PR_int__randomNumber(); | 528 PR_int__randomNumber(); |
| 392 | 529 |
| 393 //============== Request Related =============== | 530 //============== Request Related =============== |
| 394 | 531 |
| 395 void | 532 void |
| 396 PR_int__suspend_slaveVP_and_send_req( SlaveVP *callingSlv ); | 533 PR_WL__suspend_slaveVP_and_send_req( SlaveVP *callingSlv ); |
| 397 | 534 |
| 398 inline void | 535 inline void |
| 399 PR_WL__add_sem_request_in_mallocd_PRReqst( void *semReqData, SlaveVP *callingSlv ); | 536 PR_WL__add_sem_request_in_mallocd_PRReqst( void *semReqData, SlaveVP *callingSlv ); |
| 400 | 537 |
| 401 inline void | 538 inline void |
| 402 PR_WL__send_sem_request( void *semReqData, SlaveVP *callingSlv ); | 539 PR_WL__send_sem_request( void *semReq, SlaveVP *callingSlv, int32 magicNum ); |
| 403 | 540 |
| 404 void | 541 void |
| 405 PR_WL__send_create_slaveVP_req( void *semReqData, SlaveVP *reqstingSlv ); | 542 PR_WL__send_create_slaveVP_req( void *semReqData, SlaveVP *reqstingSlv ); |
| 406 | 543 |
| 407 void inline | 544 void inline |
| 408 PR_WL__send_dissipate_req( SlaveVP *prToDissipate ); | 545 PR_WL__send_dissipate_req( SlaveVP *prToDissipate ); |
| 409 | 546 |
| 410 inline void | 547 inline void |
| 411 PR_WL__send_PRSem_request( void *semReqData, SlaveVP *callingSlv ); | 548 PR_WL__send_service_request( void *semReqData, SlaveVP *callingSlv ); |
| 412 | 549 |
| 413 PRReqst * | 550 PRReqst * |
| 414 PR_PI__take_next_request_out_of( SlaveVP *slaveWithReq ); | 551 PR_PI__take_next_request_out_of( SlaveVP *slaveWithReq ); |
| 415 //#define PR_PI__take_next_request_out_of( slave ) slave->requests | 552 //#define PR_PI__take_next_request_out_of( slave ) slave->requests |
| 416 | 553 |
| 417 //inline void * | 554 //inline void * |
| 418 //PR_PI__take_sem_reqst_from( PRReqst *req ); | 555 //PR_PI__take_sem_reqst_from( PRReqst *req ); |
| 419 #define PR_PI__take_sem_reqst_from( req ) req->semReqData | 556 #define PR_PI__take_sem_reqst_from( req ) req->semReqData |
| 420 | 557 |
| 421 void inline | 558 void inline |
| 422 PR_PI__handle_PRSemReq( PRReqst *req, SlaveVP *requestingSlv, void *semEnv, | 559 PR_int__handle_PRServiceReq( PRReqst *req, SlaveVP *requestingSlv, void *semEnv, |
| 423 ResumeSlvFnPtr resumeSlvFnPtr ); | 560 ResumeSlvFnPtr resumeSlvFnPtr ); |
| 424 | 561 |
| 425 //======================== MEASUREMENT ====================== | 562 //======================== MEASUREMENT ====================== |
| 426 uint64 | 563 uint64 |
| 427 PR_WL__give_num_plugin_cycles(); | 564 PR_WL__give_num_plugin_cycles(); |
| 432 //========================= Utilities ======================= | 569 //========================= Utilities ======================= |
| 433 inline char * | 570 inline char * |
| 434 PR_int__strDup( char *str ); | 571 PR_int__strDup( char *str ); |
| 435 | 572 |
| 436 | 573 |
| 574 //========================= PR request handlers ======================== | |
| 575 void inline | |
| 576 handleMakeProbe( PRServReq *semReq, void *semEnv, ResumeSlvFnPtr resumeFn ); | |
| 577 | |
| 578 void inline | |
| 579 handleThrowException( PRServReq *semReq, void *semEnv, ResumeSlvFnPtr resumeFn ); | |
| 580 //======================================================================= | |
| 581 | |
| 437 //========================= Probes ======================= | 582 //========================= Probes ======================= |
| 438 #include "Services_Offered_by_PR/Measurement_and_Stats/probes.h" | 583 #include "Services_Offered_by_PR/Measurement_and_Stats/probes.h" |
| 439 | 584 |
| 440 //================================================ | 585 //================================================ |
| 441 #endif /* _PR_H */ | 586 #endif /* _PR_H */ |
