annotate src/parallel_execution/context.c @ 186:dbc064c26b98

generate context script
author mir3636
date Thu, 15 Dec 2016 19:38:18 +0900
parents 247a2c4a8908
children bacc37265386
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 #include <stdlib.h>
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #include "context.h"
132
7c309e1aea73 Code Gears stack api
one
parents: 131
diff changeset
4 #include "stack.h"
167
34562e63981f create queue.c
mir3636
parents: 148
diff changeset
5 #include "queue.h"
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
186
dbc064c26b98 generate context script
mir3636
parents: 185
diff changeset
7 #include "c/extern.h"
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 __code initContext(struct Context* context) {
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE;
101
8987cf13d5bb Add Allocate macro
innparusu
parents: 95
diff changeset
11 context->code = (__code(**) (struct Context*)) NEWN(ALLOCATE_SIZE, void*);
8987cf13d5bb Add Allocate macro
innparusu
parents: 95
diff changeset
12 context->data = NEWN(ALLOCATE_SIZE, union Data*);
8987cf13d5bb Add Allocate macro
innparusu
parents: 95
diff changeset
13 context->heapStart = NEWN(context->heapLimit, char);
8987cf13d5bb Add Allocate macro
innparusu
parents: 95
diff changeset
14 context->heap = context->heapStart;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 context->codeNum = Exit;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
186
dbc064c26b98 generate context script
mir3636
parents: 185
diff changeset
18 #include "c/codeGearInit.c"
178
5077cf9bf54e add TaskManager.c
mir3636
parents: 172
diff changeset
19
186
dbc064c26b98 generate context script
mir3636
parents: 185
diff changeset
20 #include "c/dataGearInit.c"
101
8987cf13d5bb Add Allocate macro
innparusu
parents: 95
diff changeset
21
170
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 169
diff changeset
22 context->data[D_ActiveQueue] = createSynchronizedQueue(context);
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 169
diff changeset
23 context->data[D_WaitQueue] = createSynchronizedQueue(context);
109
059b26a250cc Change put_queue process
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 101
diff changeset
24
148
473b7d990a1f fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 147
diff changeset
25 context->dataNum = D_Queue;
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 }