Mercurial > hg > Members > innparusu > Gears
diff 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 |
line wrap: on
line diff
--- a/src/parallel_execution/main.c Tue Sep 13 11:54:25 2016 +0900 +++ b/src/parallel_execution/main.c Tue Sep 27 16:19:31 2016 +0900 @@ -52,15 +52,15 @@ __code code2(struct Context* context, struct Array* array, struct LoopCounter* loopCounter) { int i = loopCounter->i; - if (i < length) { - //printf("%d\n", array->array[i]); - if (array->array[i] == (i*2)) { - loopCounter->i++; - goto meta(context, Code2); - } else - puts("wrong result"); + //if (i < length) { + // //printf("%d\n", array->array[i]); + // if (array->array[i] == (i*2)) { + // loopCounter->i++; + // goto meta(context, Code2); + // } else + // puts("wrong result"); - } + //} goto meta(context, Exit); } @@ -215,16 +215,18 @@ } -__code createTask4(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Element* element) { +__code createTask4(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Node* node) { int i = loopCounter->i; task->code = Add; task->oKeys[0] = i; task->iKeys[0] = i-1; task->iKeys[1] = i-2; + task->idsCount = 0; loopCounter->i -= 2; - element->data = (union Data *)task; context->next = CreateTask5; + + node->key = task->oKeys[0]; goto meta(context, Get); } @@ -232,22 +234,33 @@ goto createTask4(context, &context->data[LoopCounter]->loopCounter, &context->data[context->dataNum]->task, - &context->data[Element]->element + &context->data[Node]->node ); } -__code createTask5(struct Context* context, struct Task* task, struct Node* node) { - node->key = task->oKeys[0]; - loopCounter->i = 0; - context->next = Code1; +__code createTask5(struct Context* context, struct Task* task) { + context->next = CreateTask6; goto meta(context, WaitFor); } __code createTask5_stub(struct Context* context) { - goto createTask4(context, + goto createTask5(context, + &context->data[context->dataNum]->task + ); +} + +__code createTask6(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Element* element) { + element->data = (union Data *)task; + loopCounter->i = 0; + context->next = Code1; + goto meta(context, SpawnTask); +} + +__code createTask6_stub(struct Context* context) { + goto createTask6(context, &context->data[LoopCounter]->loopCounter, - &context->data[context->dataNum]->task, - &context->data[Node]->node + &context->data[context->dataNum-1]->task, + &context->data[Element]->element ); }