Mercurial > hg > GearsTemplate
changeset 546:d8e87b3b2be0
fix goto parGotoMeta
author | mir3636 |
---|---|
date | Tue, 15 May 2018 18:55:32 +0900 |
parents | 161eb5f9751d |
children | 8814524d29ae |
files | src/parallel_execution/generate_context.pl src/parallel_execution/generate_stub.pl |
diffstat | 2 files changed, 11 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/generate_context.pl Tue May 15 17:26:33 2018 +0900 +++ b/src/parallel_execution/generate_context.pl Tue May 15 18:55:32 2018 +0900 @@ -169,9 +169,10 @@ my $meta_call = <<"EOFEOF"; __code meta(struct Context* context, enum Code next) { // printf("meta %d\\n",next); - if (context->task == NULL) { - goto (context->code[next])(context); - } + goto (context->code[next])(context); +} + +__code parGotoMeta(struct Context* context, enum Code next) { context->task = NULL; context->taskList = NULL; goto (context->code[Gearef(context, TaskManager)->taskManager->TaskManager.spawnTasks])(context);
--- a/src/parallel_execution/generate_stub.pl Tue May 15 17:26:33 2018 +0900 +++ b/src/parallel_execution/generate_stub.pl Tue May 15 18:55:32 2018 +0900 @@ -330,7 +330,7 @@ my $prevCodeGearName; my $inTypedef = 0; my $inStub = 0; - my $inParGoto = 0; + my $hasParGoto = 0; my $inMain = 0 ; my %stub; my $codeGearName; @@ -509,8 +509,8 @@ $args =~ s/iterate\((.*)?\),//; my @dataGears = split(/,\s*/, $args); my $nextCodeGear = pop(@dataGears); - if (! $inParGoto) { - $inParGoto = 1; + if (! $hasParGoto) { + $hasParGoto = 1; print $fd "${prev}struct Element* element;\n"; } my $initTask = << "EOFEOF"; @@ -570,7 +570,7 @@ my $v = shift(@args); print $fd "\t*O_$arg = $v;\n"; } - if ($inParGoto) { + if ($hasParGoto) { print $fd "${prev}Gearef(context, TaskManager)->taskList = context->taskList;\n"; print $fd "${prev}Gearef(context, TaskManager)->next1 = C_$next;\n"; print $fd "${prev}goto meta(context, C_$next);\n"; @@ -579,10 +579,10 @@ } next; } - if ($inParGoto) { + if ($hasParGoto) { print $fd "${prev}Gearef(context, TaskManager)->taskList = context->taskList;\n"; print $fd "${prev}Gearef(context, TaskManager)->next1 = C_$next;\n"; - print $fd "${prev}goto meta(context, C_$next);\n"; + print $fd "${prev}goto parGotoMeta(context, C_$next);\n"; next; } elsif ($next eq "meta") { print $fd $_; @@ -597,7 +597,7 @@ $localVarType{$varName} = $type; s/new\s+(\w+)\(\)/\&ALLOCATE(context, \1)->\1/g; # replacing new } elsif(/^}/) { - $inParGoto = 0; + $hasParGoto = 0; } else { s/new\s+(\w+)\(\)/\&ALLOCATE(context, \1)->\1/g; # replacing new }