| 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"
|
|
Me@6
|
15
|
|
Me@17
|
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@6
|
31 enum SSRReqType
|
|
Me@6
|
32 {
|
|
Me@6
|
33 send_type = 1,
|
|
Me@6
|
34 send_from_to,
|
|
Me@6
|
35 receive_any, //order and grouping matter -- send before receive
|
|
Me@6
|
36 receive_type, // and receive_any first of the receives -- Handlers
|
|
Me@6
|
37 receive_from_to,// rely upon this ordering of enum
|
|
Me@6
|
38 transfer_to,
|
|
Me@17
|
39 transfer_out,
|
|
Me@17
|
40 malloc_req,
|
|
Me@17
|
41 free_req,
|
|
Me@17
|
42 singleton,
|
|
Me@17
|
43 atomic,
|
|
Me@17
|
44 trans_start,
|
|
Me@17
|
45 trans_end
|
|
Me@6
|
46 };
|
|
Me@6
|
47
|
|
Me@6
|
48 struct _SSRSemReq
|
|
Me@6
|
49 { enum SSRReqType reqType;
|
|
Me@17
|
50 VirtProcr *sendPr;
|
|
Me@17
|
51 VirtProcr *receivePr;
|
|
Me@17
|
52 int32 msgType;
|
|
Me@17
|
53 void *msg;
|
|
Me@6
|
54 SSRSemReq *nextReqInHashEntry;
|
|
Me@17
|
55
|
|
Me@17
|
56 void *initData;
|
|
Me@17
|
57 VirtProcrFnPtr fnPtr;
|
|
Me@17
|
58 int32 coreToScheduleOnto;
|
|
Me@17
|
59
|
|
Me@17
|
60 int32 sizeToMalloc;
|
|
Me@17
|
61 void *ptrToFree;
|
|
Me@17
|
62
|
|
Me@17
|
63 int32 singletonID;
|
|
Me@17
|
64 void *endJumpPt;
|
|
Me@17
|
65
|
|
Me@17
|
66 PtrToAtomicFn fnToExecInMaster;
|
|
Me@17
|
67 void *dataForFn;
|
|
Me@17
|
68
|
|
Me@17
|
69 int32 transID;
|
|
Me@6
|
70 }
|
|
Me@6
|
71 /* SSRSemReq */;
|
|
Me@6
|
72
|
|
Me@17
|
73
|
|
Me@17
|
74 typedef struct
|
|
Me@17
|
75 {
|
|
Me@17
|
76 VirtProcr *VPCurrentlyExecuting;
|
|
Me@17
|
77 PrivQueueStruc *waitingVPQ;
|
|
Me@17
|
78 }
|
|
Me@17
|
79 SSRTrans;
|
|
Me@17
|
80
|
|
Me@6
|
81 typedef struct
|
|
Me@6
|
82 {
|
|
Me@6
|
83 PrivQueueStruc **readyVPQs;
|
|
Me@14
|
84 HashTable *commHashTbl;
|
|
Me@14
|
85 int32 numVirtPr;
|
|
Me@14
|
86 int32 nextCoreToGetNewPr;
|
|
Me@14
|
87 int32 primitiveStartTime;
|
|
Me@17
|
88
|
|
Me@17
|
89 //fix limit on num with dynArray
|
|
Me@17
|
90 int32 singletonHasBeenExecutedFlags[NUM_STRUCS_IN_SEM_ENV];
|
|
Me@17
|
91 SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
|
|
Me@6
|
92 }
|
|
Me@6
|
93 SSRSemEnv;
|
|
Me@6
|
94
|
|
Me@6
|
95
|
|
Me@17
|
96 typedef struct _TransListElem TransListElem;
|
|
Me@17
|
97 struct _TransListElem
|
|
Me@17
|
98 {
|
|
Me@17
|
99 int32 transID;
|
|
Me@17
|
100 TransListElem *nextTrans;
|
|
Me@17
|
101 };
|
|
Me@18
|
102 //TransListElem
|
|
Me@18
|
103
|
|
Me@17
|
104 typedef struct
|
|
Me@17
|
105 {
|
|
Me@17
|
106 int32 highestTransEntered;
|
|
Me@17
|
107 TransListElem *lastTransEntered;
|
|
Me@17
|
108 }
|
|
Me@17
|
109 SSRSemData;
|
|
Me@17
|
110
|
|
Me@6
|
111 //===========================================================================
|
|
Me@6
|
112
|
|
Me@6
|
113 void
|
|
Me@6
|
114 SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
|
|
Me@6
|
115
|
|
Me@14
|
116 int32
|
|
Me@14
|
117 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
|
|
Me@14
|
118
|
|
Me@14
|
119 void inline
|
|
Me@14
|
120 SSR__start_primitive();
|
|
Me@14
|
121
|
|
Me@14
|
122 int32 inline
|
|
Me@14
|
123 SSR__end_primitive_and_give_cycles();
|
|
Me@14
|
124
|
|
Me@16
|
125 int32
|
|
Me@16
|
126 SSR__giveIdealNumWorkUnits();
|
|
Me@14
|
127
|
|
Me@17
|
128 int32
|
|
Me@17
|
129 SSR__give_number_of_cores_to_schedule_onto();
|
|
Me@17
|
130
|
|
Me@6
|
131 //=======================
|
|
Me@6
|
132
|
|
Me@6
|
133 void
|
|
Me@6
|
134 SSR__init();
|
|
Me@6
|
135
|
|
Me@6
|
136 void
|
|
Me@6
|
137 SSR__cleanup_after_shutdown();
|
|
Me@6
|
138
|
|
Me@6
|
139 //=======================
|
|
Me@6
|
140
|
|
Me@6
|
141 inline VirtProcr *
|
|
Me@6
|
142 SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
|
|
Me@6
|
143 VirtProcr *creatingPr );
|
|
Me@6
|
144
|
|
Me@17
|
145 inline VirtProcr *
|
|
Me@17
|
146 SSR__create_procr_with_affinity( VirtProcrFnPtr fnPtr, void *initData,
|
|
Me@17
|
147 VirtProcr *creatingPr, int32 coreToScheduleOnto);
|
|
Me@17
|
148
|
|
Me@6
|
149 void
|
|
Me@6
|
150 SSR__dissipate_procr( VirtProcr *procrToDissipate );
|
|
Me@6
|
151
|
|
Me@6
|
152 //=======================
|
|
Me@6
|
153 void *
|
|
Me@17
|
154 SSR__malloc_to( int numBytes, VirtProcr *ownerPr );
|
|
Me@17
|
155
|
|
Me@17
|
156 void
|
|
Me@17
|
157 SSR__free( void *ptrToFree, VirtProcr *owningPr );
|
|
Me@6
|
158
|
|
Me@6
|
159 void
|
|
Me@6
|
160 SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
|
|
Me@6
|
161 VirtProcr *newOwnerPr );
|
|
Me@6
|
162
|
|
Me@6
|
163 void
|
|
Me@6
|
164 SSR__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
|
|
Me@6
|
165
|
|
Me@6
|
166 void
|
|
Me@6
|
167 SSR__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
|
|
Me@6
|
168
|
|
Me@6
|
169 void
|
|
Me@6
|
170 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
|
|
Me@6
|
171
|
|
Me@6
|
172
|
|
Me@6
|
173
|
|
Me@6
|
174 //=======================
|
|
Me@6
|
175 void
|
|
Me@6
|
176 SSR__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
|
|
Me@6
|
177 VirtProcr *receivePr);
|
|
Me@6
|
178
|
|
Me@6
|
179 void
|
|
Me@6
|
180 SSR__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
|
|
Me@6
|
181
|
|
Me@6
|
182 void *
|
|
Me@6
|
183 SSR__receive_type_to( const int type, VirtProcr *receivePr );
|
|
Me@6
|
184
|
|
Me@6
|
185 void *
|
|
Me@6
|
186 SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
|
|
Me@6
|
187
|
|
Me@6
|
188
|
|
Me@17
|
189 //======================= Concurrency Stuff ======================
|
|
Me@17
|
190 void
|
|
Me@17
|
191 SSR__start_singleton( int32 singletonID, void *endSingletonLabelAddr,
|
|
Me@17
|
192 VirtProcr *animPr );
|
|
Me@6
|
193
|
|
Me@6
|
194 void
|
|
Me@17
|
195 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
|
|
Me@17
|
196 void *data, VirtProcr *animPr );
|
|
Me@17
|
197
|
|
Me@17
|
198 void
|
|
Me@17
|
199 SSR__start_transaction( int32 transactionID, VirtProcr *animPr );
|
|
Me@17
|
200
|
|
Me@17
|
201 void
|
|
Me@17
|
202 SSR__end_transaction( int32 transactionID, VirtProcr *animPr );
|
|
Me@6
|
203
|
|
Me@6
|
204
|
|
Me@6
|
205 //========================= Internal use only =============================
|
|
Me@6
|
206 void
|
|
Me@6
|
207 SSR__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
|
|
Me@6
|
208
|
|
Me@6
|
209 VirtProcr *
|
|
Me@6
|
210 SSR__schedule_virt_procr( void *_semEnv, int coreNum );
|
|
Me@6
|
211
|
|
Me@6
|
212
|
|
Me@6
|
213 #endif /* _SSR_H */
|
|
Me@6
|
214
|