86
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 #include "context.h"
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2
|
130
|
3 union Data* allocator(struct Context* context) {
|
86
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 context->data[++context->dataNum] = context->heap;
|
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 context->heap += context->data[Allocate]->allocate.size;
|
130
|
6 return context->data[context->dataNum];
|
86
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 }
|
130
|
8
|
|
9 __code allocator(struct Context* context, struct Allocate* allocate) {
|
|
10 context->data[++context->dataNum] = context->heap;
|
|
11 context->heap += allocate->size;
|
|
12 goto meta(context, allocate->next);
|
|
13 }
|
|
14
|
|
15 __code allocator_stub(struct Context* context) {
|
|
16 goto allocator(context, &context->[Allocate]->allocate);
|
|
17 }
|