about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-07-24 23:25:59 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-07-24 23:25:59 -0700
commit9c184f02731bb0efd940c4d3c87ef2decfd85064 (patch)
treeb6a98166df9eba37c8415b6d423275ddf8fb6e65
parentf38fd705438bfc5cde3994906c53df3de8517c62 (diff)
downloadmu-9c184f02731bb0efd940c4d3c87ef2decfd85064.tar.gz
3152
-rw-r--r--071scheduler.cc48
1 files changed, 32 insertions, 16 deletions
diff --git a/071scheduler.cc b/071scheduler.cc
index d15a7bb6..99d5488b 100644
--- a/071scheduler.cc
+++ b/071scheduler.cc
@@ -535,7 +535,7 @@ int ninstrs;
 :(before "End routine Constructor")
 ninstrs = 0;
 :(after "stop_running_current_routine:")
-Current_routine->ninstrs = Current_routine->ninstrs + ninstrs;
+Current_routine->ninstrs += ninstrs;
 :(before "End Primitive Recipe Declarations")
 NUMBER_OF_INSTRUCTIONS,
 :(before "End Primitive Recipe Numbers")
@@ -567,27 +567,24 @@ case NUMBER_OF_INSTRUCTIONS: {
   break;
 }
 
-//:: make sure that each routine gets a different alloc to start
-
-:(scenario new_concurrent)
+:(scenario number_of_instructions)
 def f1 [
-  start-running f2
-  1:address:number/raw <- new number:type
-  # wait for f2 to complete
+  10:number/child-id <- start-running f2
   {
-    loop-unless 4:number/raw
+    loop-unless 20:number
   }
+  11:number <- number-of-instructions 10:number
 ]
 def f2 [
-  2:address:number/raw <- new number:type
-  # hack: assumes scheduler implementation
-  3:boolean/raw <- equal 1:address:number/raw, 2:address:number/raw
-  # signal f2 complete
-  4:number/raw <- copy 1
+  # 2 instructions worth of work
+  1:number <- copy 34
+  20:number <- copy 1
 ]
-+mem: storing 0 in location 3
+# f2 runs an extra instruction for the implicit return added by the
+# fill_in_reply_ingredients transform
++mem: storing 3 in location 11
 
-:(scenario number_of_instructions)
+:(scenario number_of_instructions_across_multiple_scheduling_intervals)
 % Scheduling_interval = 1;
 def f1 [
   10:number/child-id <- start-running f2
@@ -598,7 +595,6 @@ def f1 [
 ]
 def f2 [
   # 4 instructions worth of work
-  # Should take 2 scheduling intervals
   1:number <- copy 34
   2:number <- copy 1
   2:number <- copy 3
@@ -607,3 +603,23 @@ def f2 [
 # f2 runs an extra instruction for the implicit return added by the
 # fill_in_reply_ingredients transform
 +mem: storing 5 in location 11
+
+//:: make sure that each routine gets a different alloc to start
+
+:(scenario new_concurrent)
+def f1 [
+  start-running f2
+  1:address:number/raw <- new number:type
+  # wait for f2 to complete
+  {
+    loop-unless 4:number/raw
+  }
+]
+def f2 [
+  2:address:number/raw <- new number:type
+  # hack: assumes scheduler implementation
+  3:boolean/raw <- equal 1:address:number/raw, 2:address:number/raw
+  # signal f2 complete
+  4:number/raw <- copy 1
+]
++mem: storing 0 in location 3