Mercurial > hg > Members > Moririn
comparison src/parallel_execution/context.h @ 148:473b7d990a1f
fix data gears type enum
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 10 Nov 2016 12:07:53 +0900 |
parents | f2275f5777f4 |
children | 63ab65b28466 |
comparison
equal
deleted
inserted
replaced
147:f2275f5777f4 | 148:473b7d990a1f |
---|---|
10 #define NEW(type) (type*)(calloc(1, sizeof(type))) | 10 #define NEW(type) (type*)(calloc(1, sizeof(type))) |
11 #define NEWN(n, type) (type*)(calloc(n, sizeof(type))) | 11 #define NEWN(n, type) (type*)(calloc(n, sizeof(type))) |
12 | 12 |
13 #define ALLOC_DATA(context, dseg) ({\ | 13 #define ALLOC_DATA(context, dseg) ({\ |
14 struct Meta* meta = (struct Meta*)context->heap;\ | 14 struct Meta* meta = (struct Meta*)context->heap;\ |
15 meta->type = dseg;\ | 15 meta->type = D_##dseg;\ |
16 context->heap += sizeof(struct Meta);\ | 16 context->heap += sizeof(struct Meta);\ |
17 context->data[dseg] = context->heap; context->heap += sizeof(struct dseg); (struct dseg *)context->data[dseg]; }) | 17 context->data[D_##dseg] = context->heap; context->heap += sizeof(struct dseg); (struct dseg *)context->data[D_##dseg]; }) |
18 | 18 |
19 #define ALLOC_DATA_TYPE(context, dseg, t) ({\ | 19 #define ALLOC_DATA_TYPE(context, dseg, t) ({\ |
20 struct Meta* meta = (struct Meta*)context->heap;\ | 20 struct Meta* meta = (struct Meta*)context->heap;\ |
21 meta->type = t;\ | 21 meta->type = D_##t;\ |
22 context->heap += sizeof(struct Meta);\ | 22 context->heap += sizeof(struct Meta);\ |
23 context->data[dseg] = context->heap; context->heap += sizeof(struct t); (struct t *)context->data[dseg]; }) | 23 context->data[D_##dseg] = context->heap; context->heap += sizeof(struct t); (struct t *)context->data[D_##dseg]; }) |
24 | 24 |
25 #define ALLOCATE(context, t) ({ \ | 25 #define ALLOCATE(context, t) ({ \ |
26 struct Meta* meta = (struct Meta*)context->heap;\ | 26 struct Meta* meta = (struct Meta*)context->heap;\ |
27 context->heap += sizeof(struct Meta);\ | 27 context->heap += sizeof(struct Meta);\ |
28 union Data* data = context->heap; \ | 28 union Data* data = context->heap; \ |
29 context->heap += sizeof(struct t); \ | 29 context->heap += sizeof(struct t); \ |
30 meta->type = t; \ | 30 meta->type = D_##t; \ |
31 data; }) | 31 data; }) |
32 | 32 |
33 #define GET_TYPE(dseg) ({ \ | 33 #define GET_TYPE(dseg) ({ \ |
34 struct Meta* meta = (struct Meta*)(((void*)dseg) - sizeof(struct Meta));\ | 34 struct Meta* meta = (struct Meta*)(((void*)dseg) - sizeof(struct Meta));\ |
35 meta->type; }) | 35 meta->type; }) |
109 GT, | 109 GT, |
110 LT, | 110 LT, |
111 }; | 111 }; |
112 | 112 |
113 enum DataType { | 113 enum DataType { |
114 Worker, | 114 D_Worker, |
115 Allocate, | 115 D_Allocate, |
116 SingleLinkedStack, | 116 D_SingleLinkedStack, |
117 Stack, | 117 D_Stack, |
118 Tree, | 118 D_Tree, |
119 Traverse, | 119 D_Traverse, |
120 RotateTree, | 120 D_RotateTree, |
121 Node, | 121 D_Node, |
122 LoopCounter, | 122 D_LoopCounter, |
123 Time, | 123 D_Time, |
124 Element, | 124 D_Element, |
125 ActiveQueue, | 125 D_ActiveQueue, |
126 WaitQueue, | 126 D_WaitQueue, |
127 Queue | 127 D_Queue |
128 }; | 128 }; |
129 | 129 |
130 struct Context { | 130 struct Context { |
131 enum Code next; | 131 enum Code next; |
132 int codeNum; | 132 int codeNum; |