From 850822ffbfd441d05161452be28b54f882b1b378 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 1 Nov 2017 03:41:16 -0700 Subject: 4102 --- html/032array.cc.html | 56 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'html/032array.cc.html') 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) { 49 } 50 :(before "End Primitive Recipe Implementations") 51 case CREATE_ARRAY: { - 52 reagent/*copy*/ product = current_instruction().products.at(0); + 52 reagent/*copy*/ product = current_instruction().products.at(0); 53 // Update CREATE_ARRAY product in Run 54 int base_address = product.value; 55 type_tree* array_length_from_type = product.type->right->right; @@ -170,7 +170,7 @@ if ('onhashchange' in window) { 105 :(before "End size_of(reagent r) Special-cases") 106 if (!r.type->atom && r.type->left->atom && r.type->left->value == get(Type_ordinal, "array")) { 107 if (!r.type->right) { -108 ¦ raise << maybe(current_recipe_name()) << "'" << r.original_string << "' is an array of what?\n" << end(); +108 ¦ raise << maybe(current_recipe_name()) << "'" << r.original_string << "' is an array of what?\n" << end(); 109 ¦ return 1; 110 } 111 return /*space for length*/1 + array_length(r)*size_of(array_element(r.type)); @@ -185,7 +185,7 @@ if ('onhashchange' in window) { 120 ¦ // get size from type 121 ¦ return to_integer(type->right->right->left->name); 122 } -123 cerr << to_string(type) << '\n'; +123 cerr << to_string(type) << '\n'; 124 assert(false); 125 } 126 @@ -238,8 +238,8 @@ if ('onhashchange' in window) { 173 //: disable the size mismatch check for 'merge' instructions since containers 174 //: can contain arrays, and since we already do plenty of checking for them 175 :(before "End size_mismatch(x) Special-cases") -176 if (current_call().running_step_index < SIZE(get(Recipe, current_call().running_recipe).steps) -177 ¦ && current_instruction().operation == MERGE) { +176 if (current_call().running_step_index < SIZE(get(Recipe, current_call().running_recipe).steps) +177 ¦ && current_instruction().operation == MERGE) { 178 return false; 179 } 180 @@ -289,7 +289,7 @@ if ('onhashchange' in window) { 224 reagent container("x:point"); 225 CHECK(!contains_key(Container_metadata, container.type)); 226 // scanning an address to an array of the container precomputes the size of the container -227 reagent r("x:address:array:point"); +227 reagent r("x:address:array:point"); 228 compute_container_sizes(r, ""); 229 CHECK(contains_key(Container_metadata, container.type)); 230 CHECK_EQ(get(Container_metadata, container.type).size, 2); @@ -313,7 +313,7 @@ if ('onhashchange' in window) { 248 reagent container("x:point"); 249 int old_size = SIZE(Container_metadata); 250 // scanning an address to an array of the container precomputes the size of the container -251 reagent r("x:address:array:point:10"); +251 reagent r("x:address:array:point:10"); 252 compute_container_sizes(r, ""); 253 CHECK(contains_key(Container_metadata, container.type)); 254 CHECK_EQ(get(Container_metadata, container.type).size, 2); @@ -326,7 +326,7 @@ if ('onhashchange' in window) { 261 reagent container("x:point"); 262 int old_size = SIZE(Container_metadata); 263 // scanning repeated address and array types modifying the container precomputes the size of the container -264 reagent r("x:address:array:address:array:point:10"); +264 reagent r("x:address:array:address:array:point:10"); 265 compute_container_sizes(r, ""); 266 CHECK(contains_key(Container_metadata, container.type)); 267 CHECK_EQ(get(Container_metadata, container.type).size, 2); @@ -339,7 +339,7 @@ if ('onhashchange' in window) { 274 reagent container("x:point"); 275 int old_size = SIZE(Container_metadata); 276 // scanning address to array with a typo -277 reagent r("x:address:array:adress:number"); +277 reagent r("x:address:array:adress:number"); 278 compute_container_sizes(r, ""); // should not crash 279 // no non-container types precomputed 280 CHECK_EQ(SIZE(Container_metadata), old_size); @@ -359,11 +359,11 @@ if ('onhashchange' in window) { 294 295 :(scenario index_compound_element) 296 def main [ -297 {1: (array (address number) 3)} <- create-array +297 {1: (array (address number) 3)} <- create-array 298 2:num <- copy 14 299 3:num <- copy 15 300 4:num <- copy 16 -301 5:address:num <- index {1: (array (address number) 3)}, 0 +301 5:address:num <- index {1: (array (address number) 3)}, 0 302 ] 303 +mem: storing 14 in location 5 304 @@ -413,26 +413,26 @@ if ('onhashchange' in window) { 348 } 349 :(before "End Primitive Recipe Implementations") 350 case INDEX: { -351 reagent/*copy*/ base = current_instruction().ingredients.at(0); +351 reagent/*copy*/ base = current_instruction().ingredients.at(0); 352 // Update INDEX base in Run 353 int base_address = base.value; -354 trace(9998, "run") << "base address is " << base_address << end(); +354 trace(9998, "run") << "base address is " << base_address << end(); 355 if (base_address == 0) { -356 ¦ raise << maybe(current_recipe_name()) << "tried to access location 0 in '" << to_original_string(current_instruction()) << "'\n" << end(); +356 ¦ raise << maybe(current_recipe_name()) << "tried to access location 0 in '" << to_original_string(current_instruction()) << "'\n" << end(); 357 ¦ break; 358 } -359 reagent/*copy*/ index = current_instruction().ingredients.at(1); +359 reagent/*copy*/ index = current_instruction().ingredients.at(1); 360 // Update INDEX index in Run 361 vector<double> index_val(read_memory(index)); 362 if (index_val.at(0) < 0 || index_val.at(0) >= get_or_insert(Memory, base_address)) { -363 ¦ raise << maybe(current_recipe_name()) << "invalid index " << no_scientific(index_val.at(0)) << " in '" << to_original_string(current_instruction()) << "'\n" << end(); +363 ¦ raise << maybe(current_recipe_name()) << "invalid index " << no_scientific(index_val.at(0)) << " in '" << to_original_string(current_instruction()) << "'\n" << end(); 364 ¦ break; 365 } 366 reagent/*local*/ element; 367 element.type = copy_array_element(base.type); 368 element.set_value(base_address + /*skip length*/1 + index_val.at(0)*size_of(element.type)); 369 trace(9998, "run") << "address to copy is " << element.value << end(); -370 trace(9998, "run") << "its type is " << to_string(element.type) << end(); +370 trace(9998, "run") << "its type is " << to_string(element.type) << end(); 371 // Read element 372 products.push_back(read_memory(element)); 373 break; @@ -477,7 +477,7 @@ if ('onhashchange' in window) { 412 put(Memory, 2, 14); 413 put(Memory, 3, 15); 414 put(Memory, 4, 16); -415 reagent x("1:array:address:num"); // 3 types, but not a static array +415 reagent x("1:array:address:num"); // 3 types, but not a static array 416 populate_value(x); 417 CHECK_EQ(array_length(x), 3); 418 } @@ -604,26 +604,26 @@ if ('onhashchange' in window) { 539 } 540 :(before "End Primitive Recipe Implementations") 541 case PUT_INDEX: { -542 reagent/*copy*/ base = current_instruction().ingredients.at(0); +542 reagent/*copy*/ base = current_instruction().ingredients.at(0); 543 // Update PUT_INDEX base in Run 544 int base_address = base.value; 545 if (base_address == 0) { -546 ¦ raise << maybe(current_recipe_name()) << "tried to access location 0 in '" << to_original_string(current_instruction()) << "'\n" << end(); +546 ¦ raise << maybe(current_recipe_name()) << "tried to access location 0 in '" << to_original_string(current_instruction()) << "'\n" << end(); 547 ¦ break; 548 } -549 reagent/*copy*/ index = current_instruction().ingredients.at(1); +549 reagent/*copy*/ index = current_instruction().ingredients.at(1); 550 // Update PUT_INDEX index in Run 551 vector<double> index_val(read_memory(index)); 552 if (index_val.at(0) < 0 || index_val.at(0) >= get_or_insert(Memory, base_address)) { -553 ¦ raise << maybe(current_recipe_name()) << "invalid index " << no_scientific(index_val.at(0)) << " in '" << to_original_string(current_instruction()) << "'\n" << end(); +553 ¦ raise << maybe(current_recipe_name()) << "invalid index " << no_scientific(index_val.at(0)) << " in '" << to_original_string(current_instruction()) << "'\n" << end(); 554 ¦ break; 555 } -556 int address = base_address + /*skip length*/1 + index_val.at(0)*size_of(array_element(base.type)); -557 trace(9998, "run") << "address to copy to is " << address << end(); +556 int address = base_address + /*skip length*/1 + index_val.at(0)*size_of(array_element(base.type)); +557 trace(9998, "run") << "address to copy to is " << address << end(); 558 // optimization: directly write the element rather than updating 'product' 559 // and writing the entire array 560 write_products = false; -561 vector<double> value = read_memory(current_instruction().ingredients.at(2)); +561 vector<double> value = read_memory(current_instruction().ingredients.at(2)); 562 // Write Memory in PUT_INDEX in Run 563 for (int i = 0; i < SIZE(value); ++i) { 564 ¦ trace(9999, "mem") << "storing " << no_scientific(value.at(i)) << " in location " << address+i << end(); @@ -704,10 +704,10 @@ if ('onhashchange' in window) { 639 } 640 :(before "End Primitive Recipe Implementations") 641 case LENGTH: { -642 reagent/*copy*/ array = current_instruction().ingredients.at(0); +642 reagent/*copy*/ array = current_instruction().ingredients.at(0); 643 // Update LENGTH array in Run 644 if (array.value == 0) { -645 ¦ raise << maybe(current_recipe_name()) << "tried to access location 0 in '" << to_original_string(current_instruction()) << "'\n" << end(); +645 ¦ raise << maybe(current_recipe_name()) << "tried to access location 0 in '" << to_original_string(current_instruction()) << "'\n" << end(); 646 ¦ break; 647 } 648 products.resize(1); @@ -718,7 +718,7 @@ if ('onhashchange' in window) { 653 //: optimization: none of the instructions in this layer use 'ingredients' so 654 //: stop copying potentially huge arrays into it. 655 :(before "End should_copy_ingredients Special-cases") -656 recipe_ordinal r = current_instruction().operation; +656 recipe_ordinal r = current_instruction().operation; 657 if (r == CREATE_ARRAY || r == INDEX || r == PUT_INDEX || r == LENGTH) 658 return false; -- cgit 1.4.1-2-gfad0