about summary refs log tree commit diff stats
path: root/html/037abandon.cc.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-08-17 19:04:35 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-08-17 19:04:35 -0700
commitd990e8f07aee36f68bcd270889d20c2d22b9aa0b (patch)
tree07a624ea81f2974e1bb038462f4d0607237ea431 /html/037abandon.cc.html
parentcb159b8c8a888f089676a63273b76b641e860d88 (diff)
downloadmu-d990e8f07aee36f68bcd270889d20c2d22b9aa0b.tar.gz
3219
Trying keeping html in the master branch:
  https://github.com/blog/2228-simpler-github-pages-publishing

Let's see if https://akkartik.github.io/mu updates after I push this
commit to just the master branch.
Diffstat (limited to 'html/037abandon.cc.html')
-rw-r--r--html/037abandon.cc.html28
1 files changed, 10 insertions, 18 deletions
diff --git a/html/037abandon.cc.html b/html/037abandon.cc.html
index 661b2bb8..1339c4f0 100644
--- a/html/037abandon.cc.html
+++ b/html/037abandon.cc.html
@@ -48,7 +48,7 @@ def main [
 <span class="Comment"># both allocations should have returned the same address</span>
 <span class="traceContains">+mem: storing 1 in location 5</span>
 
-<span class="Delimiter">:(before &quot;End Decrement Reference Count(old_address, payload_type, payload_size)&quot;)</span>
+<span class="Delimiter">:(before &quot;End Decrement Refcount(old_address, payload_type, payload_size)&quot;)</span>
 <span class="Normal">if</span> <span class="Delimiter">(</span>old_refcount == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
   trace<span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">&quot;mem&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;automatically abandoning &quot;</span> &lt;&lt; old_address &lt;&lt; end<span class="Delimiter">();</span>
   abandon<span class="Delimiter">(</span>old_address<span class="Delimiter">,</span> payload_type<span class="Delimiter">,</span> payload_size<span class="Delimiter">);</span>
@@ -71,27 +71,17 @@ map&lt;<span class="Normal">int</span><span class="Delimiter">,</span> <span cla
     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">-&gt;</span>name != <span class="Constant">&quot;array&quot;</span><span class="Delimiter">);</span>
-    <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_address<span class="Delimiter">(</span>element<span class="Delimiter">))</span> <span class="Delimiter">{</span>
-      <span class="Normal">for</span> <span class="Delimiter">(</span>element<span class="Delimiter">.</span>value = address+<span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> element<span class="Delimiter">.</span>value &lt; address+<span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span>+array_length<span class="Delimiter">;</span> ++element<span class="Delimiter">.</span>value<span class="Delimiter">)</span>
-        update_refcounts<span class="Delimiter">(</span>element<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span>
-    <span class="Delimiter">}</span>
-    <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_container<span class="Delimiter">(</span>element<span class="Delimiter">)</span> || is_mu_exclusive_container<span class="Delimiter">(</span>element<span class="Delimiter">))</span> <span class="Delimiter">{</span>
-      <span class="Normal">int</span> element_size = size_of<span class="Delimiter">(</span>element<span class="Delimiter">);</span>
-      vector&lt;<span class="Normal">double</span>&gt; zeros<span class="Delimiter">;</span>
-      zeros<span class="Delimiter">.</span>resize<span class="Delimiter">(</span>element_size<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 &lt; array_length<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span>
-        element<span class="Delimiter">.</span>value = address + <span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span> + <span class="Comment">/*</span><span class="Comment">skip array length</span><span class="Comment">*/</span><span class="Constant">1</span> + i*element_size<span class="Delimiter">;</span>
-        update_container_refcounts<span class="Delimiter">(</span>element<span class="Delimiter">,</span> zeros<span class="Delimiter">);</span>
-      <span class="Delimiter">}</span>
+    <span class="Normal">int</span> element_size = size_of<span class="Delimiter">(</span>element<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 &lt; array_length<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+      element<span class="Delimiter">.</span>set_value<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="Comment">/*</span><span class="Comment">skip array length</span><span class="Comment">*/</span><span class="Constant">1</span> + i*element_size<span class="Delimiter">);</span>
+      decrement_any_refcounts<span class="Delimiter">(</span>element<span class="Delimiter">);</span>
     <span class="Delimiter">}</span>
   <span class="Delimiter">}</span>
   <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_container<span class="Delimiter">(</span>payload_type<span class="Delimiter">)</span> || is_mu_exclusive_container<span class="Delimiter">(</span>payload_type<span class="Delimiter">))</span> <span class="Delimiter">{</span>
     reagent tmp<span class="Delimiter">;</span>
-    tmp<span class="Delimiter">.</span>value = address + <span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span>
     tmp<span class="Delimiter">.</span>type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*payload_type<span class="Delimiter">);</span>
-    vector&lt;<span class="Normal">double</span>&gt; zeros<span class="Delimiter">;</span>
-    zeros<span class="Delimiter">.</span>resize<span class="Delimiter">(</span>size_of<span class="Delimiter">(</span>payload_type<span class="Delimiter">));</span>
-    update_container_refcounts<span class="Delimiter">(</span>tmp<span class="Delimiter">,</span> zeros<span class="Delimiter">);</span>
+    tmp<span class="Delimiter">.</span>set_value<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>
+    decrement_any_refcounts<span class="Delimiter">(</span>tmp<span class="Delimiter">);</span>
   <span class="Delimiter">}</span>
   <span class="Comment">// clear memory</span>
   <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> curr = address<span class="Delimiter">;</span> curr &lt; address+payload_size<span class="Delimiter">;</span> ++curr<span class="Delimiter">)</span>
@@ -168,7 +158,9 @@ def foo [
 ]
 <span class="traceContains">+run: {1: (&quot;address&quot; &quot;number&quot;)} &lt;- new {number: &quot;type&quot;}</span>
 <span class="traceContains">+mem: incrementing refcount of 1000: 0 -&gt; 1</span>
-<span class="traceContains">+run: {2: (&quot;address&quot; &quot;number&quot;)} &lt;- next-ingredient</span>
+<span class="traceContains">+run: foo {1: (&quot;address&quot; &quot;number&quot;)}</span>
+<span class="Comment"># leave ambiguous precisely when the next increment happens; a later layer</span>
+<span class="Comment"># will mess with that</span>
 <span class="traceContains">+mem: incrementing refcount of 1000: 1 -&gt; 2</span>
 <span class="traceContains">+run: {2: (&quot;address&quot; &quot;number&quot;)} &lt;- copy {0: &quot;literal&quot;}</span>
 <span class="traceContains">+mem: decrementing refcount of 1000: 2 -&gt; 1</span>