# HG changeset patch # User Tatsuki IHA # Date 1517062372 -32400 # Node ID c31912aaa3781f18bd3d70a8b41152268c5caafd # Parent 1566caacdaaeae06a2408354afac225f4e60443f Generate boundedBuffer example stub diff -r 1566caacdaae -r c31912aaa378 src/parallel_execution/examples/boundedBuffer/consumer.cbc --- 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 #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); } diff -r 1566caacdaae -r c31912aaa378 src/parallel_execution/examples/boundedBuffer/initBuffer.cbc --- 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); -} diff -r 1566caacdaae -r c31912aaa378 src/parallel_execution/examples/boundedBuffer/producer.cbc --- 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)); -}