diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-11-01 03:41:16 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-11-01 03:41:16 -0700 |
commit | 850822ffbfd441d05161452be28b54f882b1b378 (patch) | |
tree | 7f2cb2ac13e4f64e48fee3f060d83c95b349d5e3 /html/032array.cc.html | |
parent | a6fe8e274683c14efc6585b1b566afe9abfea7d1 (diff) | |
download | mu-850822ffbfd441d05161452be28b54f882b1b378.tar.gz |
4102
Diffstat (limited to 'html/032array.cc.html')
-rw-r--r-- | html/032array.cc.html | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/html/032array.cc.html b/html/032array.cc.html index fab5ef56..82126414 100644 --- a/html/032array.cc.html +++ b/html/032array.cc.html @@ -114,7 +114,7 @@ if ('onhashchange' in window) { <span id="L49" class="LineNr"> 49 </span><span class="Delimiter">}</span> <span id="L50" class="LineNr"> 50 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L51" class="LineNr"> 51 </span><span class="Normal">case</span> CREATE_ARRAY: <span class="Delimiter">{</span> -<span id="L52" class="LineNr"> 52 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> product = <a href='026call.cc.html#L85'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L52" class="LineNr"> 52 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> product = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L53" class="LineNr"> 53 </span> <span class="Comment">// Update CREATE_ARRAY product in Run</span> <span id="L54" class="LineNr"> 54 </span> <span class="Normal">int</span> base_address = product<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span id="L55" class="LineNr"> 55 </span> type_tree* array_length_from_type = product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">;</span> @@ -170,7 +170,7 @@ if ('onhashchange' in window) { <span id="L105" class="LineNr">105 </span><span class="Delimiter">:(before "End size_of(reagent r) Special-cases")</span> <span id="L106" class="LineNr">106 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom && r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom && r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"array"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L107" class="LineNr">107 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L108" class="LineNr">108 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"'"</span> << r<span class="Delimiter">.</span>original_string << <span class="Constant">"' is an array of what?</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L108" class="LineNr">108 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"'"</span> << r<span class="Delimiter">.</span>original_string << <span class="Constant">"' is an array of what?</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L109" class="LineNr">109 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <span class="Constant">1</span><span class="Delimiter">;</span> <span id="L110" class="LineNr">110 </span> <span class="Delimiter">}</span> <span id="L111" class="LineNr">111 </span> <span class="Identifier">return</span> <span class="Comment">/*</span><span class="Comment">space for length</span><span class="Comment">*/</span><span class="Constant">1</span> + <a href='032array.cc.html#L397'>array_length</a><span class="Delimiter">(</span>r<span class="Delimiter">)</span>*size_of<span class="Delimiter">(</span><a href='032array.cc.html#L381'>array_element</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">));</span> @@ -185,7 +185,7 @@ if ('onhashchange' in window) { <span id="L120" class="LineNr">120 </span> <span class="Conceal">¦</span> <span class="Comment">// get size from type</span> <span id="L121" class="LineNr">121 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <a href='002test.cc.html#L91'>to_integer</a><span class="Delimiter">(</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L122" class="LineNr">122 </span> <span class="Delimiter">}</span> -<span id="L123" class="LineNr">123 </span> cerr << <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L123" class="LineNr">123 </span> cerr << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L124" class="LineNr">124 </span> assert<span class="Delimiter">(</span><span class="Constant">false</span><span class="Delimiter">);</span> <span id="L125" class="LineNr">125 </span><span class="Delimiter">}</span> <span id="L126" class="LineNr">126 </span> @@ -238,8 +238,8 @@ if ('onhashchange' in window) { <span id="L173" class="LineNr">173 </span><span class="Comment">//: disable the size mismatch check for 'merge' instructions since containers</span> <span id="L174" class="LineNr">174 </span><span class="Comment">//: can contain arrays, and since we already do plenty of checking for them</span> <span id="L175" class="LineNr">175 </span><span class="Delimiter">:(before "End size_mismatch(x) Special-cases")</span> -<span id="L176" class="LineNr">176 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L79'>current_call</a><span class="Delimiter">().</span>running_step_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> <a href='026call.cc.html#L79'>current_call</a><span class="Delimiter">().</span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">)</span> -<span id="L177" class="LineNr">177 </span> <span class="Conceal">¦</span> && <a href='026call.cc.html#L85'>current_instruction</a><span class="Delimiter">().</span>operation == MERGE<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L176" class="LineNr">176 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>running_step_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> <a href='026call.cc.html#L81'>current_call</a><span class="Delimiter">().</span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">)</span> +<span id="L177" class="LineNr">177 </span> <span class="Conceal">¦</span> && <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>operation == MERGE<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L178" class="LineNr">178 </span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L179" class="LineNr">179 </span><span class="Delimiter">}</span> <span id="L180" class="LineNr">180 </span> @@ -289,7 +289,7 @@ if ('onhashchange' in window) { <span id="L224" class="LineNr">224 </span> reagent container<span class="Delimiter">(</span><span class="Constant">"x:point"</span><span class="Delimiter">);</span> <span id="L225" class="LineNr">225 </span> <a href='002test.cc.html#L24'>CHECK</a><span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Container_metadata<span class="Delimiter">,</span> container<span class="Delimiter">.</span>type<span class="Delimiter">));</span> <span id="L226" class="LineNr">226 </span> <span class="Comment">// scanning an address to an array of the container precomputes the size of the container</span> -<span id="L227" class="LineNr">227 </span> reagent r<span class="Delimiter">(</span><span class="Constant">"x:address:array:point"</span><span class="Delimiter">);</span> +<span id="L227" class="LineNr">227 </span> reagent r<span class="Delimiter">(</span><span class="Constant">"x:<a href='043space.cc.html#L83'>address</a>:array:point"</span><span class="Delimiter">);</span> <span id="L228" class="LineNr">228 </span> compute_container_sizes<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> <span id="L229" class="LineNr">229 </span> <a href='002test.cc.html#L24'>CHECK</a><span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>Container_metadata<span class="Delimiter">,</span> container<span class="Delimiter">.</span>type<span class="Delimiter">));</span> <span id="L230" class="LineNr">230 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Container_metadata<span class="Delimiter">,</span> container<span class="Delimiter">.</span>type<span class="Delimiter">).</span>size<span class="Delimiter">,</span> <span class="Constant">2</span><span class="Delimiter">);</span> @@ -313,7 +313,7 @@ if ('onhashchange' in window) { <span id="L248" class="LineNr">248 </span> reagent container<span class="Delimiter">(</span><span class="Constant">"x:point"</span><span class="Delimiter">);</span> <span id="L249" class="LineNr">249 </span> <span class="Normal">int</span> old_size = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Container_metadata<span class="Delimiter">);</span> <span id="L250" class="LineNr">250 </span> <span class="Comment">// scanning an address to an array of the container precomputes the size of the container</span> -<span id="L251" class="LineNr">251 </span> reagent r<span class="Delimiter">(</span><span class="Constant">"x:address:array:point:10"</span><span class="Delimiter">);</span> +<span id="L251" class="LineNr">251 </span> reagent r<span class="Delimiter">(</span><span class="Constant">"x:<a href='043space.cc.html#L83'>address</a>:array:point:10"</span><span class="Delimiter">);</span> <span id="L252" class="LineNr">252 </span> compute_container_sizes<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> <span id="L253" class="LineNr">253 </span> <a href='002test.cc.html#L24'>CHECK</a><span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>Container_metadata<span class="Delimiter">,</span> container<span class="Delimiter">.</span>type<span class="Delimiter">));</span> <span id="L254" class="LineNr">254 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Container_metadata<span class="Delimiter">,</span> container<span class="Delimiter">.</span>type<span class="Delimiter">).</span>size<span class="Delimiter">,</span> <span class="Constant">2</span><span class="Delimiter">);</span> @@ -326,7 +326,7 @@ if ('onhashchange' in window) { <span id="L261" class="LineNr">261 </span> reagent container<span class="Delimiter">(</span><span class="Constant">"x:point"</span><span class="Delimiter">);</span> <span id="L262" class="LineNr">262 </span> <span class="Normal">int</span> old_size = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Container_metadata<span class="Delimiter">);</span> <span id="L263" class="LineNr">263 </span> <span class="Comment">// scanning repeated address and array types modifying the container precomputes the size of the container</span> -<span id="L264" class="LineNr">264 </span> reagent r<span class="Delimiter">(</span><span class="Constant">"x:address:array:address:array:point:10"</span><span class="Delimiter">);</span> +<span id="L264" class="LineNr">264 </span> reagent r<span class="Delimiter">(</span><span class="Constant">"x:<a href='043space.cc.html#L83'>address</a>:array:<a href='043space.cc.html#L83'>address</a>:array:point:10"</span><span class="Delimiter">);</span> <span id="L265" class="LineNr">265 </span> compute_container_sizes<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> <span id="L266" class="LineNr">266 </span> <a href='002test.cc.html#L24'>CHECK</a><span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>Container_metadata<span class="Delimiter">,</span> container<span class="Delimiter">.</span>type<span class="Delimiter">));</span> <span id="L267" class="LineNr">267 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Container_metadata<span class="Delimiter">,</span> container<span class="Delimiter">.</span>type<span class="Delimiter">).</span>size<span class="Delimiter">,</span> <span class="Constant">2</span><span class="Delimiter">);</span> @@ -339,7 +339,7 @@ if ('onhashchange' in window) { <span id="L274" class="LineNr">274 </span> reagent container<span class="Delimiter">(</span><span class="Constant">"x:point"</span><span class="Delimiter">);</span> <span id="L275" class="LineNr">275 </span> <span class="Normal">int</span> old_size = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Container_metadata<span class="Delimiter">);</span> <span id="L276" class="LineNr">276 </span> <span class="Comment">// scanning address to array with a typo</span> -<span id="L277" class="LineNr">277 </span> reagent r<span class="Delimiter">(</span><span class="Constant">"x:address:array:adress:number"</span><span class="Delimiter">);</span> +<span id="L277" class="LineNr">277 </span> reagent r<span class="Delimiter">(</span><span class="Constant">"x:<a href='043space.cc.html#L83'>address</a>:array:adress:number"</span><span class="Delimiter">);</span> <span id="L278" class="LineNr">278 </span> compute_container_sizes<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> <span class="Comment">// should not crash</span> <span id="L279" class="LineNr">279 </span> <span class="Comment">// no non-container types precomputed</span> <span id="L280" class="LineNr">280 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Container_metadata<span class="Delimiter">),</span> old_size<span class="Delimiter">);</span> @@ -359,11 +359,11 @@ if ('onhashchange' in window) { <span id="L294" class="LineNr">294 </span> <span id="L295" class="LineNr">295 </span><span class="Delimiter">:(scenario index_compound_element)</span> <span id="L296" class="LineNr">296 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L297" class="LineNr">297 </span> <span class="Delimiter">{</span><span class="Constant">1</span>: <span class="Delimiter">(</span>array <span class="Delimiter">(</span>address number<span class="Delimiter">)</span> <span class="Constant">3</span><span class="Delimiter">)}</span><span class="Special"> <- </span>create-array +<span id="L297" class="LineNr">297 </span> <span class="Delimiter">{</span><span class="Constant">1</span>: <span class="Delimiter">(</span>array <span class="Delimiter">(</span><a href='043space.cc.html#L83'>address</a> number<span class="Delimiter">)</span> <span class="Constant">3</span><span class="Delimiter">)}</span><span class="Special"> <- </span>create-array <span id="L298" class="LineNr">298 </span> <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> <span id="L299" class="LineNr">299 </span> <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> <span id="L300" class="LineNr">300 </span> <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> -<span id="L301" class="LineNr">301 </span> <span class="Constant">5</span>:address:num<span class="Special"> <- </span>index <span class="Delimiter">{</span><span class="Constant">1</span>: <span class="Delimiter">(</span>array <span class="Delimiter">(</span>address number<span class="Delimiter">)</span> <span class="Constant">3</span><span class="Delimiter">)},</span> <span class="Constant">0</span> +<span id="L301" class="LineNr">301 </span> <span class="Constant">5</span>:<a href='043space.cc.html#L83'>address</a>:num<span class="Special"> <- </span>index <span class="Delimiter">{</span><span class="Constant">1</span>: <span class="Delimiter">(</span>array <span class="Delimiter">(</span><a href='043space.cc.html#L83'>address</a> number<span class="Delimiter">)</span> <span class="Constant">3</span><span class="Delimiter">)},</span> <span class="Constant">0</span> <span id="L302" class="LineNr">302 </span>] <span id="L303" class="LineNr">303 </span><span class="traceContains">+mem: storing 14 in location 5</span> <span id="L304" class="LineNr">304 </span> @@ -413,26 +413,26 @@ if ('onhashchange' in window) { <span id="L348" class="LineNr">348 </span><span class="Delimiter">}</span> <span id="L349" class="LineNr">349 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L350" class="LineNr">350 </span><span class="Normal">case</span> INDEX: <span class="Delimiter">{</span> -<span id="L351" class="LineNr">351 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> base = <a href='026call.cc.html#L85'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L351" class="LineNr">351 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> base = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L352" class="LineNr">352 </span> <span class="Comment">// Update INDEX base in Run</span> <span id="L353" class="LineNr">353 </span> <span class="Normal">int</span> base_address = base<span class="Delimiter">.</span>value<span class="Delimiter">;</span> -<span id="L354" class="LineNr">354 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"base address is "</span> << base_address << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L354" class="LineNr">354 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"base <a href='043space.cc.html#L83'>address</a> is "</span> << base_address << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L355" class="LineNr">355 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base_address == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L356" class="LineNr">356 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L356" class="LineNr">356 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L357" class="LineNr">357 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L358" class="LineNr">358 </span> <span class="Delimiter">}</span> -<span id="L359" class="LineNr">359 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> index = <a href='026call.cc.html#L85'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L359" class="LineNr">359 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> index = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L360" class="LineNr">360 </span> <span class="Comment">// Update INDEX index in Run</span> <span id="L361" class="LineNr">361 </span> vector<<span class="Normal">double</span>> index_val<span class="Delimiter">(</span>read_memory<span class="Delimiter">(</span>index<span class="Delimiter">));</span> <span id="L362" class="LineNr">362 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> < <span class="Constant">0</span> || index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> >= <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L363" class="LineNr">363 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"invalid index "</span> << no_scientific<span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L363" class="LineNr">363 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"invalid index "</span> << no_scientific<span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L364" class="LineNr">364 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L365" class="LineNr">365 </span> <span class="Delimiter">}</span> <span id="L366" class="LineNr">366 </span> reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> element<span class="Delimiter">;</span> <span id="L367" class="LineNr">367 </span> element<span class="Delimiter">.</span>type = <a href='032array.cc.html#L377'>copy_array_element</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">);</span> <span id="L368" class="LineNr">368 </span> element<span class="Delimiter">.</span><a href='010vm.cc.html#L65'>set_value</a><span class="Delimiter">(</span>base_address + <span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span> + index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span>*size_of<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">));</span> <span id="L369" class="LineNr">369 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"address to copy is "</span> << element<span class="Delimiter">.</span>value << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> -<span id="L370" class="LineNr">370 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"its type is "</span> << <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L370" class="LineNr">370 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"its type is "</span> << <a href='028call_return.cc.html#L162'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L371" class="LineNr">371 </span> <span class="Comment">// Read element</span> <span id="L372" class="LineNr">372 </span> products<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>read_memory<span class="Delimiter">(</span>element<span class="Delimiter">));</span> <span id="L373" class="LineNr">373 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -477,7 +477,7 @@ if ('onhashchange' in window) { <span id="L412" class="LineNr">412 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">14</span><span class="Delimiter">);</span> <span id="L413" class="LineNr">413 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">15</span><span class="Delimiter">);</span> <span id="L414" class="LineNr">414 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">4</span><span class="Delimiter">,</span> <span class="Constant">16</span><span class="Delimiter">);</span> -<span id="L415" class="LineNr">415 </span> reagent x<span class="Delimiter">(</span><span class="Constant">"1:array:address:num"</span><span class="Delimiter">);</span> <span class="Comment">// 3 types, but not a static array</span> +<span id="L415" class="LineNr">415 </span> reagent x<span class="Delimiter">(</span><span class="Constant">"1:array:<a href='043space.cc.html#L83'>address</a>:num"</span><span class="Delimiter">);</span> <span class="Comment">// 3 types, but not a static array</span> <span id="L416" class="LineNr">416 </span> <a href='012transform.cc.html#L91'>populate_value</a><span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L417" class="LineNr">417 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='032array.cc.html#L397'>array_length</a><span class="Delimiter">(</span>x<span class="Delimiter">),</span> <span class="Constant">3</span><span class="Delimiter">);</span> <span id="L418" class="LineNr">418 </span><span class="Delimiter">}</span> @@ -604,26 +604,26 @@ if ('onhashchange' in window) { <span id="L539" class="LineNr">539 </span><span class="Delimiter">}</span> <span id="L540" class="LineNr">540 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L541" class="LineNr">541 </span><span class="Normal">case</span> PUT_INDEX: <span class="Delimiter">{</span> -<span id="L542" class="LineNr">542 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> base = <a href='026call.cc.html#L85'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L542" class="LineNr">542 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> base = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L543" class="LineNr">543 </span> <span class="Comment">// Update PUT_INDEX base in Run</span> <span id="L544" class="LineNr">544 </span> <span class="Normal">int</span> base_address = base<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span id="L545" class="LineNr">545 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base_address == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L546" class="LineNr">546 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L546" class="LineNr">546 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L547" class="LineNr">547 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L548" class="LineNr">548 </span> <span class="Delimiter">}</span> -<span id="L549" class="LineNr">549 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> index = <a href='026call.cc.html#L85'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L549" class="LineNr">549 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> index = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L550" class="LineNr">550 </span> <span class="Comment">// Update PUT_INDEX index in Run</span> <span id="L551" class="LineNr">551 </span> vector<<span class="Normal">double</span>> index_val<span class="Delimiter">(</span>read_memory<span class="Delimiter">(</span>index<span class="Delimiter">));</span> <span id="L552" class="LineNr">552 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> < <span class="Constant">0</span> || index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> >= <a href='001help.cc.html#L228'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L553" class="LineNr">553 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"invalid index "</span> << no_scientific<span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L553" class="LineNr">553 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"invalid index "</span> << no_scientific<span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L554" class="LineNr">554 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L555" class="LineNr">555 </span> <span class="Delimiter">}</span> -<span id="L556" class="LineNr">556 </span> <span class="Normal">int</span> address = base_address + <span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span> + index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span>*size_of<span class="Delimiter">(</span><a href='032array.cc.html#L381'>array_element</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">));</span> -<span id="L557" class="LineNr">557 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"address to copy to is "</span> << address << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L556" class="LineNr">556 </span> <span class="Normal">int</span> <a href='043space.cc.html#L83'>address</a> = base_address + <span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span> + index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span>*size_of<span class="Delimiter">(</span><a href='032array.cc.html#L381'>array_element</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">));</span> +<span id="L557" class="LineNr">557 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"address to copy to is "</span> << <a href='043space.cc.html#L83'>address</a> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L558" class="LineNr">558 </span> <span class="Comment">// optimization: directly write the element rather than updating 'product'</span> <span id="L559" class="LineNr">559 </span> <span class="Comment">// and writing the entire array</span> <span id="L560" class="LineNr">560 </span> write_products = <span class="Constant">false</span><span class="Delimiter">;</span> -<span id="L561" class="LineNr">561 </span> vector<<span class="Normal">double</span>> value = read_memory<span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">));</span> +<span id="L561" class="LineNr">561 </span> vector<<span class="Normal">double</span>> value = read_memory<span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">));</span> <span id="L562" class="LineNr">562 </span> <span class="Comment">// Write Memory in PUT_INDEX in Run</span> <span id="L563" class="LineNr">563 </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 < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>value<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L564" class="LineNr">564 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L161'>trace</a><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">"storing "</span> << no_scientific<span class="Delimiter">(</span>value<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="Constant">" in location "</span> << address+i << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> @@ -704,10 +704,10 @@ if ('onhashchange' in window) { <span id="L639" class="LineNr">639 </span><span class="Delimiter">}</span> <span id="L640" class="LineNr">640 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L641" class="LineNr">641 </span><span class="Normal">case</span> LENGTH: <span class="Delimiter">{</span> -<span id="L642" class="LineNr">642 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> array = <a href='026call.cc.html#L85'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L642" class="LineNr">642 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> array = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L643" class="LineNr">643 </span> <span class="Comment">// Update LENGTH array in Run</span> <span id="L644" class="LineNr">644 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>array<span class="Delimiter">.</span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L645" class="LineNr">645 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> +<span id="L645" class="LineNr">645 </span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L85'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L197'>end</a><span class="Delimiter">();</span> <span id="L646" class="LineNr">646 </span> <span class="Conceal">¦</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L647" class="LineNr">647 </span> <span class="Delimiter">}</span> <span id="L648" class="LineNr">648 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> @@ -718,7 +718,7 @@ if ('onhashchange' in window) { <span id="L653" class="LineNr">653 </span><span class="Comment">//: optimization: none of the instructions in this layer use 'ingredients' so</span> <span id="L654" class="LineNr">654 </span><span class="Comment">//: stop copying potentially huge arrays into it.</span> <span id="L655" class="LineNr">655 </span><span class="Delimiter">:(before "End should_copy_ingredients Special-cases")</span> -<span id="L656" class="LineNr">656 </span><a href='010vm.cc.html#L14'>recipe_ordinal</a> r = <a href='026call.cc.html#L85'>current_instruction</a><span class="Delimiter">().</span>operation<span class="Delimiter">;</span> +<span id="L656" class="LineNr">656 </span><a href='010vm.cc.html#L14'>recipe_ordinal</a> r = <a href='026call.cc.html#L87'>current_instruction</a><span class="Delimiter">().</span>operation<span class="Delimiter">;</span> <span id="L657" class="LineNr">657 </span><span class="Normal">if</span> <span class="Delimiter">(</span>r == CREATE_ARRAY || r == INDEX || r == PUT_INDEX || r == LENGTH<span class="Delimiter">)</span> <span id="L658" class="LineNr">658 </span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> </pre> |