Mercurial > hg > Members > innparusu > Gears
diff src/parallel_execution/main.c @ 115:135472238fb7
Add meta Data Gear allocate
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 28 Jun 2016 15:59:24 +0900 |
parents | 0f0459653d77 |
children | 69fbd905d750 |
line wrap: on
line diff
--- a/src/parallel_execution/main.c Tue Jun 21 14:17:58 2016 +0900 +++ b/src/parallel_execution/main.c Tue Jun 28 15:59:24 2016 +0900 @@ -68,13 +68,13 @@ goto code2(context, &context->data[Node]->node.value->array, &context->data[LoopCounter]->loopCounter); } +/* __code createData1(struct Context* context, struct Allocate* allocate, struct LoopCounter* loopCounter) { int i = loopCounter->i; if ((length/split*i) < length) { allocate->size = sizeof(struct Array); allocator(context); - goto meta(context, CreateData2); } @@ -107,6 +107,44 @@ &context->data[context->dataNum]->array, &context->data[Node]->node); } +*/ + +__code createData1(struct Context* context, struct Allocate* allocate, struct LoopCounter* loopCounter) { + int i = loopCounter->i; + + allocate->size = sizeof(struct Queue); + metaAllocator(context); + allocate->size = sizeof(struct Integer); + allocator(context); + goto meta(context, CreateData2); + + loopCounter->i = 0; + goto meta(context, Code1); +} + +__code createData1_stub(struct Context* context) { + goto createData1(context, &context->data[Allocate]->allocate, &context->data[LoopCounter]->loopCounter); +} + +__code createData2(struct Context* context, struct LoopCounter* loopCounter, struct Integer* integer, struct Node* node) { + int i = loopCounter->i; + + integer->value = i; + integer->mDataOffset = -sizeof(struct Integer); + node->key = i; + node->value = (union Data*)integer; + + context->next = CreateTask1; + + goto meta(context, PutTree); +} + +__code createData2_stub(struct Context* context) { + goto createData2(context, + &context->data[LoopCounter]->loopCounter, + &context->data[context->dataNum]->array, + &context->data[Node]->node); +} __code createTask1(struct Context* context, struct Allocate* allocate) { allocate->size = sizeof(struct Task); @@ -118,46 +156,11 @@ goto createTask1(context, &context->data[Allocate]->allocate); } -__code createTask2(struct Context* context, struct Allocate* allocate) { - allocate->size = sizeof(struct Queue); - allocator(context); - goto meta(context, CreateTask3); -} - -__code createTask2_stub(struct Context* context) { - goto createTask2(context, &context->data[Allocate]->allocate); -} - -__code createTask3(struct Context* context, struct Allocate* allocate) { - allocate->size = sizeof(struct Queue); - allocator(context); - goto meta(context, CreateTask4); -} - -__code createTask3_stub(struct Context* context) { - goto createTask3(context, &context->data[Allocate]->allocate); -} - -__code meta_createTask4(struct Context* context, struct Queue* activeQueue, enum Code next) { - context->data[Queue] = (union Data *)activeQueue; - goto (context->code[next])(context); -} - -__code createTask4(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Queue* waitMe, struct Queue* waitI, struct Element* element, struct Queue* activeQueue) { +__code createTask2(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Element* element, struct Queue* activeQueue) { int i = loopCounter->i; - waitMe->first = 0; - waitMe->last = 0; - waitMe->count = 0; - - waitI->first = 0; - waitI->last = 0; - waitI->count = 0; - task->code = Twice; task->key = i; - task->waitMe = waitMe; - task->waitI = waitI; task->idsCount = 0; element->data = (union Data *)task; @@ -168,62 +171,62 @@ goto meta(context, SpawnTask); } -__code createTask4_stub(struct Context* context) { - goto createTask4(context, +__code createTask2_stub(struct Context* context) { + goto createTask2(context, &context->data[LoopCounter]->loopCounter, - &context->data[context->dataNum-2]->task, - &context->data[context->dataNum-1]->queue, - &context->data[context->dataNum]->queue, + &context->data[context->dataNum]->task, &context->data[Element]->element, &context->data[ActiveQueue]->queue); } -//__code createTask4(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Queue* waitMe, struct OdsQueue* waitI, struct Element* element, struct Queue* activeQueue) { -// int i = loopCounter->i; -// -// task->code = TaskC; -// task->key = i; -// task->waitMe = waitMe; -// task->waitI = waitI; -// task->idsCount = 1; -// -// element->data = (union Data *)task; -// -// context->next = CreateData1; -// loopCounter->i++; -// -// goto meta_createTask2(context, activeQueue, PutQueue1); -//} -// -//__code createTask4_stub(struct Context* context) { -// goto createTask2(context, -// &context->data[LoopCounter]->loopCounter, -// &context->data[context->dataNum]->task, -// &context->data[context->dataNum-1]->queue, -// &context->data[context->dataNum-2]->odsQueue, -// &context->data[Element]->element, -// &context->data[ActiveQueue]->queue); -//} -// -//__code createTask5(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Task* slave, struct Element* element) { -// int i = loopCounter->i; -// -// task->code = TaskB; -// task->key = i; -// element->data = (union Data *)task; -// -// context->next = CreateData1; -// loopCounter->i++; -// -// goto meta(context, WaitFor1); -//} -// -//__code createTask5_stub(struct Context* context) { -// goto createTask2(context, -// &context->data[context->dataNum]->task, -// &context->data[Element]->element); -//} +/* + __code createTask2(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Queue* waitMe, struct OdsQueue* waitI, struct Element* element, struct Queue* activeQueue) { + int i = loopCounter->i; + + task->code = TaskC; + task->key = i; + task->waitMe = waitMe; + task->waitI = waitI; + task->idsCount = 1; + + element->data = (union Data *)task; + + context->next = CreateData1; + loopCounter->i++; + + goto meta_createTask2(context, activeQueue, PutQueue1); + } + + __code createTask2_stub(struct Context* context) { + goto createTask2(context, + &context->data[LoopCounter]->loopCounter, + &context->data[context->dataNum]->task, + &context->data[context->dataNum-1]->queue, + &context->data[context->dataNum-2]->odsQueue, + &context->data[Element]->element, + &context->data[ActiveQueue]->queue); + } + + __code createTask3(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Task* slave, struct Element* element) { + int i = loopCounter->i; + + task->code = TaskB; + task->key = i; + element->data = (union Data *)task; + + context->next = CreateData1; + loopCounter->i++; + + goto meta(context, WaitFor1); + } + + __code createTask3_stub(struct Context* context) { + goto createTask2(context, + &context->data[context->dataNum]->task, + &context->data[Element]->element); + } + */ __code putQueue1(struct Context* context, struct Allocate* allocate) { allocate->size = sizeof(struct Element);