changeset 719:2316193f7999

...
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 08 Sep 2020 18:26:33 +0900
parents 7c79694229d3
children de34a5f91c62
files src/parallel_execution/examples/pop_and_push/StackTestImpl3.cbc src/parallel_execution/generate_stub.pl src/parallel_execution/tools/trans_impl.pl src/parallel_execution/tools/update_implheader.pl
diffstat 4 files changed, 24 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/examples/pop_and_push/StackTestImpl3.cbc	Tue Sep 01 20:32:46 2020 +0900
+++ b/src/parallel_execution/examples/pop_and_push/StackTestImpl3.cbc	Tue Sep 08 18:26:33 2020 +0900
@@ -26,13 +26,13 @@
     goto stack->pop2(pop2Test1);
 }
 
-__code pop2Test3(struct StackTestImpl3* stackTest, struct Stack* stack, __code next(union Data* data, union Data* data1, ...)) {
+__code pop2Test3(struct StackTestImpl3* stackTest, struct Stack* stack, __code next(...)) {
     String* str = NEW(String);
     str->size = 200;
     String* str1 = NEW(String);
     str1->size = 300;
-    data = (union Data*)str;
-    data1 = (union Data*)str1;
+    union Data* data = (union Data*)str;
+    union Data* data1 = (union Data*)str1;
 
     goto pop2Test1(stackTest, data, data1);
 }
@@ -52,5 +52,12 @@
     StackTest2* stackTest2 = createStackTest2Impl(context);
     String* str = NEW(String);
     str->size = 100;
-    goto stackTest2->insertTest1((union Data*)str, pop2Test);
+    goto stackTest2->insertTest1(stack, (union Data*)str, pop2Test);
 }
+
+__code insertTest4(struct StackTestImpl3* stackTest, struct Stack* stack, __code next(...)) {
+    StackTest2* stackTest2 = createStackTest2Impl(context);
+    String* str = NEW(String);
+    str->size = 100;
+    goto stackTest2->insertTest1(stack, (union Data*)str, pop2Test);
+}
--- a/src/parallel_execution/generate_stub.pl	Tue Sep 01 20:32:46 2020 +0900
+++ b/src/parallel_execution/generate_stub.pl	Tue Sep 08 18:26:33 2020 +0900
@@ -255,7 +255,9 @@
 
                 if ($nextOutPutArgs) {
                   my $tmpArgHash = {};
-                  map { $tmpArgHash->{$_} = $typeName } @$nextOutPutArgs;
+                  for my $vname (@$nextOutPutArgs) {
+                    $tmpArgHash->{$vname} = $typeName;
+                  }
 
                   $outputStubElem->{args} = $tmpArgHash;
 
@@ -310,8 +312,8 @@
     }
 
 
-    if ($implInterfaceInfo->{isImpl}) {
-      for my $shouldImplCode (map { $_->{name} } @{$implInterfaceInfo->{parsedInterfaceInfo}->{codes}}) {
+    if ($implInterfaceInfo->{isImpl} && $filename =~ /\.cbc\z/) {
+      for my $shouldImplCode (map { $_->{name} } grep { $_->{args} =~ /Impl/ } @{$implInterfaceInfo->{parsedInterfaceInfo}->{codes}}) {
         my $isDefine = $shouldImplCode;
         for my $implCode (keys %{$codeGearInfo}) {
           if ($implCode =~  /$shouldImplCode/) {
--- a/src/parallel_execution/tools/trans_impl.pl	Tue Sep 01 20:32:46 2020 +0900
+++ b/src/parallel_execution/tools/trans_impl.pl	Tue Sep 08 18:26:33 2020 +0900
@@ -78,7 +78,9 @@
   my ($out, $impl_file) = @_;
   my $line =  Gears::Util->slup($impl_file);
   print $out "// ----\n";
-  map { print $out "// $_\n" } split /\n/, $line;
+  for my $c (split /\n/, $line) {
+    print $out "// $c\n";
+  }
   print $out "// ----\n\n";
 }
 
@@ -247,7 +249,7 @@
   emit_include_part($fh, $interface->{ir}->{name},$context_deeps);
   emit_impl_header_in_comment($fh, $impl_file);
   emit_constracutor($fh,$impl,$interface);
-  map { print $fh $_ } @{$under_code};
+  print $fh $_ for @{$under_code};
   close $fh;
 }
 
--- a/src/parallel_execution/tools/update_implheader.pl	Tue Sep 01 20:32:46 2020 +0900
+++ b/src/parallel_execution/tools/update_implheader.pl	Tue Sep 08 18:26:33 2020 +0900
@@ -17,7 +17,7 @@
   find_codes_from_cbc(shift @ARGV, $interface_name, \%cbc_code_names);
 }
 
-map  { push(@{$cbc_code_names{order_list}}, $_)}
+@{$cbc_code_names{order_list}} =
         sort { $cbc_code_names{codes}->{$a}->{order} <=> $cbc_code_names{codes}->{$b}->{order} } keys %{$cbc_code_names{codes}};
 
 my $write_codes = create_new_header_codes($header_con,\%cbc_code_names);
@@ -46,8 +46,7 @@
     }
   }
   close $fh;
-  my @order_code_names;
-  map  { push(@order_code_names, $_)}  sort { $order{$a} <=> $order{$b} } keys %order;
+  my @order_code_names = sort { $order{$a} <=> $order{$b} } keys %order;
   return { codes => \%contents, order => \@order_code_names }, $interface_name;
 }
 
@@ -84,7 +83,7 @@
 
   push(@res, "");
   if (%cbc_codes) {
-    map { push(@res, $cbc_codes{$_}->{line})} sort { $cbc_codes{$a}->{order} <=> $cbc_codes{$b}->{order}} keys %cbc_codes;
+    push(@res, $cbc_codes{$_}->{line}) for sort { $cbc_codes{$a}->{order} <=> $cbc_codes{$b}->{order}} keys %cbc_codes;
   }
   return \@res;
 }
@@ -101,7 +100,7 @@
   close $fh;
   open $fh, '>', $header_file;
   print $fh "typedef struct $impl <Type, Isa> impl $interface {\n";
-  map { print $fh "    $_\n"}  @$write_codes;
+  print $fh "    $_\n" for  @$write_codes;
   print $fh "    __code next(...);\n";
   print $fh "} $impl;\n";
   close $fh;