changeset 531:c31912aaa378

Generate boundedBuffer example stub
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Sat, 27 Jan 2018 23:12:52 +0900
parents 1566caacdaae
children 3881b91f5820
files src/parallel_execution/examples/boundedBuffer/consumer.cbc src/parallel_execution/examples/boundedBuffer/initBuffer.cbc src/parallel_execution/examples/boundedBuffer/producer.cbc
diffstat 3 files changed, 6 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/examples/boundedBuffer/consumer.cbc	Sat Jan 27 23:05:27 2018 +0900
+++ b/src/parallel_execution/examples/boundedBuffer/consumer.cbc	Sat Jan 27 23:12:52 2018 +0900
@@ -2,24 +2,16 @@
 #include <stdio.h>
 #interface "Buffer.h"
 
-__code consumer(struct Buffer* buffer, Int length, __code next(...), struct LoopCounter* loopCounter) {
+__code consumer(struct Buffer* buffer, Int* length, __code next(...), struct LoopCounter* loopCounter) {
     int i = loopCounter->i;
-    if (i < length) {
+    if (i < *length) {
         loopCounter->i++;
         goto buffer->take(consumer1);
     }
     goto next(...);
 }
 
-__code consumer_stub(struct Context* context) {
-    goto consumer(context,
-                  &context->data[context->idg]->Buffer,
-                  context->data[context->idg+1]->Int,
-                  context->next,
-                  Gearef(context, LoopCounter));
-}
-
-__code consumer1(struct Buffer* buffer, Int length, __code next(...), struct Node* node) {
+__code consumer1(struct Buffer* buffer, Int* length, __code next(...), struct Node* node) {
     printf("getData %d\n", node->value->Int);
     goto consumer();
 }
@@ -27,7 +19,7 @@
 __code consumer1_stub(struct Context* context) {
     goto consumer1(context,
                    &context->data[context->idg]->Buffer,
-                   context->data[context->idg+1]->Int,
+                   &context->data[context->idg+1]->Int,
                    context->next,
                    &Gearef(context, Buffer)->data->Node);
 }
--- a/src/parallel_execution/examples/boundedBuffer/initBuffer.cbc	Sat Jan 27 23:05:27 2018 +0900
+++ b/src/parallel_execution/examples/boundedBuffer/initBuffer.cbc	Sat Jan 27 23:12:52 2018 +0900
@@ -1,16 +1,5 @@
 #include "../../../context.h"
 
 __code initBuffer(__code next(struct Buffer* output, Int* output1, ...)) {
-    struct Buffer* output = *O_output;
-    Int* output1 = *O_output1;
     goto next(output, output1, ...);
 }
-
-__code initBuffer_stub(struct Context* context) {
-    struct Buffer** O_output = (struct Buffer**)&context->data[context->odg];
-    Int** O_output1 = (Int**)&context->data[context->odg+1];
-    goto initBuffer(context,
-                  context->next,
-                  O_output,
-                  O_output1);
-}
--- a/src/parallel_execution/examples/boundedBuffer/producer.cbc	Sat Jan 27 23:05:27 2018 +0900
+++ b/src/parallel_execution/examples/boundedBuffer/producer.cbc	Sat Jan 27 23:12:52 2018 +0900
@@ -1,9 +1,9 @@
 #include "../../../context.h"
 #interface "Buffer.h"
 
-__code producer(struct Buffer* buffer, Int length, __code next(...), struct LoopCounter* loopCounter) {
+__code producer(struct Buffer* buffer, Int* length, __code next(...), struct LoopCounter* loopCounter) {
     int i = loopCounter->i;
-    if (i < length) {
+    if (i < *length) {
         Node* node = new Node();
         node->value = (union Data*)new Int();
         node->value->Int = i;
@@ -12,11 +12,3 @@
     }
     goto next(...);
 }
-
-__code producer_stub(struct Context* context) {
-    goto producer(context,
-                  &context->data[context->idg]->Buffer,
-                  context->data[context->idg+1]->Int,
-                  context->next,
-                  Gearef(context, LoopCounter));
-}