Mercurial > hg > Members > Moririn
comparison src/parallel_execution/main.c @ 160:73c393f0dca3
fix main.c
author | mir3636 |
---|---|
date | Fri, 18 Nov 2016 18:16:30 +0900 |
parents | 63ab65b28466 |
children | 06cfc1289361 |
comparison
equal
deleted
inserted
replaced
159:f2c77b0761fc | 160:73c393f0dca3 |
---|---|
85 | 85 |
86 __code createData1_stub(struct Context* context) { | 86 __code createData1_stub(struct Context* context) { |
87 goto createData1(context, &context->data[D_Allocate]->allocate, &context->data[D_LoopCounter]->loopCounter); | 87 goto createData1(context, &context->data[D_Allocate]->allocate, &context->data[D_LoopCounter]->loopCounter); |
88 } | 88 } |
89 | 89 |
90 __code createData2(struct Context* context, struct LoopCounter* loopCounter, struct Array* array, struct Node* node) { | 90 __code createData2(struct Context* context, struct LoopCounter* loopCounter, struct Array* array, struct Node* node, Tree* tree) { |
91 int i = loopCounter->i; | 91 int i = loopCounter->i; |
92 | 92 |
93 array->index = i; | 93 array->index = i; |
94 array->prefix = length/split; | 94 array->prefix = length/split; |
95 array->array = array_ptr; | 95 array->array = array_ptr; |
96 | 96 |
97 node->key = i; | 97 node->key = i; |
98 node->value = (union Data*)array; | 98 node->value = (union Data*)array; |
99 | 99 |
100 context->next = CreateTask1; | 100 tree->next = CreateTask1; |
101 | 101 tree->node = node; |
102 goto meta(context, C_put); | 102 |
103 goto meta(context, loopCounter->tree->put); | |
103 } | 104 } |
104 | 105 |
105 __code createData2_stub(struct Context* context) { | 106 __code createData2_stub(struct Context* context) { |
106 goto createData2(context, | 107 goto createData2(context, |
107 &context->data[D_LoopCounter]->loopCounter, | 108 &context->data[D_LoopCounter]->loopCounter, |
108 &context->data[context->dataNum]->array, | 109 &context->data[context->dataNum]->array, |
109 &context->data[D_Node]->node); | 110 &context->data[D_Node]->node, |
110 } | 111 Gearef(context, Tree)); |
111 | 112 } |
112 __code createTask1(struct Context* context, struct Allocate* allocate) { | 113 |
113 allocate->size = sizeof(struct Task); | 114 __code createTask1(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Queue* waitMe, struct Queue* waitI, struct Element* element, struct Queue* activeQueue) { |
114 allocator(context); | |
115 goto meta(context, CreateTask2); | |
116 } | |
117 | |
118 __code createTask1_stub(struct Context* context) { | |
119 goto createTask1(context, &context->data[D_Allocate]->allocate); | |
120 } | |
121 | |
122 __code createTask2(struct Context* context, struct Allocate* allocate) { | |
123 allocate->size = sizeof(struct Queue); | |
124 allocator(context); | |
125 goto meta(context, CreateTask3); | |
126 } | |
127 | |
128 __code createTask2_stub(struct Context* context) { | |
129 goto createTask2(context, &context->data[D_Allocate]->allocate); | |
130 } | |
131 | |
132 __code createTask3(struct Context* context, struct Allocate* allocate) { | |
133 allocate->size = sizeof(struct Queue); | |
134 allocator(context); | |
135 goto meta(context, CreateTask4); | |
136 } | |
137 | |
138 __code createTask3_stub(struct Context* context) { | |
139 goto createTask3(context, &context->data[D_Allocate]->allocate); | |
140 } | |
141 | |
142 __code meta_createTask4(struct Context* context, struct Queue* activeQueue, enum Code next) { | |
143 context->data[D_Queue] = (union Data *)activeQueue; | |
144 goto (context->code[next])(context); | |
145 } | |
146 | |
147 __code createTask4(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Queue* waitMe, struct Queue* waitI, struct Element* element, struct Queue* activeQueue) { | |
148 int i = loopCounter->i; | 115 int i = loopCounter->i; |
149 | 116 |
150 waitMe->first = 0; | 117 waitMe->first = 0; |
151 waitMe->last = 0; | 118 waitMe->last = 0; |
152 waitMe->count = 0; | 119 waitMe->count = 0; |
167 loopCounter->i++; | 134 loopCounter->i++; |
168 | 135 |
169 goto meta(context, SpawnTask); | 136 goto meta(context, SpawnTask); |
170 } | 137 } |
171 | 138 |
172 __code createTask4_stub(struct Context* context) { | 139 __code createTask1_stub(struct Context* context) { |
173 goto createTask4(context, | 140 Task* task = &ALLOCATE(context, Task)->Task; |
141 Queue* waitMe = &ALLOCATE(context, Queue)->Queue; | |
142 Queue* waitI = &ALLOCATE(context, Queue)->Queue; | |
143 goto createTask1(context, | |
174 &context->data[D_LoopCounter]->loopCounter, | 144 &context->data[D_LoopCounter]->loopCounter, |
175 &context->data[context->dataNum-2]->task, | 145 task, |
176 &context->data[context->dataNum-1]->queue, | 146 waitMe, |
177 &context->data[context->dataNum]->queue, | 147 waitI, |
178 &context->data[D_Element]->element, | 148 &context->data[D_Element]->element, |
179 &context->data[D_ActiveQueue]->queue); | 149 &context->data[D_ActiveQueue]->queue); |
180 } | 150 } |
181 | 151 |
182 | 152 |