Mercurial > hg > GearsTemplate
changeset 496:809974b25ecb
Genrate stub for MultiDimIterator
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 01 Jan 2018 06:37:29 +0900 |
parents | 2e7ea81e5943 |
children | 01f0a2cdcc43 |
files | src/parallel_execution/MultiDimIterator.cbc src/parallel_execution/SynchronizedQueue.cbc src/parallel_execution/generate_stub.pl |
diffstat | 3 files changed, 5 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/MultiDimIterator.cbc Sun Dec 31 04:36:20 2017 +0900 +++ b/src/parallel_execution/MultiDimIterator.cbc Mon Jan 01 06:37:29 2018 +0900 @@ -65,14 +65,6 @@ goto taskManager->spawn(task, next(...)); } -__code execMultiDimIterator_stub(struct Context* context) { - MultiDimIterator* iterator = (MultiDimIterator*)GearImpl(context, Iterator, iterator); - Context* task = Gearef(context, Iterator)->task; - int numGPU = Gearef(context, Iterator)->numGPU; - enum Code next = Gearef(context, Iterator)->next; - goto execMultiDimIterator(context, iterator, task, numGPU, next); -} - __code execMultiDimIterator1(struct MultiDimIterator* iterator, struct Context* task, __code next(...)) { int x = iterator->counterX; int y = iterator->counterY; @@ -82,13 +74,6 @@ goto taskManager->spawn(iterateTask, execMultiDimIterator2); } -__code execMultiDimIterator1_stub(struct Context* context) { - MultiDimIterator* iterator = (MultiDimIterator*)GearImpl(context, Iterator, iterator); - Context* task = Gearef(context, Iterator)->task; - enum Code next = Gearef(context, Iterator)->next; - goto execMultiDimIterator1(context, iterator, task, next); -} - __code execMultiDimIterator2(struct MultiDimIterator* iterator, struct Context* task, __code next(...)) { if (++iterator->counterX >= iterator->x) { iterator->counterX = 0;
--- a/src/parallel_execution/SynchronizedQueue.cbc Sun Dec 31 04:36:20 2017 +0900 +++ b/src/parallel_execution/SynchronizedQueue.cbc Mon Jan 01 06:37:29 2018 +0900 @@ -5,7 +5,7 @@ #include <stdio.h> /* - * Nonnon-blocking queue of Paper: Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms(https://www.research.ibm.com/people/m/michael/podc-1996.pdf). + * Non-blocking queue of Paper: Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms(https://www.research.ibm.com/people/m/michael/podc-1996.pdf). */ Queue* createSynchronizedQueue(struct Context* context) {
--- a/src/parallel_execution/generate_stub.pl Sun Dec 31 04:36:20 2017 +0900 +++ b/src/parallel_execution/generate_stub.pl Mon Jan 01 06:37:29 2018 +0900 @@ -126,7 +126,7 @@ if (/^\s*(.*)\s+(\w+);$/ ) { my $ttype = $1; my $tname = $2; - if ($ttype =~ /^(union|struct) (\w+)/) { + if ($ttype =~ /^(union|struct)?\s*(\w+)/) { $ttype = $2; } $var{$name}->{$tname} = $ttype; @@ -188,7 +188,7 @@ $inputIncFlag = 0; $outputCount = split(/,/,$3); $outputCount--; - } elsif ($args =~ s/^(struct|union) (\w+)(\*)+\s(\w+)//) { + } elsif ($args =~ s/^(struct|union)?\s*(\w+)(\*)+\s(\w+)//) { if($inputIncFlag) { $inputCount++; } @@ -350,7 +350,7 @@ for my $arg (@args) { $arg =~ s/^\s*//; last if ($arg =~ /\.\.\./); - $arg =~ s/^(struct|union)? (\w+)(\**)\s(\w+)//; + $arg =~ s/^(struct|union)?\s*(\w+)(\**)\s(\w+)//; my $structType = $1; my $typeName = $2; my $ptrType = $3; @@ -361,7 +361,7 @@ $newArgs .= ",$structType $typeName **O_$varName"; } } - } elsif ($args =~ s/^(struct|union)? (\w+)(\**)\s(\w+)//) { + } elsif ($args =~ s/^(struct|union)?\s*(\w+)(\**)\s(\w+)//) { my $structType = $1; my $typeName = $2; my $ptrType = $3;