about summary refs log tree commit diff stats
path: root/html/072scheduler.cc.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-09-30 10:45:14 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-09-30 10:45:14 -0700
commit3e1349d29fa00db1fab3a811b60bc9d8de0355e4 (patch)
tree93afedf36b8b211432a458ca9c0c7bfaf76e2425 /html/072scheduler.cc.html
parent6c69569a4c4ca3a23635d4d7a40f0fe557194619 (diff)
downloadmu-3e1349d29fa00db1fab3a811b60bc9d8de0355e4.tar.gz
3431
Improvements to syntax highlighting, particularly for Mu code in C++
files.
Diffstat (limited to 'html/072scheduler.cc.html')
-rw-r--r--html/072scheduler.cc.html81
1 files changed, 41 insertions, 40 deletions
diff --git a/html/072scheduler.cc.html b/html/072scheduler.cc.html
index 1d2681fa..648f22b7 100644
--- a/html/072scheduler.cc.html
+++ b/html/072scheduler.cc.html
@@ -16,14 +16,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
 .Constant { color: #00a0a0; }
 .traceAbsent { color: #c00000; }
 .cSpecial { color: #008000; }
-.traceContains { color: #008000; }
+.CommentedCode { color: #6c6c6c; }
+.muRecipe { color: #ff8700; }
 .SalientComment { color: #00ffff; }
 .Comment { color: #9090ff; }
 .Delimiter { color: #800080; }
 .Special { color: #c00000; }
-.Identifier { color: #fcb165; }
+.traceContains { color: #008000; }
 .Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; }
-.CommentedCode { color: #6c6c6c; }
+.Identifier { color: #fcb165; }
 -->
 </style>
 
@@ -39,14 +40,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
 <span class="Comment">//: guarantees on how the operations in each are interleaved with each other.</span>
 
 <span class="Delimiter">:(scenario scheduler)</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   start-running f2
   <span class="Comment"># wait for f2 to run</span>
   <span class="Delimiter">{</span>
     jump-unless <span class="Constant">1</span>:num<span class="Delimiter">,</span> -<span class="Constant">1</span>
   <span class="Delimiter">}</span>
 ]
-def f2 [
+<span class="muRecipe">def</span> f2 [
   <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">1</span>
 ]
 <span class="traceContains">+schedule: f1</span>
@@ -232,7 +233,7 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span
 
 <span class="Delimiter">:(scenario scheduler_runs_single_routine)</span>
 <span class="Special">% Scheduling_interval = 1;</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
 ]
@@ -243,12 +244,12 @@ def f1 [
 
 <span class="Delimiter">:(scenario scheduler_interleaves_routines)</span>
 <span class="Special">% Scheduling_interval = 1;</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   start-running f2
   <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
 ]
-def f2 [
+<span class="muRecipe">def</span> f2 [
   <span class="Constant">3</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Constant">4</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
 ]
@@ -264,14 +265,14 @@ def f2 [
 <span class="traceContains">+run: {2: &quot;number&quot;} &lt;- copy {0: &quot;literal&quot;}</span>
 
 <span class="Delimiter">:(scenario start_running_takes_ingredients)</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   start-running f2<span class="Delimiter">,</span> <span class="Constant">3</span>
   <span class="Comment"># wait for f2 to run</span>
   <span class="Delimiter">{</span>
     jump-unless <span class="Constant">1</span>:num<span class="Delimiter">,</span> -<span class="Constant">1</span>
   <span class="Delimiter">}</span>
 ]
-def f2 [
+<span class="muRecipe">def</span> f2 [
   <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>next-ingredient
   <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>add <span class="Constant">1</span>:num<span class="Delimiter">,</span> <span class="Constant">1</span>
 ]
@@ -281,21 +282,21 @@ def f2 [
 
 <span class="Delimiter">:(scenario start_running_immediately_updates_refcounts_of_ingredients)</span>
 <span class="Special">% Scheduling_interval = 1;</span>
-def main [
+<span class="muRecipe">def</span> main [
   local-scope
   create-<span class="Normal">new</span>-routine
   <span class="Comment"># padding to make sure we run new-routine before returning</span>
   <span class="Normal">dummy</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Normal">dummy</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
 ]
-def create-<span class="Normal">new</span>-routine [
+<span class="muRecipe">def</span> create-<span class="Normal">new</span>-routine [
   local-scope
-  <span class="Normal">n</span>:&amp;:num<span class="Special"> &lt;- </span><span class="Normal">new</span> number:type
+  <span class="Normal">n</span>:&amp;:num<span class="Special"> &lt;- </span><span class="Normal">new</span> <span class="Constant">number:type</span>
   *n<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
   start-running <span class="Normal">new</span>-routine<span class="Delimiter">,</span> n
   <span class="Comment"># refcount of n decremented</span>
 ]
-def <span class="Normal">new</span>-routine n:&amp;:num [
+<span class="muRecipe">def</span> <span class="Normal">new</span>-routine n:&amp;:num [
   local-scope
   load-ingredients
   <span class="Constant">1</span>:num/<span class="Special">raw &lt;- </span>copy *n
@@ -318,11 +319,11 @@ increment_any_refcounts<span class="Delimiter">(</span>ingredient<span class="De
 <span class="Delimiter">}</span>
 
 <span class="Delimiter">:(scenario next_ingredient_never_leaks_refcounts)</span>
-def create-space n:&amp;:num <span class="Delimiter">-&gt;</span> <span class="Normal">default</span>-space:space [
-  <span class="Normal">default</span>-space<span class="Special"> &lt;- </span><span class="Normal">new</span> location:type<span class="Delimiter">,</span> <span class="Constant">2</span>
+<span class="muRecipe">def</span> create-space n:&amp;:num<span class="muRecipe"> -&gt; </span><span class="Normal">default</span>-space:space [
+  <span class="Normal">default</span>-space<span class="Special"> &lt;- </span><span class="Normal">new</span> <span class="Constant">location:type</span><span class="Delimiter">,</span> <span class="Constant">2</span>
   load-ingredients
 ]
-def use-space [
+<span class="muRecipe">def</span> use-space [
   local-scope
   <span class="Constant">0</span>:space/names:create-space<span class="Special"> &lt;- </span>next-ingredient
   <span class="Normal">n</span>:&amp;:num/space:<span class="Constant">1</span><span class="Special"> &lt;- </span>next-ingredient  <span class="Comment"># should decrement refcount</span>
@@ -330,7 +331,7 @@ def use-space [
   <span class="Normal">n2</span>:num<span class="Special"> &lt;- </span>add *n/space:<span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">1</span>
   reply n2
 ]
-def main [
+<span class="muRecipe">def</span> main [
   local-scope
   <span class="Normal">n</span>:&amp;:num<span class="Special"> &lt;- </span>copy <span class="Constant">12000</span>/unsafe  <span class="Comment"># pretend allocation with a known address</span>
   *n<span class="Special"> &lt;- </span>copy <span class="Constant">23</span>
@@ -345,10 +346,10 @@ def main [
 <span class="Comment">//: back to testing 'start-running'</span>
 
 <span class="Delimiter">:(scenario start_running_returns_routine_id)</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>start-running f2
 ]
-def f2 [
+<span class="muRecipe">def</span> f2 [
   <span class="Constant">12</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">44</span>
 ]
 <span class="traceContains">+mem: storing 2 in location 1</span>
@@ -362,7 +363,7 @@ def f2 [
 <span class="Special">% Routines.push_back(new routine(f2));</span>
 <span class="Special">% Routines.back()-&gt;state = COMPLETED;  // f2 not meant to run</span>
 <span class="Comment"># must have at least one routine without escaping</span>
-def f3 [
+<span class="muRecipe">def</span> f3 [
   <span class="Constant">3</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
 ]
 <span class="Comment"># by interleaving '+' lines with '-' lines, we allow f1 and f3 to run in any order</span>
@@ -376,7 +377,7 @@ def f3 [
 <span class="Delimiter">:(scenario scheduler_starts_at_middle_of_routines)</span>
 <span class="Special">% Routines.push_back(new routine(COPY));</span>
 <span class="Special">% Routines.back()-&gt;state = COMPLETED;</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
 ]
@@ -388,12 +389,12 @@ def f1 [
 <span class="Delimiter">:(scenario scheduler_terminates_routines_after_errors)</span>
 <span class="Special">% Hide_errors = true;</span>
 <span class="Special">% Scheduling_interval = 2;</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   start-running f2
   <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
 ]
-def f2 [
+<span class="muRecipe">def</span> f2 [
   <span class="Comment"># divide by 0 twice</span>
   <span class="Constant">3</span>:num<span class="Special"> &lt;- </span>divide-with-remainder <span class="Constant">4</span><span class="Delimiter">,</span> <span class="Constant">0</span>
   <span class="Constant">4</span>:num<span class="Special"> &lt;- </span>divide-with-remainder <span class="Constant">4</span><span class="Delimiter">,</span> <span class="Constant">0</span>
@@ -410,11 +411,11 @@ def f2 [
 <span class="SalientComment">//:: Routines are marked completed when their parent completes.</span>
 
 <span class="Delimiter">:(scenario scheduler_kills_orphans)</span>
-def main [
+<span class="muRecipe">def</span> main [
   start-running f1
   <span class="Comment"># f1 never actually runs because its parent completes without waiting for it</span>
 ]
-def f1 [
+<span class="muRecipe">def</span> f1 [
   <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
 ]
 <span class="traceAbsent">-schedule: f1</span>
@@ -442,13 +443,13 @@ def f1 [
 
 <span class="Delimiter">:(scenario routine_state_test)</span>
 <span class="Special">% Scheduling_interval = 2;</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   <span class="Constant">1</span>:num/child-id<span class="Special"> &lt;- </span>start-running f2
   <span class="Constant">12</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>  <span class="Comment"># race condition since we don't care about location 12</span>
   <span class="Comment"># thanks to Scheduling_interval, f2's one instruction runs in between here and completes</span>
   <span class="Constant">2</span>:num/state<span class="Special"> &lt;- </span>routine-state <span class="Constant">1</span>:num/child-id
 ]
-def f2 [
+<span class="muRecipe">def</span> f2 [
   <span class="Constant">12</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Comment"># trying to run a second instruction marks routine as completed</span>
 ]
@@ -536,16 +537,16 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span
 
 <span class="Delimiter">:(scenario routine_discontinues_past_limit)</span>
 <span class="Special">% Scheduling_interval = 2;</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   <span class="Constant">1</span>:num/child-id<span class="Special"> &lt;- </span>start-running f2
   limit-time <span class="Constant">1</span>:num/child-id<span class="Delimiter">,</span> <span class="Constant">10</span>
   <span class="Comment"># padding loop just to make sure f2 has time to completed</span>
   <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">20</span>
   <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>subtract <span class="Constant">2</span>:num<span class="Delimiter">,</span> <span class="Constant">1</span>
-  jump-<span class="Normal">if</span> <span class="Constant">2</span>:num<span class="Delimiter">,</span> -<span class="Constant">2</span>:offset
+  jump-<span class="Normal">if</span> <span class="Constant">2</span>:num<span class="Delimiter">,</span> <span class="Constant">-2:offset</span>
 ]
-def f2 [
-  jump -<span class="Constant">1</span>:offset  <span class="Comment"># run forever</span>
+<span class="muRecipe">def</span> f2 [
+  jump <span class="Constant">-1:offset</span>  <span class="Comment"># run forever</span>
   $print [should never get here]<span class="Delimiter">,</span> <span class="Constant">10</span>/newline
 ]
 <span class="Comment"># f2 terminates</span>
@@ -660,14 +661,14 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span
 <span class="Delimiter">}</span>
 
 <span class="Delimiter">:(scenario number_of_instructions)</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   <span class="Constant">10</span>:num/child-id<span class="Special"> &lt;- </span>start-running f2
   <span class="Delimiter">{</span>
     loop-unless <span class="Constant">20</span>:num
   <span class="Delimiter">}</span>
   <span class="Constant">11</span>:num<span class="Special"> &lt;- </span>number-of-instructions <span class="Constant">10</span>:num
 ]
-def f2 [
+<span class="muRecipe">def</span> f2 [
   <span class="Comment"># 2 instructions worth of work</span>
   <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
   <span class="Constant">20</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">1</span>
@@ -678,14 +679,14 @@ def f2 [
 
 <span class="Delimiter">:(scenario number_of_instructions_across_multiple_scheduling_intervals)</span>
 <span class="Special">% Scheduling_interval = 1;</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   <span class="Constant">10</span>:num/child-id<span class="Special"> &lt;- </span>start-running f2
   <span class="Delimiter">{</span>
     loop-unless <span class="Constant">20</span>:num
   <span class="Delimiter">}</span>
   <span class="Constant">11</span>:num<span class="Special"> &lt;- </span>number-of-instructions <span class="Constant">10</span>:num
 ]
-def f2 [
+<span class="muRecipe">def</span> f2 [
   <span class="Comment"># 4 instructions worth of work</span>
   <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
   <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">1</span>
@@ -699,16 +700,16 @@ def f2 [
 <span class="SalientComment">//:: make sure that each routine gets a different alloc to start</span>
 
 <span class="Delimiter">:(scenario new_concurrent)</span>
-def f1 [
+<span class="muRecipe">def</span> f1 [
   start-running f2
-  <span class="Constant">1</span>:&amp;:num/<span class="Special">raw &lt;- </span><span class="Normal">new</span> number:type
+  <span class="Constant">1</span>:&amp;:num/<span class="Special">raw &lt;- </span><span class="Normal">new</span> <span class="Constant">number:type</span>
   <span class="Comment"># wait for f2 to complete</span>
   <span class="Delimiter">{</span>
     loop-unless <span class="Constant">4</span>:num/<span class="Special">raw</span>
   <span class="Delimiter">}</span>
 ]
-def f2 [
-  <span class="Constant">2</span>:&amp;:num/<span class="Special">raw &lt;- </span><span class="Normal">new</span> number:type
+<span class="muRecipe">def</span> f2 [
+  <span class="Constant">2</span>:&amp;:num/<span class="Special">raw &lt;- </span><span class="Normal">new</span> <span class="Constant">number:type</span>
   <span class="Comment"># hack: assumes scheduler implementation</span>
   <span class="Constant">3</span>:<span class="Normal">bool</span>/<span class="Special">raw &lt;- </span>equal <span class="Constant">1</span>:&amp;:num/<span class="Special">raw</span><span class="Delimiter">,</span> <span class="Constant">2</span>:&amp;:num/<span class="Special">raw</span>
   <span class="Comment"># signal f2 complete</span>