comparison src/parallel_execution/generate_stub.pl @ 442:481fce540daf

Fix goto implement method of generate_stub
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Tue, 21 Nov 2017 09:16:12 +0900
parents 3c6af75b13d4
children 0c024ea61601
comparison
equal deleted inserted replaced
441:5a737c3df91c 442:481fce540daf
66 # 66 #
67 # goto nodeStack->push((union Data*)node, stackTest3); 67 # goto nodeStack->push((union Data*)node, stackTest3);
68 # 68 #
69 # generated meta level code 69 # generated meta level code
70 # 70 #
71 # Gearef(context, Stack)->stack = nodeStack->stack; 71 # Gearef(context, Stack)->stack = (union Data*)nodeStack;
72 # Gearef(context, Stack)->data = (union Data*)node; 72 # Gearef(context, Stack)->data = (union Data*)node;
73 # Gearef(context, Stack)->next = C_stackTest3; 73 # Gearef(context, Stack)->next = C_stackTest3;
74 # goto meta(context, nodeStack->push); 74 # goto meta(context, nodeStack->push);
75 75
76 sub getDataGear { 76 sub getDataGear {
100 $interface = $1; 100 $interface = $1;
101 $implementation = $3; 101 $implementation = $3;
102 if ( -f "$interface.cbc") { 102 if ( -f "$interface.cbc") {
103 &getDataGear("$interface.cbc"); 103 &getDataGear("$interface.cbc");
104 } 104 }
105 } elsif (/^(\s)*(\w+)\-\>(\w+)\s\=\s\((.*)\)create(\w+)\((.*)\);$/) { 105 } elsif (/\s*\=\s*(.*)create(\w+)\((.*)\);$/) {
106 #my $intfn = ucfirst($2); 106 #my $intfn = ucfirst($2);
107 my $impln = $5; 107 my $impln = $2;
108 if ( -f "$impln.cbc") { 108 if ( -f "$impln.cbc") {
109 &getCodeGear("$impln.cbc"); 109 &getCodeGear("$impln.cbc");
110 } 110 }
111 } elsif(/^(.*)par goto (\w+)\((.*)\)/) { 111 } elsif(/^(.*)par goto (\w+)\((.*)\)/) {
112 my $codeGearName = $2; 112 my $codeGearName = $2;
391 if ($v eq $next) { 391 if ($v eq $next) {
392 $ntype = $t; 392 $ntype = $t;
393 $ftype = lcfirst($ntype); 393 $ftype = lcfirst($ntype);
394 } 394 }
395 } 395 }
396 print $fd "\tGearef(context, $ntype)->$ftype = $next->$ftype;\n"; 396 print $fd "\tGearef(context, $ntype)->$ftype = (union Data*) $next;\n";
397 # Put interface argument 397 # Put interface argument
398 my $prot = $code{$ntype}->{$method}; 398 my $prot = $code{$ntype}->{$method};
399 my $i = 1; 399 my $i = 1;
400 for my $arg (@args) { 400 for my $arg (@args) {
401 my $pType; 401 my $pType;
413 } else { 413 } else {
414 print $fd "\tGearef(context, $ntype)->$pName = $arg;\n"; 414 print $fd "\tGearef(context, $ntype)->$pName = $arg;\n";
415 } 415 }
416 $i++; 416 $i++;
417 } 417 }
418 print $fd "${prev}goto meta(context, $next->$ftype->$ntype.$method);\n"; 418 print $fd "${prev}goto meta(context, $next->$method);\n";
419 next; 419 next;
420 } elsif(/^(.*)par goto (\w+)\((.*)\);/) { 420 } elsif(/^(.*)par goto (\w+)\((.*)\);/) {
421 # handling par goto statement 421 # handling par goto statement
422 # convert it to the parallel 422 # convert it to the parallel
423 my $prev = $1; 423 my $prev = $1;