changeset 547:8814524d29ae

get code gear before continuation
author mir3636
date Tue, 26 Jun 2018 20:16:03 +0900
parents d8e87b3b2be0
children 4fdeb0afc187
files src/parallel_execution/SingleLinkedQueue.cbc src/parallel_execution/SingleLinkedStack.cbc src/parallel_execution/context.h src/parallel_execution/generate_stub.pl
diffstat 4 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/SingleLinkedQueue.cbc	Tue May 15 18:55:32 2018 +0900
+++ b/src/parallel_execution/SingleLinkedQueue.cbc	Tue Jun 26 20:16:03 2018 +0900
@@ -57,9 +57,10 @@
 }
 
 __code isEmptySingleLinkedQueue(struct SingleLinkedQueue* queue, __code next(...), __code whenEmpty(...)) {
-    if (queue->top == queue->last)
+    if (queue->top == queue->last) {
         goto whenEmpty(...);
-    else
+    } else {
         goto next(...);
+    }
 }
 
--- a/src/parallel_execution/SingleLinkedStack.cbc	Tue May 15 18:55:32 2018 +0900
+++ b/src/parallel_execution/SingleLinkedStack.cbc	Tue Jun 26 20:16:03 2018 +0900
@@ -100,10 +100,11 @@
 }
     
 __code isEmptySingleLinkedStack(struct SingleLinkedStack* stack, __code next(...), __code whenEmpty(...)) {
-    if (stack->top)
+    if (stack->top) {
         goto next(...);
-    else
+    } else {
         goto whenEmpty(...);
+    }
 }
 
 
--- a/src/parallel_execution/context.h	Tue May 15 18:55:32 2018 +0900
+++ b/src/parallel_execution/context.h	Tue Jun 26 20:16:03 2018 +0900
@@ -119,6 +119,7 @@
     /* multi dimension parameter */
     int iterate;
     struct Iterator* iterator;
+    enum Code before;
 };
 
 typedef int Int;
@@ -445,7 +446,8 @@
 extern __code start_code(struct Context* context);
 extern __code exit_code(struct Context* context);
 extern __code meta(struct Context* context, enum Code next);
-extern __code par_meta(struct Context* context, enum Code spawns, enum Code next);
+//extern __code par_meta(struct Context* context, enum Code spawns, enum Code next);
+extern __code parGotoMeta(struct Context* context, enum Code next);
 extern void initContext(struct Context* context);
 
 #endif
--- a/src/parallel_execution/generate_stub.pl	Tue May 15 18:55:32 2018 +0900
+++ b/src/parallel_execution/generate_stub.pl	Tue Jun 26 20:16:03 2018 +0900
@@ -489,6 +489,7 @@
                     }
                     $i++;
                 }
+                print $fd "${prev}context->before = C_$codeGearName;\n";
                 print $fd "${prev}goto meta(context, $next->$method);\n";
                 next;
             } elsif(/^(.*)par goto (\w+)\((.*)\);/) {
@@ -575,6 +576,7 @@
                         print $fd "${prev}Gearef(context, TaskManager)->next1 = C_$next;\n";
                         print $fd "${prev}goto meta(context, C_$next);\n";
                     } else {
+                        print $fd "${prev}context->before = C_$codeGearName;\n";
                         print $fd "${prev}goto meta(context, $next);\n";
                     }
                     next;
@@ -588,6 +590,7 @@
                     print $fd $_;
                     next;
                 } else {
+                    print $fd "${prev}context->before = C_$codeGearName;\n";
                     print $fd "${prev}goto meta(context, C_$next);\n";
                     next;
                 }