annotate src/parallel_execution/context.h @ 199:9c85c3a34726

Cmake macro
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 19 Dec 2016 11:36:18 +0900
parents 081607dcf893
children 7470b8382672
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Context definition for llrb example */
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
2 #ifndef CONTEXT_H
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
3 #define CONTEXT_H
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 #include <pthread.h>
101
8987cf13d5bb Add Allocate macro
innparusu
parents: 98
diff changeset
5 #ifdef USE_CUDA
98
d400948dbbab add Cuda infomation to context
ikkun
parents: 95
diff changeset
6 #include <cuda.h>
101
8987cf13d5bb Add Allocate macro
innparusu
parents: 98
diff changeset
7 #endif
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
9 #define ALLOCATE_SIZE 20000000
101
8987cf13d5bb Add Allocate macro
innparusu
parents: 98
diff changeset
10 #define NEW(type) (type*)(calloc(1, sizeof(type)))
8987cf13d5bb Add Allocate macro
innparusu
parents: 98
diff changeset
11 #define NEWN(n, type) (type*)(calloc(n, sizeof(type)))
8987cf13d5bb Add Allocate macro
innparusu
parents: 98
diff changeset
12
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
13 #define ALLOC_DATA(context, dseg) ({\
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
14 struct Meta* meta = (struct Meta*)context->heap;\
148
473b7d990a1f fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 147
diff changeset
15 meta->type = D_##dseg;\
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
16 context->heap += sizeof(struct Meta);\
148
473b7d990a1f fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 147
diff changeset
17 context->data[D_##dseg] = context->heap; context->heap += sizeof(struct dseg); (struct dseg *)context->data[D_##dseg]; })
101
8987cf13d5bb Add Allocate macro
innparusu
parents: 98
diff changeset
18
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
19 #define ALLOC_DATA_TYPE(context, dseg, t) ({\
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
20 struct Meta* meta = (struct Meta*)context->heap;\
148
473b7d990a1f fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 147
diff changeset
21 meta->type = D_##t;\
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
22 context->heap += sizeof(struct Meta);\
148
473b7d990a1f fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 147
diff changeset
23 context->data[D_##dseg] = context->heap; context->heap += sizeof(struct t); (struct t *)context->data[D_##dseg]; })
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
25 #define ALLOCATE(context, t) ({ \
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
26 struct Meta* meta = (struct Meta*)context->heap;\
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
27 context->heap += sizeof(struct Meta);\
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
28 union Data* data = context->heap; \
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
29 context->heap += sizeof(struct t); \
148
473b7d990a1f fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 147
diff changeset
30 meta->type = D_##t; \
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
31 data; })
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
32
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
33 #define GET_TYPE(dseg) ({ \
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
34 struct Meta* meta = (struct Meta*)(((void*)dseg) - sizeof(struct Meta));\
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
35 meta->type; })
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
36
149
63ab65b28466 Add Gearef macro
one
parents: 148
diff changeset
37 #define Gearef(context, t) (&(context)->data[D_##t]->t)
186
dbc064c26b98 generate context script
mir3636
parents: 185
diff changeset
38
dbc064c26b98 generate context script
mir3636
parents: 185
diff changeset
39 #include "c/enumCode.h"
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 enum Relational {
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 EQ,
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 GT,
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 LT,
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 };
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46
186
dbc064c26b98 generate context script
mir3636
parents: 185
diff changeset
47 #include "c/enumData.h"
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 struct Context {
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 enum Code next;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 int codeNum;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 __code (**code) (struct Context*);
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 void* heapStart;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 void* heap;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 long heapLimit;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 pthread_t thread;
92
851da1107223 implement twice
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
57 int thread_num;
87
9e139a340bd1 rename directory
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 86
diff changeset
58 int dataNum;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 union Data **data;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 };
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 union Data {
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
63 struct Meta {
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
64 enum DataType type;
176
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
65 struct Queue* wait; // tasks waiting this dataGear
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
66 } meta;
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
67 struct Time {
102
64c98838a291 remove stack StartTime&EndTime
ikkun
parents: 101
diff changeset
68 enum Code next;
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
69 double time;
149
63ab65b28466 Add Gearef macro
one
parents: 148
diff changeset
70 } Time;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 struct LoopCounter {
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 int i;
166
mir3636
parents: 153
diff changeset
73 struct Tree* tree;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 } loopCounter;
176
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
75 struct TaskManager {
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
76 int numWorker;
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
77 enum Code spawn;
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
78 enum Code shutdown;
184
mir3636
parents: 183
diff changeset
79 enum Code deadLockDetected;
mir3636
parents: 183
diff changeset
80 enum Code next;
176
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
81 struct Worker* workers;
184
mir3636
parents: 183
diff changeset
82 } TaskManager;
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
83 struct TaskManagerImpl {
184
mir3636
parents: 183
diff changeset
84 struct Queue* activeQueue;
mir3636
parents: 183
diff changeset
85 struct Queue* taskQueue;
mir3636
parents: 183
diff changeset
86 } TaskManagerImpl;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 struct Worker {
176
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
88 int id;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 struct Context* contexts;
176
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
90 enum Code execute;
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
91 enum Code taskSend;
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
92 enum Code taskRecive;
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
93 enum Code shutdown;
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
94 struct Queue* tasks;
184
mir3636
parents: 183
diff changeset
95 } Worker;
101
8987cf13d5bb Add Allocate macro
innparusu
parents: 98
diff changeset
96 #ifdef USE_CUDA
98
d400948dbbab add Cuda infomation to context
ikkun
parents: 95
diff changeset
97 struct CudaTask {
d400948dbbab add Cuda infomation to context
ikkun
parents: 95
diff changeset
98 CUdevice device;
d400948dbbab add Cuda infomation to context
ikkun
parents: 95
diff changeset
99 CUcontext cuCtx;
d400948dbbab add Cuda infomation to context
ikkun
parents: 95
diff changeset
100 CUfunction code;
d400948dbbab add Cuda infomation to context
ikkun
parents: 95
diff changeset
101 CUdeviceptr* deviceptr;
d400948dbbab add Cuda infomation to context
ikkun
parents: 95
diff changeset
102 CUstream stream;
185
247a2c4a8908 fix compile errors
mir3636
parents: 184
diff changeset
103 } Cudatask;
187
bacc37265386 main.o fixed
mir3636
parents: 186
diff changeset
104 #else
bacc37265386 main.o fixed
mir3636
parents: 186
diff changeset
105 struct CudaTask {
bacc37265386 main.o fixed
mir3636
parents: 186
diff changeset
106 enum Code next;
bacc37265386 main.o fixed
mir3636
parents: 186
diff changeset
107 } Cudatask;
101
8987cf13d5bb Add Allocate macro
innparusu
parents: 98
diff changeset
108 #endif
177
bb52f7f77bf5 add main
ikkun
parents: 176
diff changeset
109 struct Main {
bb52f7f77bf5 add main
ikkun
parents: 176
diff changeset
110 enum Code code;
bb52f7f77bf5 add main
ikkun
parents: 176
diff changeset
111 enum Code next;
bb52f7f77bf5 add main
ikkun
parents: 176
diff changeset
112 struct Queue* args;
185
247a2c4a8908 fix compile errors
mir3636
parents: 184
diff changeset
113 } Main;
90
4b5bf5b40970 put queue
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
114 struct Task {
4b5bf5b40970 put queue
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
115 enum Code code;
176
f0427e27dd7b create interface of Task, TaskManager, Worker
mir3636
parents: 172
diff changeset
116 struct Queue* dataGears;
112
e3cba827d489 Add spawnTask CS
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 109
diff changeset
117 int idsCount;
166
mir3636
parents: 153
diff changeset
118 } Task;
169
ea7b11f3e717 Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 168
diff changeset
119 // Queue Interface
90
4b5bf5b40970 put queue
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
120 struct Queue {
136
a747dc9d4da6 stack refactering no compile error
mir3636
parents: 135
diff changeset
121 union Data* queue;
167
34562e63981f create queue.c
mir3636
parents: 166
diff changeset
122 union Data* data;
34562e63981f create queue.c
mir3636
parents: 166
diff changeset
123 enum Code whenEmpty;
34562e63981f create queue.c
mir3636
parents: 166
diff changeset
124 enum Code clear;
34562e63981f create queue.c
mir3636
parents: 166
diff changeset
125 enum Code put;
34562e63981f create queue.c
mir3636
parents: 166
diff changeset
126 enum Code take;
34562e63981f create queue.c
mir3636
parents: 166
diff changeset
127 enum Code isEmpty;
130
2bb5e4f0fd35 Stackinterface
ikkun
parents: 124
diff changeset
128 enum Code next;
184
mir3636
parents: 183
diff changeset
129 } Queue;
167
34562e63981f create queue.c
mir3636
parents: 166
diff changeset
130 struct SingleLinkedQueue {
34562e63981f create queue.c
mir3636
parents: 166
diff changeset
131 struct Element* top;
34562e63981f create queue.c
mir3636
parents: 166
diff changeset
132 struct Element* last;
184
mir3636
parents: 183
diff changeset
133 } SingleLinkedQueue;
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
134 // Stack Interface
130
2bb5e4f0fd35 Stackinterface
ikkun
parents: 124
diff changeset
135 struct Stack {
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
136 union Data* stack;
130
2bb5e4f0fd35 Stackinterface
ikkun
parents: 124
diff changeset
137 union Data* data;
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
138 union Data* data1;
169
ea7b11f3e717 Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 168
diff changeset
139 enum Code whenEmpty;
145
cc071cf1ba85 add stack clear interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 144
diff changeset
140 enum Code clear;
130
2bb5e4f0fd35 Stackinterface
ikkun
parents: 124
diff changeset
141 enum Code push;
2bb5e4f0fd35 Stackinterface
ikkun
parents: 124
diff changeset
142 enum Code pop;
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
143 enum Code pop2;
130
2bb5e4f0fd35 Stackinterface
ikkun
parents: 124
diff changeset
144 enum Code isEmpty;
134
2eccf4564efe fix stack call in rb_tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 133
diff changeset
145 enum Code get;
133
568730b1239e call stack interface in rb_tree
mir3636
parents: 132
diff changeset
146 enum Code get2;
130
2bb5e4f0fd35 Stackinterface
ikkun
parents: 124
diff changeset
147 enum Code next;
194
081607dcf893 create generate_stub.pl
mir3636
parents: 187
diff changeset
148 } Stack;
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
149 // Stack implementations
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
150 struct SingleLinkedStack {
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
151 struct Element* top;
194
081607dcf893 create generate_stub.pl
mir3636
parents: 187
diff changeset
152 } SingleLinkedStack;
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
153 struct ArrayStack {
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
154 int size;
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
155 int limit;
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
156 struct Element* array;
194
081607dcf893 create generate_stub.pl
mir3636
parents: 187
diff changeset
157 } ArrayStack;
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
158 // Stack implementation end
90
4b5bf5b40970 put queue
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
159 struct Element {
113
d05b9937aa95 Change element data from Task to Data
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
160 union Data* data;
90
4b5bf5b40970 put queue
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
161 struct Element* next;
194
081607dcf893 create generate_stub.pl
mir3636
parents: 187
diff changeset
162 } Element;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 struct Array {
90
4b5bf5b40970 put queue
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
164 int index;
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
165 int prefix;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 int* array;
194
081607dcf893 create generate_stub.pl
mir3636
parents: 187
diff changeset
167 } Array;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 struct Tree {
166
mir3636
parents: 153
diff changeset
169 union Data* tree;
mir3636
parents: 153
diff changeset
170 struct Node* node;
152
7164f59660d4 create .cbc
mir3636
parents: 149
diff changeset
171 enum Code put;
7164f59660d4 create .cbc
mir3636
parents: 149
diff changeset
172 enum Code get;
7164f59660d4 create .cbc
mir3636
parents: 149
diff changeset
173 enum Code remove;
171
747067fe46bd Fix selected Queue
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 170
diff changeset
174 enum Code clear;
152
7164f59660d4 create .cbc
mir3636
parents: 149
diff changeset
175 enum Code next;
166
mir3636
parents: 153
diff changeset
176 } Tree;
172
661b0b0d0399 replace Tree to RedBlackTree
ikkun
parents: 171
diff changeset
177 struct RedBlackTree {
152
7164f59660d4 create .cbc
mir3636
parents: 149
diff changeset
178 struct Node* root;
122
73a679a85c04 node stack rewrite
ikkun
parents: 119
diff changeset
179 struct Node* current; // reading node of original tree
138
04a2f486a30d insert works but is not balanced
kono
parents: 136
diff changeset
180 struct Node* previous; // parent of reading node of original tree
124
36ac17d37be4 Fix compile error but not work
one
parents: 122
diff changeset
181 struct Node* newNode; // writing node of new tree
143
34a7a21edc36 recude stack get using traverse field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
182 struct Node* parent;
34a7a21edc36 recude stack get using traverse field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 138
diff changeset
183 struct Node* grandparent;
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
184 struct Stack* nodeStack;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 int result;
172
661b0b0d0399 replace Tree to RedBlackTree
ikkun
parents: 171
diff changeset
186 } RedBlackTree;
147
f2275f5777f4 add treeRotate data
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 145
diff changeset
187 struct RotateTree {
f2275f5777f4 add treeRotate data
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 145
diff changeset
188 enum Code next;
172
661b0b0d0399 replace Tree to RedBlackTree
ikkun
parents: 171
diff changeset
189 struct RedBlackTree* traverse;
147
f2275f5777f4 add treeRotate data
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 145
diff changeset
190 struct Tree* tree;
f2275f5777f4 add treeRotate data
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 145
diff changeset
191 } rotateTree;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 struct Node {
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 int key; // comparable data segment
90
4b5bf5b40970 put queue
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 87
diff changeset
194 union Data* value;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 struct Node* left;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 struct Node* right;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 // need to balancing
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 enum Color {
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 Red,
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 Black,
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 } color;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 } node;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 struct Allocate {
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 enum Code next;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 long size;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 } allocate;
112
e3cba827d489 Add spawnTask CS
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 109
diff changeset
207 struct OutPutDataSegments {
e3cba827d489 Add spawnTask CS
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 109
diff changeset
208 union Data **data;
e3cba827d489 Add spawnTask CS
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 109
diff changeset
209 } ods;
186
dbc064c26b98 generate context script
mir3636
parents: 185
diff changeset
210 }; // union Data end
113
d05b9937aa95 Change element data from Task to Data
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
211
186
dbc064c26b98 generate context script
mir3636
parents: 185
diff changeset
212 #include "c/typedefData.h"
147
f2275f5777f4 add treeRotate data
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 145
diff changeset
213
113
d05b9937aa95 Change element data from Task to Data
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
214 union MetaData {
d05b9937aa95 Change element data from Task to Data
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
215 struct Queue waitMeTasks;
d05b9937aa95 Change element data from Task to Data
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
216 struct Queue waitI;
d05b9937aa95 Change element data from Task to Data
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
217 };
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
218 #endif