| rev |
line source |
|
Me@0
|
1 /*
|
|
Me@0
|
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
|
|
Me@0
|
3 * Licensed under GNU General Public License version 2
|
|
Me@0
|
4 *
|
|
Me@0
|
5 * Author: seanhalle@yahoo.com
|
|
Me@0
|
6 *
|
|
Me@0
|
7 */
|
|
Me@0
|
8
|
|
Me@0
|
9 #ifndef _VCilk_H
|
|
Me@0
|
10 #define _VCilk_H
|
|
Me@0
|
11
|
|
Me@0
|
12 #include "VMS/Queue_impl/PrivateQueue.h"
|
|
Me@0
|
13 #include "VMS/Hash_impl/PrivateHash.h"
|
|
Me@0
|
14 #include "VMS/VMS.h"
|
|
Me@0
|
15
|
|
Me@2
|
16
|
|
Me@2
|
17
|
|
Me@0
|
18 /*This header defines everything specific to the VCilk semantic plug-in
|
|
Me@0
|
19 */
|
|
Me@2
|
20
|
|
Me@2
|
21 //===========================================================================
|
|
Me@2
|
22 #define NUM_STRUCS_IN_SEM_ENV 1000
|
|
Me@2
|
23
|
|
Me@2
|
24 //===========================================================================
|
|
Me@0
|
25 typedef struct _VCilkSemReq VCilkSemReq;
|
|
Me@2
|
26 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master
|
|
Me@2
|
27
|
|
Me@2
|
28 //===========================================================================
|
|
Me@0
|
29
|
|
Me@0
|
30
|
|
Me@0
|
31 /*Semantic layer-specific data sent inside a request from lib called in app
|
|
Me@0
|
32 * to request handler called in MasterLoop
|
|
Me@0
|
33 */
|
|
Me@0
|
34 enum VCilkReqType
|
|
Me@0
|
35 {
|
|
Me@0
|
36 syncReq = 1,
|
|
Me@0
|
37 mallocReq,
|
|
Me@2
|
38 freeReq,
|
|
Me@2
|
39 singleton,
|
|
Me@2
|
40 atomic,
|
|
Me@2
|
41 trans_start,
|
|
Me@2
|
42 trans_end
|
|
Me@0
|
43 };
|
|
Me@0
|
44
|
|
Me@0
|
45 struct _VCilkSemReq
|
|
Me@0
|
46 { enum VCilkReqType reqType;
|
|
Me@0
|
47 VirtProcr *requestingPr;
|
|
Me@2
|
48
|
|
Me@0
|
49 int32 sizeToMalloc;
|
|
Me@0
|
50 void *ptrToFree;
|
|
Me@2
|
51
|
|
Me@0
|
52 VirtProcrFnPtr fnPtr;
|
|
Me@0
|
53 void *initData;
|
|
Me@0
|
54 int32 coreToSpawnOnto;
|
|
Me@2
|
55
|
|
Me@2
|
56 int32 singletonID;
|
|
Me@2
|
57 void *endJumpPt;
|
|
Me@2
|
58
|
|
Me@2
|
59 PtrToAtomicFn fnToExecInMaster;
|
|
Me@2
|
60 void *dataForFn;
|
|
Me@2
|
61
|
|
Me@2
|
62 int32 transID;
|
|
Me@0
|
63 }
|
|
Me@0
|
64 /* VCilkSemReq */;
|
|
Me@0
|
65
|
|
Me@0
|
66 typedef struct
|
|
Me@0
|
67 {
|
|
Me@2
|
68 VirtProcr *VPCurrentlyExecuting;
|
|
Me@2
|
69 PrivQueueStruc *waitingVPQ;
|
|
Me@2
|
70 }
|
|
Me@2
|
71 VCilkTrans;
|
|
Me@2
|
72
|
|
Me@2
|
73 typedef struct
|
|
Me@2
|
74 {
|
|
Me@0
|
75 PrivQueueStruc **readyVPQs;
|
|
Me@0
|
76 HashTable *commHashTbl;
|
|
Me@0
|
77 int32 numVirtPr;
|
|
Me@0
|
78 int32 nextCoreToGetNewPr;
|
|
Me@0
|
79 int32 primitiveStartTime;
|
|
Me@2
|
80
|
|
Me@2
|
81 //fix limit on num with dynArray
|
|
Me@2
|
82 int32 singletonHasBeenExecutedFlags[NUM_STRUCS_IN_SEM_ENV];
|
|
Me@2
|
83 VCilkTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
|
|
Me@0
|
84 }
|
|
Me@0
|
85 VCilkSemEnv;
|
|
Me@0
|
86
|
|
Me@2
|
87 typedef struct _TransListElem TransListElem;
|
|
Me@2
|
88 struct _TransListElem
|
|
Me@2
|
89 {
|
|
Me@2
|
90 int32 transID;
|
|
Me@2
|
91 TransListElem *nextTrans;
|
|
Me@2
|
92 };
|
|
Me@2
|
93 //TransListElem
|
|
Me@2
|
94
|
|
Me@0
|
95 typedef struct
|
|
Me@0
|
96 {
|
|
Me@2
|
97 int32 syncPending;
|
|
Me@2
|
98 int32 numLiveChildren;
|
|
Me@2
|
99 VirtProcr *parentPr;
|
|
Me@2
|
100
|
|
Me@2
|
101 int32 highestTransEntered;
|
|
Me@2
|
102 TransListElem *lastTransEntered;
|
|
Me@0
|
103 }
|
|
Me@0
|
104 VCilkSemData;
|
|
Me@0
|
105
|
|
Me@0
|
106 //===========================================================================
|
|
Me@0
|
107
|
|
Me@0
|
108 void
|
|
Me@0
|
109 VCilk__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
|
|
Me@0
|
110
|
|
Me@0
|
111 int32
|
|
Me@0
|
112 VCilk__giveMinWorkUnitCycles( float32 percentOverhead );
|
|
Me@0
|
113
|
|
Me@0
|
114 void inline
|
|
Me@0
|
115 VCilk__start_primitive();
|
|
Me@0
|
116
|
|
Me@0
|
117 int32 inline
|
|
Me@0
|
118 VCilk__end_primitive_and_give_cycles();
|
|
Me@0
|
119
|
|
Me@0
|
120 int32
|
|
Me@0
|
121 VCilk__giveIdealNumWorkUnits();
|
|
Me@0
|
122
|
|
Me@0
|
123 //=======================
|
|
Me@0
|
124
|
|
Me@0
|
125 void
|
|
Me@0
|
126 VCilk__init();
|
|
Me@0
|
127
|
|
Me@0
|
128 void
|
|
Me@2
|
129 VCilk__cleanup_at_end_of_shutdown();
|
|
Me@0
|
130
|
|
Me@0
|
131 //=======================
|
|
Me@0
|
132
|
|
Me@0
|
133 void inline
|
|
Me@0
|
134 VCilk__spawn( int32 coreToSpawnOnto, VirtProcrFnPtr fnPtr,
|
|
Me@0
|
135 void *initData, VirtProcr *creatingPr );
|
|
Me@0
|
136
|
|
Me@0
|
137 int32
|
|
Me@0
|
138 VCilk__give_number_of_cores_to_spawn_onto();
|
|
Me@0
|
139
|
|
Me@0
|
140 void
|
|
Me@0
|
141 VCilk__sync( VirtProcr *animatingPr );
|
|
Me@0
|
142
|
|
Me@0
|
143 void *
|
|
Me@0
|
144 VCilk__malloc( int32 sizeToMalloc, VirtProcr *animPr );
|
|
Me@0
|
145
|
|
Me@0
|
146 void
|
|
Me@0
|
147 VCilk__free( void *ptrToFree, VirtProcr *animPr );
|
|
Me@0
|
148
|
|
Me@0
|
149 void
|
|
Me@0
|
150 VCilk__dissipate_procr( VirtProcr *procrToDissipate );
|
|
Me@0
|
151
|
|
Me@2
|
152
|
|
Me@2
|
153 //======================= Concurrency Stuff ======================
|
|
Me@2
|
154 void
|
|
Me@2
|
155 VCilk__start_singleton( int32 singletonID, void *endSingletonLabelAddr,
|
|
Me@2
|
156 VirtProcr *animPr );
|
|
Me@0
|
157
|
|
Me@0
|
158 void
|
|
Me@2
|
159 VCilk__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
|
|
Me@2
|
160 void *data, VirtProcr *animPr );
|
|
Me@2
|
161
|
|
Me@2
|
162 void
|
|
Me@2
|
163 VCilk__start_transaction( int32 transactionID, VirtProcr *animPr );
|
|
Me@2
|
164
|
|
Me@2
|
165 void
|
|
Me@2
|
166 VCilk__end_transaction( int32 transactionID, VirtProcr *animPr );
|
|
Me@0
|
167
|
|
Me@0
|
168
|
|
Me@0
|
169 //========================= Internal use only =============================
|
|
Me@0
|
170 void
|
|
Me@0
|
171 VCilk__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
|
|
Me@0
|
172
|
|
Me@0
|
173 VirtProcr *
|
|
Me@0
|
174 VCilk__schedule_virt_procr( void *_semEnv, int coreNum );
|
|
Me@0
|
175
|
|
Me@0
|
176
|
|
Me@0
|
177 #endif /* _VCilk_H */
|
|
Me@0
|
178
|