diff src/synchronizedQueue/synchronizedQueueForCas.c @ 66:a870c84acd0e

Change synchronizedQueue allocator from __code to Function call
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Tue, 15 Sep 2015 15:21:50 +0900
parents 2a40d697bf4e
children 765ee56d68f1
line wrap: on
line diff
--- a/src/synchronizedQueue/synchronizedQueueForCas.c	Tue Jul 14 15:59:41 2015 +0900
+++ b/src/synchronizedQueue/synchronizedQueueForCas.c	Tue Sep 15 15:21:50 2015 +0900
@@ -14,27 +14,22 @@
 #define NUM 100
 
 extern __code initSynchronizedQueueContext(struct Context* context);
+extern void allocator(struct Context* context);
 
-//__code code1(struct Context* context) {
-//    context->data[Allocate]->allocate.size = sizeof(struct Element);
-//    context->data[Allocate]->allocate.next = Code2;
-//    goto meta(context, Allocator);
-//}
 
 __code meta(struct Context* context, enum Code next) {
     goto (context->code[next])(context);
 }
 
-//__code code2(struct Context* context) {
-//    context->data[Allocate]->allocate.after_put = Code3;
-//    context->data[context->dataNum] -> element.value = 1024;
-//    goto meta(context, Sender);
+//__code code1(struct Context* context) {
+//    context->data[Allocate]->allocate.size = sizeof(struct Element);
+//    goto code2(context);
 //}
 
 __code code1(struct Context* context, struct Allocate* allocate) {
     allocate->size = sizeof(long);
-    allocate->next = Code2;
-    goto meta(context, Allocator);
+    allocator(context);
+    goto meta(context, Code2);
 }
 
 __code code1_stub(struct Context* context) {
@@ -52,8 +47,8 @@
 
 __code code3(struct Context* context, struct Allocate* allocate) {
     allocate->size = sizeof(long);
-    allocate->next = Code4;
-    goto meta(context, Allocator);
+    allocator(context);
+    goto meta(context, Code4);
 }
 
 __code code3_stub(struct Context* context) {
@@ -75,8 +70,8 @@
         goto meta(context, ThreadExit);
     }
     allocate->size = sizeof(struct Element);
-    allocate->next = Code6;
-    goto meta(context, Allocator);
+    allocator(context);
+    goto meta(context, Code6);
 }
 
 __code code5_stub(struct Context* context) {
@@ -151,8 +146,8 @@
 
 __code code7(struct Context* context, struct Allocate* allocate) {
     allocate->size = sizeof(long);
-    allocate->next = Code8;
-    goto meta(context, Allocator);
+    allocator(context);
+    goto meta(context, Code8);
 }
 
 __code code7_stub(struct Context* context) {
@@ -170,8 +165,8 @@
 
 __code code9(struct Context* context, struct Allocate* allocate) {
     allocate->size = sizeof(long);
-    allocate->next = Code10;
-    goto meta(context, Allocator);
+    allocator(context);
+    goto meta(context, Code10);
 }
 
 __code code9_stub(struct Context* context) {