Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
diff SSR.h @ 17:bf57b83019e5
Added atomic fn exec, singleton, trans start and end and fixed bus (contd)
Fixed double-free of waiting requests bug
Fixed place didn't clone in request handling
Changed malloc and free handler prototypes
| author | Me |
|---|---|
| date | Tue, 02 Nov 2010 16:57:45 -0700 |
| parents | 6c6d7fbd7e25 |
| children | cee3eecc5c22 |
line diff
1.1 --- a/SSR.h Thu Oct 14 17:06:28 2010 -0700 1.2 +++ b/SSR.h Tue Nov 02 16:57:45 2010 -0700 1.3 @@ -13,10 +13,17 @@ 1.4 #include "VMS/Hash_impl/PrivateHash.h" 1.5 #include "VMS/VMS.h" 1.6 1.7 + 1.8 +//=========================================================================== 1.9 + 1.10 +#define NUM_STRUCS_IN_SEM_ENV 1000 1.11 + 1.12 +//=========================================================================== 1.13 /*This header defines everything specific to the SSR semantic plug-in 1.14 */ 1.15 typedef struct _SSRSemReq SSRSemReq; 1.16 - 1.17 +typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master 1.18 +//=========================================================================== 1.19 1.20 /*Semantic layer-specific data sent inside a request from lib called in app 1.21 * to request handler called in MasterLoop 1.22 @@ -29,19 +36,48 @@ 1.23 receive_type, // and receive_any first of the receives -- Handlers 1.24 receive_from_to,// rely upon this ordering of enum 1.25 transfer_to, 1.26 - transfer_out 1.27 + transfer_out, 1.28 + malloc_req, 1.29 + free_req, 1.30 + singleton, 1.31 + atomic, 1.32 + trans_start, 1.33 + trans_end 1.34 }; 1.35 1.36 struct _SSRSemReq 1.37 { enum SSRReqType reqType; 1.38 - VirtProcr *sendPr; 1.39 - VirtProcr *receivePr; 1.40 - int32 msgType; 1.41 - void *msg; 1.42 + VirtProcr *sendPr; 1.43 + VirtProcr *receivePr; 1.44 + int32 msgType; 1.45 + void *msg; 1.46 SSRSemReq *nextReqInHashEntry; 1.47 + 1.48 + void *initData; 1.49 + VirtProcrFnPtr fnPtr; 1.50 + int32 coreToScheduleOnto; 1.51 + 1.52 + int32 sizeToMalloc; 1.53 + void *ptrToFree; 1.54 + 1.55 + int32 singletonID; 1.56 + void *endJumpPt; 1.57 + 1.58 + PtrToAtomicFn fnToExecInMaster; 1.59 + void *dataForFn; 1.60 + 1.61 + int32 transID; 1.62 } 1.63 /* SSRSemReq */; 1.64 1.65 + 1.66 +typedef struct 1.67 + { 1.68 + VirtProcr *VPCurrentlyExecuting; 1.69 + PrivQueueStruc *waitingVPQ; 1.70 + } 1.71 +SSRTrans; 1.72 + 1.73 typedef struct 1.74 { 1.75 PrivQueueStruc **readyVPQs; 1.76 @@ -49,10 +85,28 @@ 1.77 int32 numVirtPr; 1.78 int32 nextCoreToGetNewPr; 1.79 int32 primitiveStartTime; 1.80 + 1.81 + //fix limit on num with dynArray 1.82 + int32 singletonHasBeenExecutedFlags[NUM_STRUCS_IN_SEM_ENV]; 1.83 + SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV]; 1.84 } 1.85 SSRSemEnv; 1.86 1.87 1.88 +typedef struct _TransListElem TransListElem; 1.89 +struct _TransListElem 1.90 + { 1.91 + int32 transID; 1.92 + TransListElem *nextTrans; 1.93 + }; 1.94 + 1.95 +typedef struct 1.96 + { 1.97 + int32 highestTransEntered; 1.98 + TransListElem *lastTransEntered; 1.99 + } 1.100 +SSRSemData; 1.101 + 1.102 //=========================================================================== 1.103 1.104 void 1.105 @@ -70,6 +124,9 @@ 1.106 int32 1.107 SSR__giveIdealNumWorkUnits(); 1.108 1.109 +int32 1.110 +SSR__give_number_of_cores_to_schedule_onto(); 1.111 + 1.112 //======================= 1.113 1.114 void 1.115 @@ -84,12 +141,19 @@ 1.116 SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData, 1.117 VirtProcr *creatingPr ); 1.118 1.119 +inline VirtProcr * 1.120 +SSR__create_procr_with_affinity( VirtProcrFnPtr fnPtr, void *initData, 1.121 + VirtProcr *creatingPr, int32 coreToScheduleOnto); 1.122 + 1.123 void 1.124 SSR__dissipate_procr( VirtProcr *procrToDissipate ); 1.125 1.126 //======================= 1.127 void * 1.128 -SSR__malloc_size_to( int numBytes, VirtProcr *ownerPr ); 1.129 +SSR__malloc_to( int numBytes, VirtProcr *ownerPr ); 1.130 + 1.131 +void 1.132 +SSR__free( void *ptrToFree, VirtProcr *owningPr ); 1.133 1.134 void 1.135 SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr, 1.136 @@ -121,10 +185,20 @@ 1.137 SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr ); 1.138 1.139 1.140 -//======================= 1.141 +//======================= Concurrency Stuff ====================== 1.142 +void 1.143 +SSR__start_singleton( int32 singletonID, void *endSingletonLabelAddr, 1.144 + VirtProcr *animPr ); 1.145 1.146 void 1.147 -SSR__free_semantic_request( SSRSemReq *semReq ); 1.148 +SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster, 1.149 + void *data, VirtProcr *animPr ); 1.150 + 1.151 +void 1.152 +SSR__start_transaction( int32 transactionID, VirtProcr *animPr ); 1.153 + 1.154 +void 1.155 +SSR__end_transaction( int32 transactionID, VirtProcr *animPr ); 1.156 1.157 1.158 //========================= Internal use only =============================
