annotate src/include/allocate.h @ 17:1eb599acffe4

modify allocate
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 21 Apr 2015 02:28:57 +0900
parents 907c69e21e56
children ec4e7a81bddf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
a765eb7f3b7c implement delete, traverse
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 __code allocate();
a765eb7f3b7c implement delete, traverse
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 __code meta_allocate();
15
907c69e21e56 modify allocate
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
3 extern __code meta();
13
a765eb7f3b7c implement delete, traverse
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
15
907c69e21e56 modify allocate
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
5 __code allocate(struct Context* context) {
907c69e21e56 modify allocate
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
6 goto meta_allocate(context);
13
a765eb7f3b7c implement delete, traverse
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 }
a765eb7f3b7c implement delete, traverse
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
15
907c69e21e56 modify allocate
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
9 __code meta_allocate(struct Context* context) {
17
1eb599acffe4 modify allocate
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
10 context->data[context->dataSize] = context->heap;
1eb599acffe4 modify allocate
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
11 context->heap += sizeof(union Data);
15
907c69e21e56 modify allocate
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
12 context->dataSize++;
907c69e21e56 modify allocate
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
13 goto (context->code[context->data[context->dataSize-1]->allocate.next])(context);
13
a765eb7f3b7c implement delete, traverse
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 }