Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VCilk_impls > VCilk__MC_shared_impl
comparison VCilk.h @ 4:96420af6b7e8
Nov15 vers for PLDI Fixed bug in create procr & added plugin time-meas
| author | Me |
|---|---|
| date | Tue, 16 Nov 2010 15:59:23 +0100 |
| parents | b456b67cddd0 |
| children | 5494943ed3a4 |
comparison
equal
deleted
inserted
replaced
| 0:af723d75ab3d | 1:9a507043fbff |
|---|---|
| 11 | 11 |
| 12 #include "VMS/Queue_impl/PrivateQueue.h" | 12 #include "VMS/Queue_impl/PrivateQueue.h" |
| 13 #include "VMS/Hash_impl/PrivateHash.h" | 13 #include "VMS/Hash_impl/PrivateHash.h" |
| 14 #include "VMS/VMS.h" | 14 #include "VMS/VMS.h" |
| 15 | 15 |
| 16 | |
| 17 | |
| 16 /*This header defines everything specific to the VCilk semantic plug-in | 18 /*This header defines everything specific to the VCilk semantic plug-in |
| 17 */ | 19 */ |
| 20 | |
| 21 //=========================================================================== | |
| 22 #define NUM_STRUCS_IN_SEM_ENV 1000 | |
| 23 | |
| 24 //=========================================================================== | |
| 18 typedef struct _VCilkSemReq VCilkSemReq; | 25 typedef struct _VCilkSemReq VCilkSemReq; |
| 26 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master | |
| 27 | |
| 28 //=========================================================================== | |
| 19 | 29 |
| 20 | 30 |
| 21 /*Semantic layer-specific data sent inside a request from lib called in app | 31 /*Semantic layer-specific data sent inside a request from lib called in app |
| 22 * to request handler called in MasterLoop | 32 * to request handler called in MasterLoop |
| 23 */ | 33 */ |
| 24 enum VCilkReqType | 34 enum VCilkReqType |
| 25 { | 35 { |
| 26 syncReq = 1, | 36 syncReq = 1, |
| 27 mallocReq, | 37 mallocReq, |
| 28 freeReq | 38 freeReq, |
| 39 singleton, | |
| 40 atomic, | |
| 41 trans_start, | |
| 42 trans_end | |
| 29 }; | 43 }; |
| 30 | 44 |
| 31 struct _VCilkSemReq | 45 struct _VCilkSemReq |
| 32 { enum VCilkReqType reqType; | 46 { enum VCilkReqType reqType; |
| 33 VirtProcr *requestingPr; | 47 VirtProcr *requestingPr; |
| 48 | |
| 34 int32 sizeToMalloc; | 49 int32 sizeToMalloc; |
| 35 void *ptrToFree; | 50 void *ptrToFree; |
| 51 | |
| 36 VirtProcrFnPtr fnPtr; | 52 VirtProcrFnPtr fnPtr; |
| 37 void *initData; | 53 void *initData; |
| 38 int32 coreToSpawnOnto; | 54 int32 coreToSpawnOnto; |
| 55 | |
| 56 int32 singletonID; | |
| 57 void *endJumpPt; | |
| 58 | |
| 59 PtrToAtomicFn fnToExecInMaster; | |
| 60 void *dataForFn; | |
| 61 | |
| 62 int32 transID; | |
| 39 } | 63 } |
| 40 /* VCilkSemReq */; | 64 /* VCilkSemReq */; |
| 65 | |
| 66 typedef struct | |
| 67 { | |
| 68 VirtProcr *VPCurrentlyExecuting; | |
| 69 PrivQueueStruc *waitingVPQ; | |
| 70 } | |
| 71 VCilkTrans; | |
| 41 | 72 |
| 42 typedef struct | 73 typedef struct |
| 43 { | 74 { |
| 44 PrivQueueStruc **readyVPQs; | 75 PrivQueueStruc **readyVPQs; |
| 45 HashTable *commHashTbl; | 76 HashTable *commHashTbl; |
| 46 int32 numVirtPr; | 77 int32 numVirtPr; |
| 47 int32 nextCoreToGetNewPr; | 78 int32 nextCoreToGetNewPr; |
| 48 int32 primitiveStartTime; | 79 int32 primitiveStartTime; |
| 80 | |
| 81 //fix limit on num with dynArray | |
| 82 int32 singletonHasBeenExecutedFlags[NUM_STRUCS_IN_SEM_ENV]; | |
| 83 VCilkTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV]; | |
| 49 } | 84 } |
| 50 VCilkSemEnv; | 85 VCilkSemEnv; |
| 51 | 86 |
| 87 typedef struct _TransListElem TransListElem; | |
| 88 struct _TransListElem | |
| 89 { | |
| 90 int32 transID; | |
| 91 TransListElem *nextTrans; | |
| 92 }; | |
| 93 //TransListElem | |
| 94 | |
| 52 typedef struct | 95 typedef struct |
| 53 { | 96 { |
| 54 int32 syncPending; | 97 int32 syncPending; |
| 55 int32 numLiveChildren; | 98 int32 numLiveChildren; |
| 56 VirtProcr *parentPr; | 99 VirtProcr *parentPr; |
| 100 | |
| 101 int32 highestTransEntered; | |
| 102 TransListElem *lastTransEntered; | |
| 57 } | 103 } |
| 58 VCilkSemData; | 104 VCilkSemData; |
| 59 | 105 |
| 60 //=========================================================================== | 106 //=========================================================================== |
| 61 | 107 |
| 78 | 124 |
| 79 void | 125 void |
| 80 VCilk__init(); | 126 VCilk__init(); |
| 81 | 127 |
| 82 void | 128 void |
| 83 VCilk__cleanup_after_shutdown(); | 129 VCilk__cleanup_at_end_of_shutdown(); |
| 84 | 130 |
| 85 //======================= | 131 //======================= |
| 86 | 132 |
| 87 void inline | 133 void inline |
| 88 VCilk__spawn( int32 coreToSpawnOnto, VirtProcrFnPtr fnPtr, | 134 VCilk__spawn( int32 coreToSpawnOnto, VirtProcrFnPtr fnPtr, |
| 101 VCilk__free( void *ptrToFree, VirtProcr *animPr ); | 147 VCilk__free( void *ptrToFree, VirtProcr *animPr ); |
| 102 | 148 |
| 103 void | 149 void |
| 104 VCilk__dissipate_procr( VirtProcr *procrToDissipate ); | 150 VCilk__dissipate_procr( VirtProcr *procrToDissipate ); |
| 105 | 151 |
| 106 //======================= | 152 |
| 153 //======================= Concurrency Stuff ====================== | |
| 154 void | |
| 155 VCilk__start_singleton( int32 singletonID, void *endSingletonLabelAddr, | |
| 156 VirtProcr *animPr ); | |
| 107 | 157 |
| 108 void | 158 void |
| 109 VCilk__free_semantic_request( VCilkSemReq *semReq ); | 159 VCilk__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster, |
| 160 void *data, VirtProcr *animPr ); | |
| 161 | |
| 162 void | |
| 163 VCilk__start_transaction( int32 transactionID, VirtProcr *animPr ); | |
| 164 | |
| 165 void | |
| 166 VCilk__end_transaction( int32 transactionID, VirtProcr *animPr ); | |
| 110 | 167 |
| 111 | 168 |
| 112 //========================= Internal use only ============================= | 169 //========================= Internal use only ============================= |
| 113 void | 170 void |
| 114 VCilk__Request_Handler( VirtProcr *requestingPr, void *_semEnv ); | 171 VCilk__Request_Handler( VirtProcr *requestingPr, void *_semEnv ); |
