changeset 347:9578c38c10d1

Fix
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Tue, 30 May 2017 18:21:19 +0900
parents 9f8a87389b68
children c03159481cb6
files src/parallel_execution/CMakeLists.txt src/parallel_execution/examples/Add.cbc src/parallel_execution/examples/Mult.cbc
diffstat 3 files changed, 16 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/CMakeLists.txt	Tue May 30 03:38:38 2017 +0900
+++ b/src/parallel_execution/CMakeLists.txt	Tue May 30 18:21:19 2017 +0900
@@ -67,7 +67,7 @@
   TARGET
       calc
   SOURCES 
-      examples/calc.cbc SingleLinkedStack.cbc CPUWorker.cbc time.cbc twice.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc SemaphoreImpl.cbc
+      examples/calc.cbc examples/Add.cbc examples/Mult.cbc examples/calc.cbc SingleLinkedStack.cbc CPUWorker.cbc time.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc SemaphoreImpl.cbc
 )
 
 if (${USE_CUDA})
--- a/src/parallel_execution/examples/Add.cbc	Tue May 30 03:38:38 2017 +0900
+++ b/src/parallel_execution/examples/Add.cbc	Tue May 30 18:21:19 2017 +0900
@@ -22,6 +22,13 @@
     goto meta(context, C_setWaitTask)
 }
 
+__code setAddCodeGearInfo_stub(struct Context* context) {
+	Context* codeGear = (Context *)GearIpl(context, CodeGear, codeGear);
+	Data* dataGears = Gearef(context, CodeGear)->dataGears;
+	enum Code next = Gearef(context, CodeGear)->next;
+	goto setAddCodeGearInfo(context, codeGear, dataGears, next);
+}
+
 __code setWaitTask(struct Context* codeGear, struct Queue* Queue, struct LoopCounter* loopCounter, union Data** dataGears, __code next(...)) {
     if(loopCounter->i < codeGear->idgCount) {
         queue->queue = (Data *)GET_WAIT_LIST(data);
@@ -40,17 +47,8 @@
     goto setWaitTask(context, codeGear, Gearef(context, Queue), Gearef(codeGear, LoopCounter), Gearef(context, CodeGear)->dataGears, Gearef(context, CodeGear)->next);
 }
 
-__code add(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...)) {
+__code add(struct Integer* input1, struct Integer* input2, __code next(union Integer* output, ...)) {
     output->value = input1->value + input2->value;
     printf("%d + %d = %d\n", input1->value, input2->value, output->value);
-    goto meta(context, next);
+    goto next(output, ...)
 }
-
-__code add_stub(struct Context* context) {
-    goto add(context,
-            &context->data[context->idg]->Integer,
-            &context->data[context->idg + 1]->Integer,
-            &context->data[context->odg]->Integer,
-            context->next);
-}
-
--- a/src/parallel_execution/examples/Mult.cbc	Tue May 30 03:38:38 2017 +0900
+++ b/src/parallel_execution/examples/Mult.cbc	Tue May 30 18:21:19 2017 +0900
@@ -22,23 +22,15 @@
     goto meta(context, C_setWaitTask)
 }
 
-__code setWaitTask_stub(struct Context* context) {
-    Context* codeGear = GearImpl(context, CodeGear, codeGear)
-    goto setWaitTask(context, codeGear, Gearef(context, Queue), Gearef(codeGear, LoopCounter), Gearef(context, CodeGear)->dataGears, Gearef(context, CodeGear)->next);
+__code setMultCodeGearInfo_stub(struct Context* context) {
+	Context* codeGear = (Context *)GearIpl(context, CodeGear, codeGear);
+	Data* dataGears = Gearef(context, CodeGear)->dataGears;
+	enum Code next = Gearef(context, CodeGear)->next;
+	goto setMultCodeGearInfo(context, codeGear, dataGears, next);
 }
 
 __code mult(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...)) {
     output->value = input1->value * input2->value;
     printf("%d + %d = %d\n", input1->value, input2->value, output->value);
-    goto meta(context, next);
+    goto next(output, ...)
 }
-
-__code mult_stub(struct Context* context) {
-    goto mult(context,
-            &context->data[context->idg]->Integer,
-            &context->data[context->idg + 1]->Integer,
-            &context->data[context->odg]->Integer,
-            context->next);
-
-}
-