changeset 102:64c98838a291

remove stack StartTime&EndTime
author ikkun
date Wed, 02 Mar 2016 20:51:33 +0900
parents 8987cf13d5bb
children 6402a33250a6
files src/parallel_execution/context.h src/parallel_execution/main.c src/parallel_execution/time.c
diffstat 3 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/context.h	Wed Mar 02 19:23:00 2016 +0900
+++ b/src/parallel_execution/context.h	Wed Mar 02 20:51:33 2016 +0900
@@ -106,6 +106,7 @@
 
 union Data {
     struct Time {
+        enum Code next;
         double time;
     } time;
     struct LoopCounter {
--- a/src/parallel_execution/main.c	Wed Mar 02 19:23:00 2016 +0900
+++ b/src/parallel_execution/main.c	Wed Mar 02 20:51:33 2016 +0900
@@ -38,8 +38,9 @@
     /* puts("result"); */
 
     context->next = CreateWorker;
-    stack_push(context->code_stack, &context->next);
-    
+
+    struct Time *t = &context->data[Time]->time;
+    t->next = CreateWorker;
     goto meta(context, StartTime);
 }
 
@@ -233,9 +234,8 @@
 
     loopCounter->i = 0;
 
-    context->next = Code2;
-    stack_push(context->code_stack, &context->next);
-
+    struct Time *t = &context->data[Time]->time;
+    t->next = Code2;
     goto meta(context, EndTime);
 }
     
--- a/src/parallel_execution/time.c	Wed Mar 02 19:23:00 2016 +0900
+++ b/src/parallel_execution/time.c	Wed Mar 02 20:51:33 2016 +0900
@@ -10,8 +10,7 @@
 
     time->time = tv.tv_sec + (double)tv.tv_usec*1e-6;
 
-    stack_pop(context->code_stack, &context->next);
-    goto meta(context, context->next);
+    goto meta(context, time->next);
 }
 
 __code start_time_stub(struct Context* context) {
@@ -24,8 +23,7 @@
 
     printf("%0.6f\n", (tv.tv_sec+(double)tv.tv_usec*1e-6) - time->time);
 
-    stack_pop(context->code_stack, &context->next);
-    goto meta(context, context->next);
+    goto meta(context, time->next);
 }
 
 __code end_time_stub(struct Context* context) {