From 9c184f02731bb0efd940c4d3c87ef2decfd85064 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 24 Jul 2016 23:25:59 -0700 Subject: 3152 --- 071scheduler.cc | 48 ++++++++++++++++++++++++++++++++---------------- 1 file 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 -- cgit 1.4.1-2-gfad0