changeset 529:e5e3025f503a

Generate twice stub
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Sat, 27 Jan 2018 22:59:38 +0900
parents 82ff74c2f162
children 1566caacdaae
files src/parallel_execution/examples/twice/createArray.cbc src/parallel_execution/examples/twice/printArray.cbc src/parallel_execution/examples/twice/twice.cbc src/parallel_execution/generate_stub.pl
diffstat 4 files changed, 8 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/examples/twice/createArray.cbc	Sat Jan 27 22:25:33 2018 +0900
+++ b/src/parallel_execution/examples/twice/createArray.cbc	Sat Jan 27 22:59:38 2018 +0900
@@ -6,8 +6,6 @@
 extern int split;
 
 __code createArray(__code next(struct Array* output, struct Timer* output1, ...), struct LoopCounter* loopCounter) {
-    struct Array* output = *O_output;
-    struct Timer* output1 = *O_output1;
     int i = loopCounter->i;
     if (i == 0){
         output->array = (Int*)ALLOCATE_ARRAY(context, Int, length);
@@ -18,21 +16,9 @@
         loopCounter->i = 0;
         *O_output = output;
         *O_output1 = output1;
-        goto output1->start(next(...));
+        goto output1->start(next(output, output1, ...));
     }
     output->array[i] = i;
     loopCounter->i++;
-    *O_output = output;
-    *O_output1 = output1;
-    goto meta(context, C_createArray);
+    goto createArray();
 }
-
-__code createArray_stub(struct Context* context) {
-    Array** O_output = (struct Array **)&context->data[context->odg];
-    Timer** O_output1 = (struct Timer**)&context->data[context->odg+1];
-    goto createArray(context,
-            context->next,
-            O_output,
-            O_output1,
-            Gearef(context, LoopCounter));
-}
--- a/src/parallel_execution/examples/twice/printArray.cbc	Sat Jan 27 22:25:33 2018 +0900
+++ b/src/parallel_execution/examples/twice/printArray.cbc	Sat Jan 27 22:59:38 2018 +0900
@@ -6,31 +6,17 @@
     goto inputTimer->end(printArray1);
 }
 
-__code printArray_stub(struct Context* context) {
-    goto printArray(context,
-                   &context->data[context->idg]->Array,
-                   &context->data[context->idg+1]->Timer,
-                   context->next);
-}
-
 __code printArray1(struct Array* array, __code next(...), struct LoopCounter* loopCounter){
     int i = loopCounter->i;
     //printf("%d\n", array->array[i]);
     if (i < GET_LEN(array->array)) {
         if (array->array[i] == i*2) {
             loopCounter->i++;
-            goto meta(context, C_printArray1);
+            goto printArray1();
         } else {
             printf("wrong result\n");
         }
     }
    loopCounter->i = 0;
-    goto meta(context, next);
+    goto next(...);
 }
-
-__code printArray1_stub(struct Context* context) {
-    goto printArray1(context,
-            &context->data[context->idg]->Array,
-            context->next,
-            Gearef(context, LoopCounter));
-}
--- a/src/parallel_execution/examples/twice/twice.cbc	Sat Jan 27 22:25:33 2018 +0900
+++ b/src/parallel_execution/examples/twice/twice.cbc	Sat Jan 27 22:59:38 2018 +0900
@@ -7,7 +7,6 @@
 #endif
 
 __code twice(struct Array* array, struct MultiDim* multiDim, __code next(struct Array* output, ...), struct LoopCounter* loopCounter) {
-    struct Array* output = *O_output;
     int i = loopCounter->i;
     int index = multiDim->x;
     if (i < array->prefix) {
@@ -19,7 +18,7 @@
 
     loopCounter->i = 0;
     output->array = array->array;
-    goto meta(context, context->next);
+    goto next(output, ...);
 }
 
 __code twice_stub(struct Context* context) {
--- a/src/parallel_execution/generate_stub.pl	Sat Jan 27 22:25:33 2018 +0900
+++ b/src/parallel_execution/generate_stub.pl	Sat Jan 27 22:59:38 2018 +0900
@@ -446,7 +446,9 @@
                 my $prev = $1;
                 my $next = $2;
                 my $method = $3;
-                my @args = split(/,/,$4);
+                my $tmpArgs = $4;
+                $tmpArgs =~ s/\(.*\)/\(\)/;
+                my @args = split(/,/,$tmpArgs);
                 my @types = @{$dataGearVarType{$codeGearName}};
                 my $ntype;
                 my $ftype;