diff src/include/allocate.h @ 15:907c69e21e56

modify allocate
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 14 Apr 2015 03:37:22 +0900
parents a765eb7f3b7c
children 1eb599acffe4
line wrap: on
line diff
--- a/src/include/allocate.h	Fri Apr 10 17:57:38 2015 +0900
+++ b/src/include/allocate.h	Tue Apr 14 03:37:22 2015 +0900
@@ -1,16 +1,12 @@
 __code allocate();
 __code meta_allocate();
+extern __code meta();
 
-__code allocate(Context* context, int size, int num, __code (*next)()) {
-    goto meta_allocate(context, size, num, next);
+__code allocate(struct Context* context) {
+    goto meta_allocate(context);
 }
 
-__code meta_allocate(Context* context, int size, int num, __code (*next)()) {
-    context->next = next;
-    void* ds = context->ds;
-    context->ds += size*num;
-    ((mdata*)context->mds)->ds = ds;
-    ((mdata*)context->mds)->size = size;
-    context->mds = (mdata*)context->mds+1;
-    goto context->next(context, (data1*)ds);
+__code meta_allocate(struct Context* context) {
+    context->dataSize++;
+    goto (context->code[context->data[context->dataSize-1]->allocate.next])(context);
 }