annotate src/parallel_execution/twice.c @ 217:c34e6aa10967

Fix DataGear access name
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Mon, 09 Jan 2017 01:18:13 +0900
parents 119c035e0e36
children 8d2519c3a36e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
92
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
1 #include <stdio.h>
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
2
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
3 #include "context.h"
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
4 #include "origin_cs.h"
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
5
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
6 __code twice(struct Context* context, struct LoopCounter* loopCounter, int index, int prefix, int* array) {
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
7 int i = loopCounter->i;
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
8
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
9 if (i < prefix) {
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
10 array[i+index*prefix] = array[i+index*prefix]*2;
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
11 loopCounter->i++;
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
12
193
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 189
diff changeset
13 goto meta(context, C_twice);
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
14 }
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
15
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
16 loopCounter->i = 0;
92
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
17
131
a4507906938c Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 109
diff changeset
18 //stack_pop(context->code_stack, &context->next);
92
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
19 goto meta(context, context->next);
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
20 }
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
21
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
22 __code twice_stub(struct Context* context) {
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
23 goto twice(context,
217
c34e6aa10967 Fix DataGear access name
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 196
diff changeset
24 &context->data[D_LoopCounter]->LoopCounter,
c34e6aa10967 Fix DataGear access name
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 196
diff changeset
25 context->data[D_Node]->Node.value->Array.index,
c34e6aa10967 Fix DataGear access name
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 196
diff changeset
26 context->data[D_Node]->Node.value->Array.prefix,
c34e6aa10967 Fix DataGear access name
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 196
diff changeset
27 context->data[D_Node]->Node.value->Array.array);
92
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
28 }