diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-11-11 15:54:19 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-11-11 15:54:19 -0800 |
commit | 6d007fda037331e7761d2a9ed3a2e435131daf7e (patch) | |
tree | 656aa7fe284b2b11c01f0389fe81f1b31025ce4e /html/037abandon.cc.html | |
parent | c9f920da6e6b3e7049f078fea35e08256cae7c5b (diff) | |
download | mu-6d007fda037331e7761d2a9ed3a2e435131daf7e.tar.gz |
3667
Diffstat (limited to 'html/037abandon.cc.html')
-rw-r--r-- | html/037abandon.cc.html | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/html/037abandon.cc.html b/html/037abandon.cc.html index b60bd60b..a11ba8cf 100644 --- a/html/037abandon.cc.html +++ b/html/037abandon.cc.html @@ -69,7 +69,7 @@ map<<span class="Normal">int</span><span class="Delimiter">,</span> <span cla <span class="CommentedCode">//? cerr << "abandon: " << size << '\n';</span> <span class="Comment">// decrement any contained refcounts</span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_array<span class="Delimiter">(</span>payload_type<span class="Delimiter">))</span> <span class="Delimiter">{</span> - reagent element<span class="Delimiter">;</span> + reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> element<span class="Delimiter">;</span> element<span class="Delimiter">.</span>type = copy_array_element<span class="Delimiter">(</span>payload_type<span class="Delimiter">);</span> <span class="Normal">int</span> array_length = get_or_insert<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> address+<span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> assert<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name != <span class="Constant">"array"</span><span class="Delimiter">);</span> @@ -260,6 +260,28 @@ map<<span class="Normal">int</span><span class="Delimiter">,</span> <span cla <span class="Comment"># nested abandon</span> <span class="traceContains">+mem: decrementing refcount of 1000: 1 -> 0</span> <span class="traceContains">+abandon: saving 1000 in free-list of size 2</span> + +<span class="Delimiter">:(scenario refcounts_abandon_array_within_container)</span> +<span class="muData">container</span> foo [ + <span class="Normal">x</span>:address:array:num +] +<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">3</span> + <span class="Constant">2</span>:foo<span class="Special"> <- </span>merge <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="Constant">2</span>:foo<span class="Special"> <- </span>copy <span class="Constant">0</span> +] +<span class="traceContains">+run: {1: ("address" "array" "number")} <- new {number: "type"}, {3: "literal"}</span> +<span class="traceContains">+mem: incrementing refcount of 1000: 0 -> 1</span> +<span class="traceContains">+run: {2: "foo"} <- merge {1: ("address" "array" "number")}</span> +<span class="traceContains">+mem: incrementing refcount of 1000: 1 -> 2</span> +<span class="traceContains">+run: {1: ("address" "array" "number")} <- copy {0: "literal"}</span> +<span class="traceContains">+mem: decrementing refcount of 1000: 2 -> 1</span> +<span class="traceContains">+run: {2: "foo"} <- copy {0: "literal"}</span> +<span class="traceContains">+mem: decrementing refcount of 1000: 1 -> 0</span> +<span class="traceContains">+mem: automatically abandoning 1000</span> +<span class="Comment"># make sure we save it in a free-list of the appropriate size</span> +<span class="traceContains">+abandon: saving 1000 in free-list of size 5</span> </pre> </body> </html> |