diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-30 10:45:14 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-30 10:45:14 -0700 |
commit | 3e1349d29fa00db1fab3a811b60bc9d8de0355e4 (patch) | |
tree | 93afedf36b8b211432a458ca9c0c7bfaf76e2425 /html/037abandon.cc.html | |
parent | 6c69569a4c4ca3a23635d4d7a40f0fe557194619 (diff) | |
download | mu-3e1349d29fa00db1fab3a811b60bc9d8de0355e4.tar.gz |
3431
Improvements to syntax highlighting, particularly for Mu code in C++ files.
Diffstat (limited to 'html/037abandon.cc.html')
-rw-r--r-- | html/037abandon.cc.html | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/html/037abandon.cc.html b/html/037abandon.cc.html index 6984c154..3c1d2c2f 100644 --- a/html/037abandon.cc.html +++ b/html/037abandon.cc.html @@ -15,12 +15,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color * { font-size: 12pt; font-size: 1em; } .Constant { color: #00a0a0; } .cSpecial { color: #008000; } -.traceContains { color: #008000; } +.muRecipe { color: #ff8700; } .Comment { color: #9090ff; } .Delimiter { color: #800080; } .Special { color: #c00000; } -.CommentedCode { color: #6c6c6c; } +.traceContains { color: #008000; } .Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } +.muData { color: #ffff00; } +.CommentedCode { color: #6c6c6c; } .Identifier { color: #fcb165; } --> </style> @@ -37,11 +39,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment">//: The top of the address layer has the complete life cycle of memory.</span> <span class="Delimiter">:(scenario new_reclaim)</span> -def main [ - <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> number:type +<span class="muRecipe">def</span> main [ + <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span> <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:num <span class="Comment"># because 1 will get reset during abandon below</span> <span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Comment"># abandon</span> - <span class="Constant">3</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> number:type <span class="Comment"># must be same size as abandoned memory to reuse</span> + <span class="Constant">3</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span> <span class="Comment"># must be same size as abandoned memory to reuse</span> <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">3</span>:address:num <span class="Constant">5</span>:<span class="Normal">bool</span><span class="Special"> <- </span>equal <span class="Constant">2</span>:num<span class="Delimiter">,</span> <span class="Constant">4</span>:num ] @@ -109,11 +111,11 @@ map<<span class="Normal">int</span><span class="Delimiter">,</span> <span cla <span class="Delimiter">}</span> <span class="Delimiter">:(scenario new_differing_size_no_reclaim)</span> -def main [ - <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> number:type +<span class="muRecipe">def</span> main [ + <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span> <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:num <span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Comment"># abandon</span> - <span class="Constant">3</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> number:type<span class="Delimiter">,</span> <span class="Constant">2</span> <span class="Comment"># different size</span> + <span class="Constant">3</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span><span class="Delimiter">,</span> <span class="Constant">2</span> <span class="Comment"># different size</span> <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">3</span>:address:array:num <span class="Constant">5</span>:<span class="Normal">bool</span><span class="Special"> <- </span>equal <span class="Constant">2</span>:num<span class="Delimiter">,</span> <span class="Constant">4</span>:num ] @@ -121,11 +123,11 @@ def main [ <span class="traceContains">+mem: storing 0 in location 5</span> <span class="Delimiter">:(scenario new_reclaim_array)</span> -def main [ - <span class="Constant">1</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> number:type<span class="Delimiter">,</span> <span class="Constant">2</span> +<span class="muRecipe">def</span> main [ + <span class="Constant">1</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span><span class="Delimiter">,</span> <span class="Constant">2</span> <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:array:num <span class="Constant">1</span>:address:array:num<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Comment"># abandon</span> - <span class="Constant">3</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> number:type<span class="Delimiter">,</span> <span class="Constant">2</span> <span class="Comment"># same size</span> + <span class="Constant">3</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span><span class="Delimiter">,</span> <span class="Constant">2</span> <span class="Comment"># same size</span> <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">3</span>:address:array:num <span class="Constant">5</span>:<span class="Normal">bool</span><span class="Special"> <- </span>equal <span class="Constant">2</span>:num<span class="Delimiter">,</span> <span class="Constant">4</span>:num ] @@ -133,10 +135,10 @@ def main [ <span class="traceContains">+mem: storing 1 in location 5</span> <span class="Delimiter">:(scenario abandon_on_overwrite)</span> -def main [ - <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> number:type +<span class="muRecipe">def</span> main [ + <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span> <span class="Comment"># over-writing one allocation with another</span> - <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> number:type + <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span> <span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span> ] <span class="traceContains">+run: {1: ("address" "number")} <- new {number: "type"}</span> @@ -145,13 +147,13 @@ def main [ <span class="traceContains">+mem: automatically abandoning 1000</span> <span class="Delimiter">:(scenario abandon_after_call)</span> -def main [ - <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> number:type +<span class="muRecipe">def</span> main [ + <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span> <span class="Comment"># passing in addresses to recipes increments refcount</span> foo <span class="Constant">1</span>:address:num <span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span> ] -def foo [ +<span class="muRecipe">def</span> foo [ <span class="Constant">2</span>:address:num<span class="Special"> <- </span>next-ingredient <span class="Comment"># return does NOT yet decrement refcount; memory must be explicitly managed</span> <span class="Constant">2</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span> @@ -169,13 +171,13 @@ def foo [ <span class="traceContains">+mem: automatically abandoning 1000</span> <span class="Delimiter">:(scenario abandon_on_overwrite_array)</span> -def main [ +<span class="muRecipe">def</span> main [ <span class="Constant">1</span>:num<span class="Special"> <- </span>copy <span class="Constant">30</span> <span class="Comment"># allocate an array</span> - <span class="Constant">10</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> number:type<span class="Delimiter">,</span> <span class="Constant">20</span> + <span class="Constant">10</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span><span class="Delimiter">,</span> <span class="Constant">20</span> <span class="Constant">11</span>:num<span class="Special"> <- </span>copy <span class="Constant">10</span>:address:array:num <span class="Comment"># doesn't increment refcount</span> <span class="Comment"># allocate another array in its place, implicitly freeing the previous allocation</span> - <span class="Constant">10</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> number:type<span class="Delimiter">,</span> <span class="Constant">25</span> + <span class="Constant">10</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span><span class="Delimiter">,</span> <span class="Constant">25</span> ] <span class="traceContains">+run: {10: ("address" "array" "number")} <- new {number: "type"}, {25: "literal"}</span> <span class="Comment"># abandoned array is of old size (20, not 25)</span> @@ -183,13 +185,13 @@ def main [ <span class="Delimiter">:(scenario refcounts_abandon_address_in_container)</span> <span class="Comment"># container containing an address</span> -container foo [ +<span class="muData">container</span> foo [ <span class="Normal">x</span>:address:num ] -def main [ - <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> number:type - <span class="Constant">2</span>:address:foo<span class="Special"> <- </span><span class="Normal">new</span> foo:type - *<span class="Constant">2</span>:address:foo<span class="Special"> <- </span>put *<span class="Constant">2</span>:address:foo<span class="Delimiter">,</span> x:offset<span class="Delimiter">,</span> <span class="Constant">1</span>:address:num +<span class="muRecipe">def</span> main [ + <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span> + <span class="Constant">2</span>:address:foo<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">foo:type</span> + *<span class="Constant">2</span>:address:foo<span class="Special"> <- </span>put *<span class="Constant">2</span>:address:foo<span class="Delimiter">,</span> <span class="Constant">x:offset</span><span class="Delimiter">,</span> <span class="Constant">1</span>:address:num <span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Constant">2</span>:address:foo<span class="Special"> <- </span>copy <span class="Constant">0</span> ] @@ -212,8 +214,8 @@ def main [ <span class="Comment"># todo: move past dilated reagent</span> <span class="Delimiter">:(scenario refcounts_abandon_address_in_array)</span> -def main [ - <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> number:type +<span class="muRecipe">def</span> main [ + <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span> <span class="Constant">2</span>:address:array:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Delimiter">{(</span>address number<span class="Delimiter">)</span>: type<span class="Delimiter">},</span> <span class="Constant">3</span> *<span class="Constant">2</span>:address:array:address:num<span class="Special"> <- </span>put-index *<span class="Constant">2</span>:address:array:address:num<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">1</span>:address:num <span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span> @@ -232,12 +234,12 @@ def main [ <span class="Delimiter">:(scenario refcounts_abandon_address_in_container_in_array)</span> <span class="Comment"># container containing an address</span> -container foo [ +<span class="muData">container</span> foo [ <span class="Normal">x</span>:address:num ] -def main [ - <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> number:type - <span class="Constant">2</span>:address:array:foo<span class="Special"> <- </span><span class="Normal">new</span> foo:type<span class="Delimiter">,</span> <span class="Constant">3</span> +<span class="muRecipe">def</span> main [ + <span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span> + <span class="Constant">2</span>:address:array:foo<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">foo:type</span><span class="Delimiter">,</span> <span class="Constant">3</span> <span class="Constant">3</span>:foo<span class="Special"> <- </span>merge <span class="Constant">1</span>:address:num *<span class="Constant">2</span>:address:array:foo<span class="Special"> <- </span>put-index *<span class="Constant">2</span>:address:array:foo<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">3</span>:foo <span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span> |