| rev |
line source |
|
Me@6
|
1 /*
|
|
Me@6
|
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
|
|
Me@6
|
3 * Licensed under GNU General Public License version 2
|
|
Me@6
|
4 *
|
|
Me@6
|
5 * Author: seanhalle@yahoo.com
|
|
Me@6
|
6 *
|
|
Me@6
|
7 */
|
|
Me@6
|
8
|
|
Me@6
|
9 #ifndef _SSR_H
|
|
Me@6
|
10 #define _SSR_H
|
|
Me@6
|
11
|
|
Me@6
|
12 #include "VMS/Queue_impl/PrivateQueue.h"
|
|
Me@6
|
13 #include "VMS/Hash_impl/PrivateHash.h"
|
|
Me@6
|
14 #include "VMS/VMS.h"
|
|
Nina@39
|
15 #include "dependency.h"
|
|
Me@6
|
16
|
|
Me@17
|
17
|
|
Me@17
|
18 //===========================================================================
|
|
Me@17
|
19 #define NUM_STRUCS_IN_SEM_ENV 1000
|
|
Me@17
|
20
|
|
Me@17
|
21 //===========================================================================
|
|
Me@6
|
22 /*This header defines everything specific to the SSR semantic plug-in
|
|
Me@6
|
23 */
|
|
Me@6
|
24 typedef struct _SSRSemReq SSRSemReq;
|
|
Me@17
|
25 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master
|
|
Me@17
|
26 //===========================================================================
|
|
Me@6
|
27
|
|
Me@6
|
28 /*Semantic layer-specific data sent inside a request from lib called in app
|
|
Me@6
|
29 * to request handler called in MasterLoop
|
|
Me@6
|
30 */
|
|
Me@21
|
31
|
|
Me@21
|
32 typedef struct
|
|
Me@21
|
33 {
|
|
Me@21
|
34 VirtProcr *VPCurrentlyExecuting;
|
|
Me@21
|
35 PrivQueueStruc *waitingVPQ;
|
|
Me@21
|
36 }
|
|
Me@21
|
37 SSRTrans;
|
|
Me@21
|
38
|
|
msach@24
|
39 /*WARNING: assembly hard-codes position of endInstrAddr as first field
|
|
msach@24
|
40 */
|
|
Me@21
|
41 typedef struct
|
|
Me@21
|
42 {
|
|
Me@22
|
43 void *endInstrAddr;
|
|
Me@21
|
44 int32 hasBeenStarted;
|
|
Me@21
|
45 int32 hasFinished;
|
|
Me@21
|
46 PrivQueueStruc *waitQ;
|
|
Me@21
|
47 }
|
|
Me@21
|
48 SSRSingleton;
|
|
Me@21
|
49
|
|
Me@6
|
50 enum SSRReqType
|
|
Me@6
|
51 {
|
|
Me@6
|
52 send_type = 1,
|
|
Me@6
|
53 send_from_to,
|
|
Me@6
|
54 receive_any, //order and grouping matter -- send before receive
|
|
Me@6
|
55 receive_type, // and receive_any first of the receives -- Handlers
|
|
Me@6
|
56 receive_from_to,// rely upon this ordering of enum
|
|
Me@6
|
57 transfer_to,
|
|
Me@17
|
58 transfer_out,
|
|
Me@17
|
59 malloc_req,
|
|
Me@17
|
60 free_req,
|
|
Me@21
|
61 singleton_fn_start,
|
|
Me@21
|
62 singleton_fn_end,
|
|
Me@21
|
63 singleton_data_start,
|
|
Me@21
|
64 singleton_data_end,
|
|
Me@17
|
65 atomic,
|
|
Me@17
|
66 trans_start,
|
|
Me@17
|
67 trans_end
|
|
Me@6
|
68 };
|
|
Me@6
|
69
|
|
Me@6
|
70 struct _SSRSemReq
|
|
Me@6
|
71 { enum SSRReqType reqType;
|
|
Me@17
|
72 VirtProcr *sendPr;
|
|
Me@17
|
73 VirtProcr *receivePr;
|
|
Me@17
|
74 int32 msgType;
|
|
Me@17
|
75 void *msg;
|
|
Me@6
|
76 SSRSemReq *nextReqInHashEntry;
|
|
Me@17
|
77
|
|
Me@17
|
78 void *initData;
|
|
Me@17
|
79 VirtProcrFnPtr fnPtr;
|
|
Me@17
|
80 int32 coreToScheduleOnto;
|
|
Me@17
|
81
|
|
Me@17
|
82 int32 sizeToMalloc;
|
|
Me@17
|
83 void *ptrToFree;
|
|
Me@17
|
84
|
|
Me@17
|
85 int32 singletonID;
|
|
Me@22
|
86 SSRSingleton **singletonPtrAddr;
|
|
Me@17
|
87
|
|
Me@17
|
88 PtrToAtomicFn fnToExecInMaster;
|
|
Me@17
|
89 void *dataForFn;
|
|
Me@17
|
90
|
|
Me@17
|
91 int32 transID;
|
|
Me@6
|
92 }
|
|
Me@6
|
93 /* SSRSemReq */;
|
|
Me@6
|
94
|
|
Me@17
|
95
|
|
Me@17
|
96 typedef struct
|
|
Me@17
|
97 {
|
|
Me@6
|
98 PrivQueueStruc **readyVPQs;
|
|
Me@14
|
99 HashTable *commHashTbl;
|
|
Me@14
|
100 int32 numVirtPr;
|
|
Me@14
|
101 int32 nextCoreToGetNewPr;
|
|
Me@14
|
102 int32 primitiveStartTime;
|
|
Me@17
|
103
|
|
Me@17
|
104 //fix limit on num with dynArray
|
|
Me@21
|
105 SSRSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV];
|
|
Me@17
|
106 SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
|
|
Nina@39
|
107
|
|
Nina@39
|
108 #ifdef OBSERVE_UCC
|
|
Nina@39
|
109 Unit*** unitcollection;
|
|
Nina@39
|
110 PrivDynArrayInfo* unitcollectionInfo;
|
|
Nina@39
|
111 Dependency** ctlDependencies;
|
|
Nina@39
|
112 PrivDynArrayInfo* ctlDependenciesInfo;
|
|
Nina@39
|
113 Dependency** commDependencies;
|
|
Nina@39
|
114 PrivDynArrayInfo* commDependenciesInfo;
|
|
Nina@39
|
115 //NtoN structure?
|
|
Nina@39
|
116 #endif
|
|
Nina@39
|
117
|
|
Me@6
|
118 }
|
|
Me@6
|
119 SSRSemEnv;
|
|
Me@6
|
120
|
|
Me@6
|
121
|
|
Me@17
|
122 typedef struct _TransListElem TransListElem;
|
|
Me@17
|
123 struct _TransListElem
|
|
Me@17
|
124 {
|
|
Me@17
|
125 int32 transID;
|
|
Me@17
|
126 TransListElem *nextTrans;
|
|
Me@17
|
127 };
|
|
Me@18
|
128 //TransListElem
|
|
Me@18
|
129
|
|
Me@17
|
130 typedef struct
|
|
Me@17
|
131 {
|
|
Me@17
|
132 int32 highestTransEntered;
|
|
Me@17
|
133 TransListElem *lastTransEntered;
|
|
Me@17
|
134 }
|
|
Me@17
|
135 SSRSemData;
|
|
Me@17
|
136
|
|
Me@6
|
137 //===========================================================================
|
|
Me@6
|
138
|
|
Me@6
|
139 void
|
|
Me@6
|
140 SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
|
|
Me@6
|
141
|
|
Me@14
|
142 int32
|
|
Me@14
|
143 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
|
|
Me@14
|
144
|
|
Me@20
|
145 void
|
|
Me@14
|
146 SSR__start_primitive();
|
|
Me@14
|
147
|
|
Me@20
|
148 int32
|
|
Me@14
|
149 SSR__end_primitive_and_give_cycles();
|
|
Me@14
|
150
|
|
Me@16
|
151 int32
|
|
Me@16
|
152 SSR__giveIdealNumWorkUnits();
|
|
Me@14
|
153
|
|
Me@17
|
154 int32
|
|
Me@17
|
155 SSR__give_number_of_cores_to_schedule_onto();
|
|
Me@17
|
156
|
|
Me@6
|
157 //=======================
|
|
Me@6
|
158
|
|
Me@6
|
159 void
|
|
Me@6
|
160 SSR__init();
|
|
Me@6
|
161
|
|
Me@6
|
162 void
|
|
Me@6
|
163 SSR__cleanup_after_shutdown();
|
|
Me@6
|
164
|
|
Me@6
|
165 //=======================
|
|
Me@6
|
166
|
|
Me@20
|
167 VirtProcr *
|
|
Me@6
|
168 SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
|
|
Me@6
|
169 VirtProcr *creatingPr );
|
|
Me@6
|
170
|
|
Me@20
|
171 VirtProcr *
|
|
Me@17
|
172 SSR__create_procr_with_affinity( VirtProcrFnPtr fnPtr, void *initData,
|
|
Me@17
|
173 VirtProcr *creatingPr, int32 coreToScheduleOnto);
|
|
Me@17
|
174
|
|
Me@6
|
175 void
|
|
Me@6
|
176 SSR__dissipate_procr( VirtProcr *procrToDissipate );
|
|
Me@6
|
177
|
|
Me@6
|
178 //=======================
|
|
Me@6
|
179 void *
|
|
Me@17
|
180 SSR__malloc_to( int numBytes, VirtProcr *ownerPr );
|
|
Me@17
|
181
|
|
Me@17
|
182 void
|
|
Me@17
|
183 SSR__free( void *ptrToFree, VirtProcr *owningPr );
|
|
Me@6
|
184
|
|
Me@6
|
185 void
|
|
Me@6
|
186 SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
|
|
Me@6
|
187 VirtProcr *newOwnerPr );
|
|
Me@6
|
188
|
|
Me@6
|
189 void
|
|
Me@6
|
190 SSR__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
|
|
Me@6
|
191
|
|
Me@6
|
192 void
|
|
Me@6
|
193 SSR__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
|
|
Me@6
|
194
|
|
Me@6
|
195 void
|
|
Me@6
|
196 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
|
|
Me@6
|
197
|
|
Me@6
|
198
|
|
Me@6
|
199
|
|
Me@6
|
200 //=======================
|
|
Me@6
|
201 void
|
|
Me@6
|
202 SSR__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
|
|
Me@6
|
203 VirtProcr *receivePr);
|
|
Me@6
|
204
|
|
Me@6
|
205 void
|
|
Me@6
|
206 SSR__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
|
|
Me@6
|
207
|
|
Me@6
|
208 void *
|
|
Me@6
|
209 SSR__receive_type_to( const int type, VirtProcr *receivePr );
|
|
Me@6
|
210
|
|
Me@6
|
211 void *
|
|
Me@6
|
212 SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
|
|
Me@6
|
213
|
|
Me@6
|
214
|
|
Me@17
|
215 //======================= Concurrency Stuff ======================
|
|
Me@17
|
216 void
|
|
Me@21
|
217 SSR__start_fn_singleton( int32 singletonID, VirtProcr *animPr );
|
|
Me@21
|
218
|
|
Me@21
|
219 void
|
|
Me@21
|
220 SSR__end_fn_singleton( int32 singletonID, VirtProcr *animPr );
|
|
Me@21
|
221
|
|
Me@21
|
222 void
|
|
Me@21
|
223 SSR__start_data_singleton( SSRSingleton **singeltonAddr, VirtProcr *animPr );
|
|
Me@21
|
224
|
|
Me@21
|
225 void
|
|
Me@21
|
226 SSR__end_data_singleton( SSRSingleton **singletonAddr, VirtProcr *animPr );
|
|
Me@6
|
227
|
|
Me@6
|
228 void
|
|
Me@17
|
229 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
|
|
Me@17
|
230 void *data, VirtProcr *animPr );
|
|
Me@17
|
231
|
|
Me@17
|
232 void
|
|
Me@17
|
233 SSR__start_transaction( int32 transactionID, VirtProcr *animPr );
|
|
Me@17
|
234
|
|
Me@17
|
235 void
|
|
Me@17
|
236 SSR__end_transaction( int32 transactionID, VirtProcr *animPr );
|
|
Me@6
|
237
|
|
Me@6
|
238
|
|
Me@6
|
239 //========================= Internal use only =============================
|
|
Me@6
|
240 void
|
|
Me@6
|
241 SSR__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
|
|
Me@6
|
242
|
|
Me@6
|
243 VirtProcr *
|
|
Me@6
|
244 SSR__schedule_virt_procr( void *_semEnv, int coreNum );
|
|
Me@6
|
245
|
|
msach@27
|
246 VirtProcr*
|
|
msach@27
|
247 SSR__create_procr_helper( VirtProcrFnPtr fnPtr, void *initData,
|
|
msach@27
|
248 SSRSemEnv *semEnv, int32 coreToScheduleOnto );
|
|
Me@6
|
249
|
|
Me@6
|
250 #endif /* _SSR_H */
|
|
Me@6
|
251
|