annotate src/parallel_execution/allocate.c @ 130:2bb5e4f0fd35

Stackinterface
author ikkun
date Mon, 10 Oct 2016 20:19:26 +0900
parents 9e139a340bd1
children a4507906938c
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 "context.h"
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
130
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
3 union Data* allocator(struct Context* context) {
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 context->data[++context->dataNum] = context->heap;
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 context->heap += context->data[Allocate]->allocate.size;
130
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
6 return context->data[context->dataNum];
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 }
130
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
8
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
9 __code allocator(struct Context* context, struct Allocate* allocate) {
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
10 context->data[++context->dataNum] = context->heap;
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
11 context->heap += allocate->size;
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
12 goto meta(context, allocate->next);
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
13 }
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
14
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
15 __code allocator_stub(struct Context* context) {
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
16 goto allocator(context, &context->[Allocate]->allocate);
2bb5e4f0fd35 Stackinterface
ikkun
parents: 87
diff changeset
17 }