8 #include "mlp_runtime.h"
9 #include "workschedule.h"
10 extern volatile int numWorkSchedWorkers;
13 __thread SESEcommon* seseCommon;
15 void searchoojroots() {
23 // goes over ready-to-run SESEs
24 for( i = 0; i < numWorkSchedWorkers; ++i ) {
30 // check all the relevant indices of this
31 // node in the deque, noting if we are in
32 // the top/bottom node which can be partially
36 //SESEcommon* common = (SESEcommon*) n->itsDataArr[j];
37 //if(common==seseCommon){
38 // skip the current running SESE
41 di=(dequeItem *) EXTRACTPTR((INTPTR)di);
42 SESEcommon* seseRec = (SESEcommon*) di->work;
44 struct garbagelist* gl = (struct garbagelist*) &(seseRec[1]);
45 struct garbagelist* glroot = gl;
47 updateAscendantSESE(seseRec);
51 for( k = 0; k < gl->size; k++ ) {
52 void* orig = gl->array[k];
53 ENQUEUE(orig, gl->array[k]);
58 // we only have to move across the nodes
59 // of the deque if the top and bottom are
60 // not the same already
78 // goes over ready-to-run SESEs
79 for( i = 0; i < numWorkSchedWorkers; ++i ) {
82 botNode = dqDecodePtr(dq->bottom);
83 botIndx = dqDecodeIdx(dq->bottom);
85 topNode = dqDecodePtr(dq->top);
86 topIndx = dqDecodeIdx(dq->top);
91 // check all the relevant indices of this
92 // node in the deque, noting if we are in
93 // the top/bottom node which can be partially
100 } else { jHi = DQNODE_ARRAYSIZE; }
102 for( j = jLo; j < jHi; ++j ) {
105 //SESEcommon* common = (SESEcommon*) n->itsDataArr[j];
106 //if(common==seseCommon){
110 SESEcommon* seseRec = (SESEcommon*) n->itsDataArr[j];
112 struct garbagelist* gl = (struct garbagelist*) &(seseRec[1]);
113 struct garbagelist* glroot = gl;
115 updateAscendantSESE(seseRec);
117 while( gl != NULL ) {
119 for( k = 0; k < gl->size; k++ ) {
120 void* orig = gl->array[k];
121 ENQUEUE(orig, gl->array[k]);
127 // we only have to move across the nodes
128 // of the deque if the top and bottom are
129 // not the same already
130 if( botNode != topNode ) {
133 } while( n != topNode );
139 updateForwardList(struct Queue *forwardList, int prevUpdate) {
140 struct QueueItem * fqItem=getHead(forwardList);
141 while(fqItem!=NULL) {
142 SESEcommon* seseRec = (SESEcommon*)(fqItem->objectptr);
143 struct garbagelist * gl=(struct garbagelist *)&(seseRec[1]);
144 if(prevUpdate==TRUE) {
145 updateAscendantSESE(seseRec);
150 for(i=0; i<gl->size; i++) {
151 void * orig=gl->array[i];
152 ENQUEUE(orig, gl->array[i]);
156 // iterate forwarding list of seseRec
157 struct Queue* fList=&seseRec->forwardList;
158 updateForwardList(fList,prevUpdate);
159 fqItem=getNextQueueItem(fqItem);
164 updateMemoryQueue(SESEcommon* seseParent) {
165 // update memory queue
167 for(i=0; i<seseParent->numMemoryQueue; i++) {
168 MemoryQueue *memoryQueue=seseParent->memoryQueueArray[i];
169 MemoryQueueItem *memoryItem=memoryQueue->head;
170 while(memoryItem!=NULL) {
171 if(memoryItem->type==HASHTABLE) {
172 Hashtable *ht=(Hashtable*)memoryItem;
173 for(binidx=0; binidx<NUMBINS; binidx++) {
174 BinElement *bin=ht->array[binidx];
175 BinItem *binItem=bin->head;
176 while(binItem!=NULL) {
177 if(binItem->type==READBIN) {
178 ReadBinItem* readBinItem=(ReadBinItem*)binItem;
180 for(ridx=0; ridx<readBinItem->index; ridx++) {
181 REntry *rentry=readBinItem->array[ridx];
182 SESEcommon* seseRec = (SESEcommon*)(rentry->seseRec);
183 struct garbagelist * gl= (struct garbagelist *)&(seseRec[1]);
184 updateAscendantSESE(seseRec);
187 for(i=0; i<gl->size; i++) {
188 void * orig=gl->array[i];
189 ENQUEUE(orig, gl->array[i]);
195 REntry *rentry=((WriteBinItem*)binItem)->val;
196 SESEcommon* seseRec = (SESEcommon*)(rentry->seseRec);
197 struct garbagelist * gl= (struct garbagelist *)&(seseRec[1]);
198 updateAscendantSESE(seseRec);
201 for(i=0; i<gl->size; i++) {
202 void * orig=gl->array[i];
203 ENQUEUE(orig, gl->array[i]);
208 binItem=binItem->next;
211 } else if(memoryItem->type==VECTOR) {
212 Vector *vt=(Vector*)memoryItem;
214 for(idx=0; idx<vt->index; idx++) {
215 REntry *rentry=vt->array[idx];
217 SESEcommon* seseRec = (SESEcommon*)(rentry->seseRec);
218 struct garbagelist * gl= (struct garbagelist *)&(seseRec[1]);
219 updateAscendantSESE(seseRec);
222 for(i=0; i<gl->size; i++) {
223 void * orig=gl->array[i];
224 ENQUEUE(orig, gl->array[i]);
230 } else if(memoryItem->type==SINGLEITEM) {
231 SCC *scc=(SCC*)memoryItem;
232 REntry *rentry=scc->val;
234 SESEcommon* seseRec = (SESEcommon*)(rentry->seseRec);
235 struct garbagelist * gl= (struct garbagelist *)&(seseRec[1]);
236 updateAscendantSESE(seseRec);
239 for(i=0; i<gl->size; i++) {
240 void * orig=gl->array[i];
241 ENQUEUE(orig, gl->array[i]);
247 memoryItem=memoryItem->next;
252 updateAscendantSESE(SESEcommon* seseRec) {
254 for(prevIdx=0; prevIdx<(seseRec->numDependentSESErecords); prevIdx++) {
255 SESEcommon* prevSESE = (SESEcommon*)
258 seseRec->offsetToDepSESErecords +
259 (sizeof(INTPTR)*prevIdx)
263 struct garbagelist * prevgl=(struct garbagelist *)&(((SESEcommon*)(prevSESE))[1]);
264 while(prevgl!=NULL) {
266 for(i=0; i<prevgl->size; i++) {
267 void * orig=prevgl->array[i];
268 ENQUEUE(orig, prevgl->array[i]);