Mercurial > hg > Members > innparusu > Gears
comparison src/parallel_execution/main.c @ 111:556e203de999
Add dependency.c
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 02 May 2016 20:39:02 +0900 |
parents | 059b26a250cc |
children | e3cba827d489 |
comparison
equal
deleted
inserted
replaced
110:fbcdbe8db53c | 111:556e203de999 |
---|---|
48 goto code1(context); | 48 goto code1(context); |
49 } | 49 } |
50 | 50 |
51 __code code2(struct Context* context, struct Array* array, struct LoopCounter* loopCounter) { | 51 __code code2(struct Context* context, struct Array* array, struct LoopCounter* loopCounter) { |
52 int i = loopCounter->i; | 52 int i = loopCounter->i; |
53 | 53 |
54 if (i < length) { | 54 if (i < length) { |
55 // printf("%d\n", array->array[i]); | 55 // printf("%d\n", array->array[i]); |
56 if (array->array[i] == (i*2)) { | 56 if (array->array[i] == (i*2)) { |
57 loopCounter->i++; | 57 loopCounter->i++; |
58 goto meta(context, Code2); | 58 goto meta(context, Code2); |
79 } | 79 } |
80 | 80 |
81 loopCounter->i = 0; | 81 loopCounter->i = 0; |
82 goto meta(context, Code1); | 82 goto meta(context, Code1); |
83 } | 83 } |
84 | 84 |
85 __code createData1_stub(struct Context* context) { | 85 __code createData1_stub(struct Context* context) { |
86 goto createData1(context, &context->data[Allocate]->allocate, &context->data[LoopCounter]->loopCounter); | 86 goto createData1(context, &context->data[Allocate]->allocate, &context->data[LoopCounter]->loopCounter); |
87 } | 87 } |
88 | 88 |
89 __code createData2(struct Context* context, struct LoopCounter* loopCounter, struct Array* array, struct Node* node) { | 89 __code createData2(struct Context* context, struct LoopCounter* loopCounter, struct Array* array, struct Node* node) { |
93 array->prefix = length/split; | 93 array->prefix = length/split; |
94 array->array = array_ptr; | 94 array->array = array_ptr; |
95 | 95 |
96 node->key = i; | 96 node->key = i; |
97 node->value = (union Data*)array; | 97 node->value = (union Data*)array; |
98 | 98 |
99 context->next = CreateTask1; | 99 context->next = CreateTask1; |
100 | 100 |
101 goto meta(context, PutTree); | 101 goto meta(context, PutTree); |
102 } | 102 } |
103 | 103 |
104 __code createData2_stub(struct Context* context) { | 104 __code createData2_stub(struct Context* context) { |
105 goto createData2(context, | 105 goto createData2(context, |
106 &context->data[LoopCounter]->loopCounter, | 106 &context->data[LoopCounter]->loopCounter, |
107 &context->data[context->dataNum]->array, | 107 &context->data[context->dataNum]->array, |
108 &context->data[Node]->node); | 108 &context->data[Node]->node); |
109 } | 109 } |
110 | 110 |
111 __code createTask1(struct Context* context, struct Allocate* allocate) { | 111 __code createTask1(struct Context* context, struct Allocate* allocate) { |
112 allocate->size = sizeof(struct Task); | 112 allocate->size = sizeof(struct Task); |
113 allocator(context); | 113 allocator(context); |
143 &context->data[LoopCounter]->loopCounter, | 143 &context->data[LoopCounter]->loopCounter, |
144 &context->data[context->dataNum]->task, | 144 &context->data[context->dataNum]->task, |
145 &context->data[Element]->element, | 145 &context->data[Element]->element, |
146 &context->data[ActiveQueue]->queue); | 146 &context->data[ActiveQueue]->queue); |
147 } | 147 } |
148 | |
149 | |
150 //__code createTask2(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Element* element) { | |
151 // int i = loopCounter->i; | |
152 // | |
153 // task->code = TaskC; | |
154 // task->key = i; | |
155 // | |
156 // element->task = task; | |
157 // | |
158 // context->next = CreateData1; | |
159 // loopCounter->i++; | |
160 // | |
161 // goto meta(context, PutQueue1); | |
162 //} | |
163 // | |
164 //__code createTask2_stub(struct Context* context) { | |
165 // goto createTask2(context, | |
166 // &context->data[LoopCounter]->loopCounter, | |
167 // &context->data[context->dataNum]->task, | |
168 // &context->data[Element]->element); | |
169 //} | |
170 // | |
171 //__code createTask3(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Task* slave, struct Element* element) { | |
172 // int i = loopCounter->i; | |
173 // | |
174 // task->code = TaskB; | |
175 // task->key = i; | |
176 // element->task = task; | |
177 // | |
178 // context->next = CreateData1; | |
179 // loopCounter->i++; | |
180 // | |
181 // goto meta(context, WaitFor1); | |
182 //} | |
183 // | |
184 //__code createTask3_stub(struct Context* context) { | |
185 // goto createTask2(context, | |
186 // &context->data[context->dataNum]->task, | |
187 // &context->data[Element]->element); | |
188 //} | |
148 | 189 |
149 __code putQueue1(struct Context* context, struct Allocate* allocate) { | 190 __code putQueue1(struct Context* context, struct Allocate* allocate) { |
150 allocate->size = sizeof(struct Element); | 191 allocate->size = sizeof(struct Element); |
151 allocator(context); | 192 allocator(context); |
152 | 193 |