diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-07-20 18:05:56 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-07-20 18:05:56 -0700 |
commit | e81da299fb49bd79cd460d477ec0bb673035620a (patch) | |
tree | e4b162be797dcb6d2793a5f7831c6c39bd099a85 /html/071scheduler.cc.html | |
parent | edfc4cf8ac21a30307cd36bb9cff6a4a8b92dee7 (diff) | |
download | mu-e81da299fb49bd79cd460d477ec0bb673035620a.tar.gz |
3117
Diffstat (limited to 'html/071scheduler.cc.html')
-rw-r--r-- | html/071scheduler.cc.html | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/html/071scheduler.cc.html b/html/071scheduler.cc.html index 4f556a1e..18fc91b8 100644 --- a/html/071scheduler.cc.html +++ b/html/071scheduler.cc.html @@ -568,6 +568,43 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> +<span class="Delimiter">:(before "End routine Fields")</span> +<span class="Normal">int</span> ninstrs<span class="Delimiter">;</span> +<span class="Delimiter">:(before "End routine Constructor")</span> +ninstrs = <span class="Constant">0</span><span class="Delimiter">;</span> +<span class="Delimiter">:(after "stop_running_current_routine:")</span> +Current_routine<span class="Delimiter">-></span>ninstrs = Current_routine<span class="Delimiter">-></span>ninstrs + ninstrs<span class="Delimiter">;</span> +<span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +NUMBER_OF_INSTRUCTIONS<span class="Delimiter">,</span> +<span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"number-of-instructions"</span><span class="Delimiter">,</span> NUMBER_OF_INSTRUCTIONS<span class="Delimiter">);</span> +<span class="Delimiter">:(before "End Primitive Recipe Checks")</span> +<span class="Normal">case</span> NUMBER_OF_INSTRUCTIONS: <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> + raise << maybe<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'number-of-instructions' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> + raise << maybe<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'number-of-instructions' should be a routine id generated by 'start-running', but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> +<span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +<span class="Normal">case</span> NUMBER_OF_INSTRUCTIONS: <span class="Delimiter">{</span> + <span class="Normal">int</span> id = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> + <span class="Normal">int</span> result = -<span class="Constant">1</span><span class="Delimiter">;</span> + <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>id == id<span class="Delimiter">)</span> <span class="Delimiter">{</span> + result = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>ninstrs<span class="Delimiter">;</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Delimiter">}</span> + products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> + products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>result<span class="Delimiter">);</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> + <span class="SalientComment">//:: make sure that each routine gets a different alloc to start</span> <span class="Delimiter">:(scenario new_concurrent)</span> @@ -587,6 +624,27 @@ def f2 [ <span class="Constant">4</span>:number/<span class="Special">raw <- </span>copy <span class="Constant">1</span> ] <span class="traceContains">+mem: storing 0 in location 3</span> + +<span class="Delimiter">:(scenario number_of_instructions)</span> +<span class="Special">% Scheduling_interval = 1;</span> +def f1 [ + <span class="Constant">10</span>:number/child-id<span class="Special"> <- </span>start-running f2 + <span class="Delimiter">{</span> + loop-unless <span class="Constant">20</span>:number + <span class="Delimiter">}</span> + <span class="Constant">11</span>:number<span class="Special"> <- </span>number-of-instructions <span class="Constant">10</span>:number +] +def f2 [ + <span class="Comment"># 4 instructions worth of work</span> + <span class="Comment"># Should take 2 scheduling intervals</span> + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span> + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span> + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">3</span> + <span class="Constant">20</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span> +] +<span class="Comment"># f2 runs an extra instruction for the implicit return added by the</span> +<span class="Comment"># fill_in_reply_ingredients transform</span> +<span class="traceContains">+mem: storing 5 in location 11</span> </pre> </body> </html> |