changeset 472:a4d94c591246

Replace "goto meta" for TaskManagerImpl
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Tue, 26 Dec 2017 15:19:42 +0900
parents ac244346c85d
children 71b634a5ed65
files src/parallel_execution/TaskManagerImpl.cbc
diffstat 1 files changed, 6 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/TaskManagerImpl.cbc	Mon Dec 25 18:10:56 2017 +0900
+++ b/src/parallel_execution/TaskManagerImpl.cbc	Tue Dec 26 15:19:42 2017 +0900
@@ -103,15 +103,13 @@
 }
 
 __code spawnTasksTaskManagerImpl5(struct TaskManagerImpl* taskManagerImpl, struct Context* task, struct TaskManager* taskManager) {
-    taskManager->task = task;
-    taskManager->next = C_spawnTasksTaskManagerImpl3;
-    goto meta(context, C_spawnTaskManagerImpl);
+    goto taskManager->spawn(task, spawnTasksTaskManagerImpl3);
 }
 
 __code spawnTasksTaskManagerImpl5_stub(struct Context* context) {
     TaskManagerImpl* taskManagerImpl = (TaskManagerImpl*)GearImpl(context, TaskManager, taskManager);
     Context* task = (struct Context*)Gearef(context, Queue)->data;
-    TaskManager* taskManager = Gearef(context, TaskManager);
+    TaskManager* taskManager = &Gearef(context, TaskManager)->taskManager->TaskManager;
     goto spawnTasksTaskManagerImpl5(context, taskManagerImpl, task, taskManager);
 }
 
@@ -154,7 +152,7 @@
             struct Iterator* iterator = task->iterator;
             goto iterator->exec(task, taskManager->cpu - taskManager->gpu, next(...));
         }
-        goto meta(context, C_taskSend);
+        goto taskSend();
     }
     pthread_mutex_unlock(&taskManager->mutex);
     goto next(...);
@@ -178,18 +176,10 @@
     goto queue->put(task, next(...));
 }
 
-__code taskSend_stub(struct Context* context) {
-    TaskManagerImpl* taskManager = (TaskManagerImpl*)GearImpl(context, TaskManager, taskManager);
-    goto taskSend(context,
-                  taskManager,
-                  Gearef(context, TaskManager)->task,
-                  Gearef(context, TaskManager)->next);
-}
-
 __code shutdownTaskManagerImpl(struct TaskManagerImpl* taskManager, __code next(...)) {
     if (taskManager->taskCount != 0) {
         usleep(1000);
-        goto meta(context, C_shutdownTaskManagerImpl);
+        goto shutdownTaskManagerImpl();
     }
     int i = taskManager->loopCounter->i;
     if (i < taskManager->numWorker) {
@@ -198,12 +188,12 @@
     }
 
     taskManager->loopCounter->i = 0;
-    goto meta(context, next);
+    goto next(...);
 }
 
 __code shutdownTaskManagerImpl1(struct TaskManagerImpl* taskManager) {
     int i = taskManager->loopCounter->i;
     pthread_join(taskManager->workers[i]->thread, NULL);
     taskManager->loopCounter->i++;
-    goto meta(context, C_shutdownTaskManagerImpl);
+    goto shutdownTaskManagerImpl();
 }