comparison src/parallel_execution/main.c @ 124:acf0453b1c7a

Fix meta data pointer calculate
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Tue, 27 Sep 2016 16:19:31 +0900
parents 4ff6f093b695
children 77e60b6cdace
comparison
equal deleted inserted replaced
123:4ff6f093b695 124:acf0453b1c7a
50 } 50 }
51 51
52 __code code2(struct Context* context, struct Array* array, struct LoopCounter* loopCounter) { 52 __code code2(struct Context* context, struct Array* array, struct LoopCounter* loopCounter) {
53 int i = loopCounter->i; 53 int i = loopCounter->i;
54 54
55 if (i < length) { 55 //if (i < length) {
56 //printf("%d\n", array->array[i]); 56 // //printf("%d\n", array->array[i]);
57 if (array->array[i] == (i*2)) { 57 // if (array->array[i] == (i*2)) {
58 loopCounter->i++; 58 // loopCounter->i++;
59 goto meta(context, Code2); 59 // goto meta(context, Code2);
60 } else 60 // } else
61 puts("wrong result"); 61 // puts("wrong result");
62 62
63 } 63 //}
64 64
65 goto meta(context, Exit); 65 goto meta(context, Exit);
66 } 66 }
67 67
68 __code code2_stub(struct Context* context) { 68 __code code2_stub(struct Context* context) {
213 __code createTask3_stub(struct Context* context) { 213 __code createTask3_stub(struct Context* context) {
214 goto createTask3(context, &context->data[Allocate]->allocate); 214 goto createTask3(context, &context->data[Allocate]->allocate);
215 } 215 }
216 216
217 217
218 __code createTask4(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Element* element) { 218 __code createTask4(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Node* node) {
219 int i = loopCounter->i; 219 int i = loopCounter->i;
220 220
221 task->code = Add; 221 task->code = Add;
222 task->oKeys[0] = i; 222 task->oKeys[0] = i;
223 task->iKeys[0] = i-1; 223 task->iKeys[0] = i-1;
224 task->iKeys[1] = i-2; 224 task->iKeys[1] = i-2;
225 task->idsCount = 0;
225 loopCounter->i -= 2; 226 loopCounter->i -= 2;
226 element->data = (union Data *)task;
227 context->next = CreateTask5; 227 context->next = CreateTask5;
228
229 node->key = task->oKeys[0];
228 goto meta(context, Get); 230 goto meta(context, Get);
229 } 231 }
230 232
231 __code createTask4_stub(struct Context* context) { 233 __code createTask4_stub(struct Context* context) {
232 goto createTask4(context, 234 goto createTask4(context,
233 &context->data[LoopCounter]->loopCounter, 235 &context->data[LoopCounter]->loopCounter,
234 &context->data[context->dataNum]->task, 236 &context->data[context->dataNum]->task,
235 &context->data[Element]->element 237 &context->data[Node]->node
236 ); 238 );
237 } 239 }
238 240
239 __code createTask5(struct Context* context, struct Task* task, struct Node* node) { 241 __code createTask5(struct Context* context, struct Task* task) {
240 node->key = task->oKeys[0]; 242 context->next = CreateTask6;
243 goto meta(context, WaitFor);
244 }
245
246 __code createTask5_stub(struct Context* context) {
247 goto createTask5(context,
248 &context->data[context->dataNum]->task
249 );
250 }
251
252 __code createTask6(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Element* element) {
253 element->data = (union Data *)task;
241 loopCounter->i = 0; 254 loopCounter->i = 0;
242 context->next = Code1; 255 context->next = Code1;
243 goto meta(context, WaitFor); 256 goto meta(context, SpawnTask);
244 } 257 }
245 258
246 __code createTask5_stub(struct Context* context) { 259 __code createTask6_stub(struct Context* context) {
247 goto createTask4(context, 260 goto createTask6(context,
248 &context->data[LoopCounter]->loopCounter, 261 &context->data[LoopCounter]->loopCounter,
249 &context->data[context->dataNum]->task, 262 &context->data[context->dataNum-1]->task,
250 &context->data[Node]->node 263 &context->data[Element]->element
251 ); 264 );
252 } 265 }
253 266
254 __code putQueue1(struct Context* context, struct Allocate* allocate) { 267 __code putQueue1(struct Context* context, struct Allocate* allocate) {
255 allocate->size = sizeof(struct Element); 268 allocate->size = sizeof(struct Element);