diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-08-27 20:49:03 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-08-27 20:49:03 -0700 |
commit | cd9bb850caeca88747a25436fc65c67c6d5cd89a (patch) | |
tree | 34ea30beb19b5fafe855b951b9468d2a9e915492 /html/034address.cc.html | |
parent | e947da75bd926da6d533fd73b352c16c8417b3f6 (diff) | |
download | mu-cd9bb850caeca88747a25436fc65c67c6d5cd89a.tar.gz |
3266
Diffstat (limited to 'html/034address.cc.html')
-rw-r--r-- | html/034address.cc.html | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/html/034address.cc.html b/html/034address.cc.html index 12aa417c..d4ef5474 100644 --- a/html/034address.cc.html +++ b/html/034address.cc.html @@ -304,7 +304,7 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span <span class="Normal">int</span> size = 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">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// array allocation</span> - trace<span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"array size is "</span> << ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> << end<span class="Delimiter">();</span> + trace<span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"array length is "</span> << ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> << end<span class="Delimiter">();</span> size = <span class="Comment">/*</span><span class="Comment">space for length</span><span class="Comment">*/</span><span class="Constant">1</span> + size*ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span class="Delimiter">}</span> <span class="Normal">int</span> result = allocate<span class="Delimiter">(</span>size<span class="Delimiter">);</span> @@ -320,10 +320,10 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span <span class="Delimiter">:(code)</span> <span class="Normal">int</span> allocate<span class="Delimiter">(</span><span class="Normal">int</span> size<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// include space for refcount</span> - size++<span class="Delimiter">;</span> + ++size<span class="Delimiter">;</span> trace<span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"allocating size "</span> << size << end<span class="Delimiter">();</span> <span class="CommentedCode">//? Total_alloc += size;</span> -<span class="CommentedCode">//? Num_alloc++;</span> +<span class="CommentedCode">//? ++Num_alloc;</span> <span class="Comment">// Allocate Special-cases</span> <span class="Comment">// compute the region of memory to return</span> <span class="Comment">// really crappy at the moment</span> @@ -385,8 +385,8 @@ def main [ <span class="Constant">3</span>:number/<span class="Special">raw <- </span>subtract <span class="Constant">2</span>:address:number/<span class="Special">raw</span><span class="Delimiter">,</span> <span class="Constant">1</span>:address:array:number/<span class="Special">raw</span> ] <span class="traceContains">+run: {1: ("address" "array" "number"), "raw": ()} <- new {number: "type"}, {5: "literal"}</span> -<span class="traceContains">+mem: array size is 5</span> -<span class="Comment"># don't forget the extra location for array size, and the second extra location for the refcount</span> +<span class="traceContains">+mem: array length is 5</span> +<span class="Comment"># don't forget the extra location for array length, and the second extra location for the refcount</span> <span class="traceContains">+mem: storing 7 in location 3</span> <span class="Delimiter">:(scenario new_empty_array)</span> @@ -396,8 +396,8 @@ def main [ <span class="Constant">3</span>:number/<span class="Special">raw <- </span>subtract <span class="Constant">2</span>:address:number/<span class="Special">raw</span><span class="Delimiter">,</span> <span class="Constant">1</span>:address:array:number/<span class="Special">raw</span> ] <span class="traceContains">+run: {1: ("address" "array" "number"), "raw": ()} <- new {number: "type"}, {0: "literal"}</span> -<span class="traceContains">+mem: array size is 0</span> -<span class="Comment"># one location for array size, and one for the refcount</span> +<span class="traceContains">+mem: array length is 0</span> +<span class="Comment"># one location for array length, and one for the refcount</span> <span class="traceContains">+mem: storing 2 in location 3</span> <span class="Comment">//: If a routine runs out of its initial allocation, it should allocate more.</span> |