From 2c678a4e1d7f97c862342ee19cf2d6ee6e901d85 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 29 May 2017 14:21:32 -0700 Subject: 3897 - various updates to documentation --- html/036refcount.cc.html | 146 +++++++++++++++++++++++------------------------ 1 file changed, 73 insertions(+), 73 deletions(-) (limited to 'html/036refcount.cc.html') diff --git a/html/036refcount.cc.html b/html/036refcount.cc.html index 1be5a322..14614054 100644 --- a/html/036refcount.cc.html +++ b/html/036refcount.cc.html @@ -88,7 +88,7 @@ if ('onhashchange' in window) { 23 :(before "End Globals") 24 bool Reclaim_memory = true; 25 :(before "End Commandline Options(*arg)") - 26 else if (is_equal(*arg, "--no-reclaim")) { + 26 else if (is_equal(*arg, "--no-reclaim")) { 27 cerr << "Disabling memory reclamation. Some tests will fail.\n"; 28 Reclaim_memory = false; 29 } @@ -119,16 +119,16 @@ if ('onhashchange' in window) { 54 assert(new_address >= 0); 55 if (new_address == 0) return; 56 ++Total_refcount_updates; - 57 int new_refcount = get_or_insert(Memory, new_address); + 57 int new_refcount = get_or_insert(Memory, new_address); 58 trace(9999, "mem") << "incrementing refcount of " << new_address << ": " << new_refcount << " -> " << new_refcount+1 << end(); - 59 put(Memory, new_address, new_refcount+1); + 59 put(Memory, new_address, new_refcount+1); 60 } 61 62 void decrement_any_refcounts(const reagent& canonized_x) { 63 if (is_mu_address(canonized_x)) { 64 ¦ assert(canonized_x.value); 65 ¦ assert(!canonized_x.metadata.size); - 66 ¦ decrement_refcount(get_or_insert(Memory, canonized_x.value), payload_type(canonized_x.type), payload_size(canonized_x)); + 66 ¦ decrement_refcount(get_or_insert(Memory, canonized_x.value), payload_type(canonized_x.type), payload_size(canonized_x)); 67 } 68 // End Decrement Refcounts(canonized_x) 69 } @@ -137,10 +137,10 @@ if ('onhashchange' in window) { 72 assert(old_address >= 0); 73 if (old_address == 0) return; 74 ++Total_refcount_updates; - 75 int old_refcount = get_or_insert(Memory, old_address); + 75 int old_refcount = get_or_insert(Memory, old_address); 76 trace(9999, "mem") << "decrementing refcount of " << old_address << ": " << old_refcount << " -> " << old_refcount-1 << end(); 77 --old_refcount; - 78 put(Memory, old_address, old_refcount); + 78 put(Memory, old_address, old_refcount); 79 if (old_refcount < 0) { 80 ¦ tb_shutdown(); 81 ¦ cerr << "Negative refcount!!! " << old_address << ' ' << old_refcount << '\n'; @@ -202,13 +202,13 @@ if ('onhashchange' in window) { 137 def main [ 138 1:address:num <- new number:type 139 2:address:foo <- new foo:type - 140 *2:address:foo <- put *2:address:foo, x:offset, 1:address:num + 140 *2:address:foo <- put *2:address:foo, x:offset, 1:address:num 141 ] 142 +run: {1: ("address" "number")} <- new {number: "type"} 143 +mem: incrementing refcount of 1000: 0 -> 1 144 +run: {2: ("address" "foo")} <- new {foo: "type"} 145 +mem: incrementing refcount of 1002: 0 -> 1 - 146 +run: {2: ("address" "foo"), "lookup": ()} <- put {2: ("address" "foo"), "lookup": ()}, {x: "offset"}, {1: ("address" "number")} + 146 +run: {2: ("address" "foo"), "lookup": ()} <- put {2: ("address" "foo"), "lookup": ()}, {x: "offset"}, {1: ("address" "number")} 147 # put increments refcount 148 +mem: incrementing refcount of 1000: 1 -> 2 149 @@ -261,7 +261,7 @@ if ('onhashchange' in window) { 196 // todo: double-check data here as well 197 vector<double> data; 198 for (int i = 0; i < size_of(product); ++i) - 199 data.push_back(get_or_insert(Memory, base_address+/*skip tag*/1+i)); + 199 data.push_back(get_or_insert(Memory, base_address+/*skip tag*/1+i)); 200 update_any_refcounts(product, data); 201 202 //:: manage refcounts in instructions that copy multiple locations at a time @@ -273,7 +273,7 @@ if ('onhashchange' in window) { 208 def main [ 209 1:address:num <- new number:type 210 2:address:foo <- new foo:type - 211 *2:address:foo <- put *2:address:foo, x:offset, 1:address:num + 211 *2:address:foo <- put *2:address:foo, x:offset, 1:address:num 212 3:foo <- copy *2:address:foo 213 ] 214 +transform: compute address offsets for container foo @@ -281,7 +281,7 @@ if ('onhashchange' in window) { 216 +transform: address at offset 0 217 +run: {1: ("address" "number")} <- new {number: "type"} 218 +mem: incrementing refcount of 1000: 0 -> 1 - 219 +run: {2: ("address" "foo"), "lookup": ()} <- put {2: ("address" "foo"), "lookup": ()}, {x: "offset"}, {1: ("address" "number")} + 219 +run: {2: ("address" "foo"), "lookup": ()} <- put {2: ("address" "foo"), "lookup": ()}, {x: "offset"}, {1: ("address" "number")} 220 +mem: incrementing refcount of 1000: 1 -> 2 221 # copying a container increments refcounts of any contained addresses 222 +run: {3: "foo"} <- copy {2: ("address" "foo"), "lookup": ()} @@ -379,12 +379,12 @@ if ('onhashchange' in window) { 314 void compute_container_address_offsets(const recipe_ordinal r) { 315 recipe& caller = get(Recipe, r); 316 trace(9992, "transform") << "--- compute address offsets for " << caller.name << end(); - 317 for (int i = 0; i < SIZE(caller.steps); ++i) { + 317 for (int i = 0; i < SIZE(caller.steps); ++i) { 318 ¦ instruction& inst = caller.steps.at(i); 319 ¦ trace(9993, "transform") << "- compute address offsets for " << to_string(inst) << end(); - 320 ¦ for (int i = 0; i < SIZE(inst.ingredients); ++i) + 320 ¦ for (int i = 0; i < SIZE(inst.ingredients); ++i) 321 ¦ ¦ compute_container_address_offsets(inst.ingredients.at(i), " in '"+inst.original_string+"'"); - 322 ¦ for (int i = 0; i < SIZE(inst.products); ++i) + 322 ¦ for (int i = 0; i < SIZE(inst.products); ++i) 323 ¦ ¦ compute_container_address_offsets(inst.products.at(i), " in '"+inst.original_string+"'"); 324 } 325 } @@ -433,7 +433,7 @@ if ('onhashchange' in window) { 368 void compute_exclusive_container_address_offsets(const type_info& exclusive_container_info, const type_tree* full_type, const string& location_for_error_messages) { 369 container_metadata& metadata = get(Container_metadata, full_type); 370 trace(9994, "transform") << "compute address offsets for exclusive container " << exclusive_container_info.name << end(); - 371 for (int tag = 0; tag < SIZE(exclusive_container_info.elements); ++tag) { + 371 for (int tag = 0; tag < SIZE(exclusive_container_info.elements); ++tag) { 372 ¦ set<tag_condition_info> key; 373 ¦ key.insert(tag_condition_info(/*tag is at offset*/0, tag)); 374 ¦ append_addresses(/*skip tag offset*/1, variant_type(full_type, tag).type, metadata.address, key, location_for_error_messages); @@ -442,20 +442,20 @@ if ('onhashchange' in window) { 377 378 void append_addresses(int base_offset, const type_tree* type, map<set<tag_condition_info>, set<address_element_info> >& out, const set<tag_condition_info>& key, const string& location_for_error_messages) { 379 if (is_mu_address(type)) { - 380 ¦ get_or_insert(out, key).insert(address_element_info(base_offset, new type_tree(*payload_type(type)))); + 380 ¦ get_or_insert(out, key).insert(address_element_info(base_offset, new type_tree(*payload_type(type)))); 381 ¦ return; 382 } 383 const type_tree* base_type = type; 384 // Update base_type in append_container_address_offsets 385 const type_info& info = get(Type, base_type->value); 386 if (info.kind == CONTAINER) { - 387 ¦ for (int curr_index = 0, curr_offset = base_offset; curr_index < SIZE(info.elements); ++curr_index) { + 387 ¦ for (int curr_index = 0, curr_offset = base_offset; curr_index < SIZE(info.elements); ++curr_index) { 388 ¦ ¦ trace(9993, "transform") << "checking container " << base_type->name << ", element " << curr_index << end(); 389 ¦ ¦ reagent/*copy*/ element = element_type(type, curr_index); // not base_type 390 ¦ ¦ // Compute Container Address Offset(element) 391 ¦ ¦ if (is_mu_address(element)) { 392 ¦ ¦ ¦ trace(9993, "transform") << "address at offset " << curr_offset << end(); - 393 ¦ ¦ ¦ get_or_insert(out, key).insert(address_element_info(curr_offset, new type_tree(*payload_type(element.type)))); + 393 ¦ ¦ ¦ get_or_insert(out, key).insert(address_element_info(curr_offset, new type_tree(*payload_type(element.type)))); 394 ¦ ¦ ¦ ++curr_offset; 395 ¦ ¦ } 396 ¦ ¦ else if (is_mu_array(element)) { @@ -475,7 +475,7 @@ if ('onhashchange' in window) { 410 ¦ ¦ ¦ const type_tree* element_base_type = element.type; 411 ¦ ¦ ¦ // Update element_base_type For Exclusive Container in append_addresses 412 ¦ ¦ ¦ const type_info& element_info = get(Type, element_base_type->value); - 413 ¦ ¦ ¦ for (int tag = 0; tag < SIZE(element_info.elements); ++tag) { + 413 ¦ ¦ ¦ for (int tag = 0; tag < SIZE(element_info.elements); ++tag) { 414 ¦ ¦ ¦ ¦ set<tag_condition_info> new_key = key; 415 ¦ ¦ ¦ ¦ new_key.insert(tag_condition_info(curr_offset, tag)); 416 ¦ ¦ ¦ ¦ if (!contains_key(out, new_key)) @@ -490,7 +490,7 @@ if ('onhashchange' in window) { 425 ¦ } 426 } 427 else if (info.kind == EXCLUSIVE_CONTAINER) { - 428 ¦ for (int tag = 0; tag < SIZE(info.elements); ++tag) { + 428 ¦ for (int tag = 0; tag < SIZE(info.elements); ++tag) { 429 ¦ ¦ set<tag_condition_info> new_key = key; 430 ¦ ¦ new_key.insert(tag_condition_info(base_offset, tag)); 431 ¦ ¦ if (!contains_key(out, new_key)) @@ -503,7 +503,7 @@ if ('onhashchange' in window) { 438 439 :(before "End Unit Tests") 440 void test_container_address_offsets_empty() { - 441 int old_size = SIZE(Container_metadata); + 441 int old_size = SIZE(Container_metadata); 442 // define a container with no addresses 443 reagent r("x:point"); 444 compute_container_sizes(r, ""); // need to first pre-populate the metadata @@ -511,18 +511,18 @@ if ('onhashchange' in window) { 446 compute_container_address_offsets(r, ""); 447 // global metadata contains just the entry for foo 448 // no entries for non-container types or other junk - 449 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 449 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 450 // the reagent we scanned knows it has no addresses 451 CHECK(r.metadata.address.empty()); 452 // the global table contains an identical entry 453 CHECK(contains_key(Container_metadata, r.type)); 454 CHECK(get(Container_metadata, r.type).address.empty()); 455 // compute_container_address_offsets creates no new entries - 456 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 456 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 457 } 458 459 void test_container_address_offsets() { - 460 int old_size = SIZE(Container_metadata); + 460 int old_size = SIZE(Container_metadata); 461 // define a container with an address at offset 0 that we have the size for 462 run("container foo [\n" 463 ¦ ¦ " x:address:num\n" @@ -533,28 +533,28 @@ if ('onhashchange' in window) { 468 compute_container_address_offsets(r, ""); 469 // global metadata contains just the entry for foo 470 // no entries for non-container types or other junk - 471 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 471 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 472 // the reagent we scanned knows it has an address at offset 0 - 473 CHECK_EQ(SIZE(r.metadata.address), 1); + 473 CHECK_EQ(SIZE(r.metadata.address), 1); 474 CHECK(contains_key(r.metadata.address, set<tag_condition_info>())); 475 const set<address_element_info>& address_offsets = get(r.metadata.address, set<tag_condition_info>()); // unconditional for containers - 476 CHECK_EQ(SIZE(address_offsets), 1); + 476 CHECK_EQ(SIZE(address_offsets), 1); 477 CHECK_EQ(address_offsets.begin()->offset, 0); 478 CHECK(address_offsets.begin()->payload_type->atom); 479 CHECK_EQ(address_offsets.begin()->payload_type->name, "number"); 480 // the global table contains an identical entry 481 CHECK(contains_key(Container_metadata, r.type)); 482 const set<address_element_info>& address_offsets2 = get(get(Container_metadata, r.type).address, set<tag_condition_info>()); - 483 CHECK_EQ(SIZE(address_offsets2), 1); + 483 CHECK_EQ(SIZE(address_offsets2), 1); 484 CHECK_EQ(address_offsets2.begin()->offset, 0); 485 CHECK(address_offsets2.begin()->payload_type->atom); 486 CHECK_EQ(address_offsets2.begin()->payload_type->name, "number"); 487 // compute_container_address_offsets creates no new entries - 488 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 488 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 489 } 490 491 void test_container_address_offsets_2() { - 492 int old_size = SIZE(Container_metadata); + 492 int old_size = SIZE(Container_metadata); 493 // define a container with an address at offset 1 that we have the size for 494 run("container foo [\n" 495 ¦ ¦ " x:num\n" @@ -564,30 +564,30 @@ if ('onhashchange' in window) { 499 compute_container_sizes(r, ""); // need to first pre-populate the metadata 500 // global metadata contains just the entry for foo 501 // no entries for non-container types or other junk - 502 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 502 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 503 // scan 504 compute_container_address_offsets(r, ""); 505 // compute_container_address_offsets creates no new entries - 506 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 506 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 507 // the reagent we scanned knows it has an address at offset 1 - 508 CHECK_EQ(SIZE(r.metadata.address), 1); + 508 CHECK_EQ(SIZE(r.metadata.address), 1); 509 CHECK(contains_key(r.metadata.address, set<tag_condition_info>())); 510 const set<address_element_info>& address_offsets = get(r.metadata.address, set<tag_condition_info>()); - 511 CHECK_EQ(SIZE(address_offsets), 1); + 511 CHECK_EQ(SIZE(address_offsets), 1); 512 CHECK_EQ(address_offsets.begin()->offset, 1); // 513 CHECK(address_offsets.begin()->payload_type->atom); 514 CHECK_EQ(address_offsets.begin()->payload_type->name, "number"); 515 // the global table contains an identical entry 516 CHECK(contains_key(Container_metadata, r.type)); 517 const set<address_element_info>& address_offsets2 = get(get(Container_metadata, r.type).address, set<tag_condition_info>()); - 518 CHECK_EQ(SIZE(address_offsets2), 1); + 518 CHECK_EQ(SIZE(address_offsets2), 1); 519 CHECK_EQ(address_offsets2.begin()->offset, 1); // 520 CHECK(address_offsets2.begin()->payload_type->atom); 521 CHECK_EQ(address_offsets2.begin()->payload_type->name, "number"); 522 } 523 524 void test_container_address_offsets_nested() { - 525 int old_size = SIZE(Container_metadata); + 525 int old_size = SIZE(Container_metadata); 526 // define a container with a nested container containing an address 527 run("container foo [\n" 528 ¦ ¦ " x:address:num\n" @@ -601,30 +601,30 @@ if ('onhashchange' in window) { 536 compute_container_sizes(r, ""); // need to first pre-populate the metadata 537 // global metadata contains entries for bar and included types: point and foo 538 // no entries for non-container types or other junk - 539 CHECK_EQ(SIZE(Container_metadata)-old_size, 3); + 539 CHECK_EQ(SIZE(Container_metadata)-old_size, 3); 540 // scan 541 compute_container_address_offsets(r, ""); 542 // the reagent we scanned knows it has an address at offset 2 - 543 CHECK_EQ(SIZE(r.metadata.address), 1); + 543 CHECK_EQ(SIZE(r.metadata.address), 1); 544 CHECK(contains_key(r.metadata.address, set<tag_condition_info>())); 545 const set<address_element_info>& address_offsets = get(r.metadata.address, set<tag_condition_info>()); - 546 CHECK_EQ(SIZE(address_offsets), 1); + 546 CHECK_EQ(SIZE(address_offsets), 1); 547 CHECK_EQ(address_offsets.begin()->offset, 2); // 548 CHECK(address_offsets.begin()->payload_type->atom); 549 CHECK_EQ(address_offsets.begin()->payload_type->name, "number"); 550 // the global table also knows its address offset 551 CHECK(contains_key(Container_metadata, r.type)); 552 const set<address_element_info>& address_offsets2 = get(get(Container_metadata, r.type).address, set<tag_condition_info>()); - 553 CHECK_EQ(SIZE(address_offsets2), 1); + 553 CHECK_EQ(SIZE(address_offsets2), 1); 554 CHECK_EQ(address_offsets2.begin()->offset, 2); // 555 CHECK(address_offsets2.begin()->payload_type->atom); 556 CHECK_EQ(address_offsets2.begin()->payload_type->name, "number"); 557 // compute_container_address_offsets creates no new entries - 558 CHECK_EQ(SIZE(Container_metadata)-old_size, 3); + 558 CHECK_EQ(SIZE(Container_metadata)-old_size, 3); 559 } 560 561 void test_container_address_offsets_from_address() { - 562 int old_size = SIZE(Container_metadata); + 562 int old_size = SIZE(Container_metadata); 563 // define a container with an address at offset 0 564 run("container foo [\n" 565 ¦ ¦ " x:address:num\n" @@ -633,23 +633,23 @@ if ('onhashchange' in window) { 568 compute_container_sizes(r, ""); // need to first pre-populate the metadata 569 // global metadata contains just the entry for foo 570 // no entries for non-container types or other junk - 571 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 571 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 572 // scan an address to the container 573 compute_container_address_offsets(r, ""); 574 // compute_container_address_offsets creates no new entries - 575 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 575 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 576 // scanning precomputed metadata for the container 577 reagent container("x:foo"); 578 CHECK(contains_key(Container_metadata, container.type)); 579 const set<address_element_info>& address_offsets2 = get(get(Container_metadata, container.type).address, set<tag_condition_info>()); - 580 CHECK_EQ(SIZE(address_offsets2), 1); + 580 CHECK_EQ(SIZE(address_offsets2), 1); 581 CHECK_EQ(address_offsets2.begin()->offset, 0); 582 CHECK(address_offsets2.begin()->payload_type->atom); 583 CHECK_EQ(address_offsets2.begin()->payload_type->name, "number"); 584 } 585 586 void test_container_address_offsets_from_array() { - 587 int old_size = SIZE(Container_metadata); + 587 int old_size = SIZE(Container_metadata); 588 // define a container with an address at offset 0 589 run("container foo [\n" 590 ¦ ¦ " x:address:num\n" @@ -658,23 +658,23 @@ if ('onhashchange' in window) { 593 compute_container_sizes(r, ""); // need to first pre-populate the metadata 594 // global metadata contains just the entry for foo 595 // no entries for non-container types or other junk - 596 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 596 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 597 // scan an array of the container 598 compute_container_address_offsets(r, ""); 599 // compute_container_address_offsets creates no new entries - 600 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 600 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 601 // scanning precomputed metadata for the container 602 reagent container("x:foo"); 603 CHECK(contains_key(Container_metadata, container.type)); 604 const set<address_element_info>& address_offsets2 = get(get(Container_metadata, container.type).address, set<tag_condition_info>()); - 605 CHECK_EQ(SIZE(address_offsets2), 1); + 605 CHECK_EQ(SIZE(address_offsets2), 1); 606 CHECK_EQ(address_offsets2.begin()->offset, 0); 607 CHECK(address_offsets2.begin()->payload_type->atom); 608 CHECK_EQ(address_offsets2.begin()->payload_type->name, "number"); 609 } 610 611 void test_container_address_offsets_from_address_to_array() { - 612 int old_size = SIZE(Container_metadata); + 612 int old_size = SIZE(Container_metadata); 613 // define a container with an address at offset 0 614 run("container foo [\n" 615 ¦ ¦ " x:address:num\n" @@ -683,23 +683,23 @@ if ('onhashchange' in window) { 618 compute_container_sizes(r, ""); // need to first pre-populate the metadata 619 // global metadata contains just the entry for foo 620 // no entries for non-container types or other junk - 621 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 621 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 622 // scan an address to an array of the container 623 compute_container_address_offsets(r, ""); 624 // compute_container_address_offsets creates no new entries - 625 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 625 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 626 // scanning precomputed metadata for the container 627 reagent container("x:foo"); 628 CHECK(contains_key(Container_metadata, container.type)); 629 const set<address_element_info>& address_offsets2 = get(get(Container_metadata, container.type).address, set<tag_condition_info>()); - 630 CHECK_EQ(SIZE(address_offsets2), 1); + 630 CHECK_EQ(SIZE(address_offsets2), 1); 631 CHECK_EQ(address_offsets2.begin()->offset, 0); 632 CHECK(address_offsets2.begin()->payload_type->atom); 633 CHECK_EQ(address_offsets2.begin()->payload_type->name, "number"); 634 } 635 636 void test_container_address_offsets_from_static_array() { - 637 int old_size = SIZE(Container_metadata); + 637 int old_size = SIZE(Container_metadata); 638 // define a container with an address at offset 0 639 run("container foo [\n" 640 ¦ ¦ " x:address:num\n" @@ -708,23 +708,23 @@ if ('onhashchange' in window) { 643 compute_container_sizes(r, ""); // need to first pre-populate the metadata 644 // global metadata contains just the entry for foo 645 // no entries for non-container types or other junk - 646 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 646 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 647 // scan a static array of the container 648 compute_container_address_offsets(r, ""); 649 // compute_container_address_offsets creates no new entries - 650 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 650 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 651 // scanning precomputed metadata for the container 652 reagent container("x:foo"); 653 CHECK(contains_key(Container_metadata, container.type)); 654 const set<address_element_info>& address_offsets2 = get(get(Container_metadata, container.type).address, set<tag_condition_info>()); - 655 CHECK_EQ(SIZE(address_offsets2), 1); + 655 CHECK_EQ(SIZE(address_offsets2), 1); 656 CHECK_EQ(address_offsets2.begin()->offset, 0); 657 CHECK(address_offsets2.begin()->payload_type->atom); 658 CHECK_EQ(address_offsets2.begin()->payload_type->name, "number"); 659 } 660 661 void test_container_address_offsets_from_address_to_static_array() { - 662 int old_size = SIZE(Container_metadata); + 662 int old_size = SIZE(Container_metadata); 663 // define a container with an address at offset 0 664 run("container foo [\n" 665 ¦ ¦ " x:address:num\n" @@ -733,23 +733,23 @@ if ('onhashchange' in window) { 668 compute_container_sizes(r, ""); // need to first pre-populate the metadata 669 // global metadata contains just the entry for foo 670 // no entries for non-container types or other junk - 671 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 671 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 672 // scan an address to a static array of the container 673 compute_container_address_offsets(r, ""); 674 // compute_container_address_offsets creates no new entries - 675 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 675 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 676 // scanning precomputed metadata for the container 677 reagent container("x:foo"); 678 CHECK(contains_key(Container_metadata, container.type)); 679 const set<address_element_info>& address_offsets2 = get(get(Container_metadata, container.type).address, set<tag_condition_info>()); - 680 CHECK_EQ(SIZE(address_offsets2), 1); + 680 CHECK_EQ(SIZE(address_offsets2), 1); 681 CHECK_EQ(address_offsets2.begin()->offset, 0); 682 CHECK(address_offsets2.begin()->payload_type->atom); 683 CHECK_EQ(address_offsets2.begin()->payload_type->name, "number"); 684 } 685 686 void test_container_address_offsets_from_repeated_address_and_array_types() { - 687 int old_size = SIZE(Container_metadata); + 687 int old_size = SIZE(Container_metadata); 688 // define a container with an address at offset 0 689 run("container foo [\n" 690 ¦ ¦ " x:address:num\n" @@ -759,15 +759,15 @@ if ('onhashchange' in window) { 694 compute_container_sizes(r, ""); // need to first pre-populate the metadata 695 // global metadata contains just the entry for foo 696 // no entries for non-container types or other junk - 697 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 697 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 698 compute_container_address_offsets(r, ""); 699 // compute_container_address_offsets creates no new entries - 700 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); + 700 CHECK_EQ(SIZE(Container_metadata)-old_size, 1); 701 // scanning precomputed metadata for the container 702 reagent container("x:foo"); 703 CHECK(contains_key(Container_metadata, container.type)); 704 const set<address_element_info>& address_offsets2 = get(get(Container_metadata, container.type).address, set<tag_condition_info>()); - 705 CHECK_EQ(SIZE(address_offsets2), 1); + 705 CHECK_EQ(SIZE(address_offsets2), 1); 706 CHECK_EQ(address_offsets2.begin()->offset, 0); 707 CHECK(address_offsets2.begin()->payload_type->atom); 708 CHECK_EQ(address_offsets2.begin()->payload_type->name, "number"); @@ -798,7 +798,7 @@ if ('onhashchange' in window) { 733 for (map<set<tag_condition_info>, set<address_element_info> >::const_iterator p = metadata.address.begin(); p != metadata.address.end(); ++p) { 734 ¦ if (!all_match(data, p->first)) continue; 735 ¦ for (set<address_element_info>::const_iterator info = p->second.begin(); info != p->second.end(); ++info) { - 736 ¦ ¦ int element_address = get_or_insert(Memory, canonized_x.value + info->offset); + 736 ¦ ¦ int element_address = get_or_insert(Memory, canonized_x.value + info->offset); 737 ¦ ¦ reagent/*local*/ element; 738 ¦ ¦ element.set_value(element_address+/*skip refcount*/1); 739 ¦ ¦ element.type = new type_tree(*info->payload_type); @@ -827,13 +827,13 @@ if ('onhashchange' in window) { 762 1:address:num <- new number:type 763 2:bar <- merge 1:address:num 764 3:address:foo <- new foo:type - 765 *3:address:foo <- put *3:address:foo, a:offset, 2:bar + 765 *3:address:foo <- put *3:address:foo, a:offset, 2:bar 766 ] 767 +run: {1: ("address" "number")} <- new {number: "type"} 768 +mem: incrementing refcount of 1000: 0 -> 1 769 +run: {2: "bar"} <- merge {1: ("address" "number")} 770 +mem: incrementing refcount of 1000: 1 -> 2 - 771 +run: {3: ("address" "foo"), "lookup": ()} <- put {3: ("address" "foo"), "lookup": ()}, {a: "offset"}, {2: "bar"} + 771 +run: {3: ("address" "foo"), "lookup": ()} <- put {3: ("address" "foo"), "lookup": ()}, {a: "offset"}, {2: "bar"} 772 # put increments refcount inside container 773 +mem: incrementing refcount of 1000: 2 -> 3 774 @@ -894,9 +894,9 @@ if ('onhashchange' in window) { 829 def main [ 830 1:address:num <- new number:type 831 2:address:curr <- new curr:type - 832 *2:address:curr <- put *2:address:curr, 1:offset/y, 1:address:num + 832 *2:address:curr <- put *2:address:curr, 1:offset/y, 1:address:num 833 3:address:foo <- new foo:type - 834 *3:address:foo <- put *3:address:foo, 1:offset/b, *2:address:curr + 834 *3:address:foo <- put *3:address:foo, 1:offset/b, *2:address:curr 835 4:foo <- copy *3:address:foo 836 ] 837 +transform: compute address offsets for container foo @@ -905,10 +905,10 @@ if ('onhashchange' in window) { 840 +run: {1: ("address" "number")} <- new {number: "type"} 841 +mem: incrementing refcount of 1000: 0 -> 1 842 # storing an address in a container updates its refcount - 843 +run: {2: ("address" "curr"), "lookup": ()} <- put {2: ("address" "curr"), "lookup": ()}, {1: "offset", "y": ()}, {1: ("address" "number")} + 843 +run: {2: ("address" "curr"), "lookup": ()} <- put {2: ("address" "curr"), "lookup": ()}, {1: "offset", "y": ()}, {1: ("address" "number")} 844 +mem: incrementing refcount of 1000: 1 -> 2 845 # storing a container in a container updates refcounts of any contained addresses - 846 +run: {3: ("address" "foo"), "lookup": ()} <- put {3: ("address" "foo"), "lookup": ()}, {1: "offset", "b": ()}, {2: ("address" "curr"), "lookup": ()} + 846 +run: {3: ("address" "foo"), "lookup": ()} <- put {3: ("address" "foo"), "lookup": ()}, {1: "offset", "b": ()}, {2: ("address" "curr"), "lookup": ()} 847 +mem: incrementing refcount of 1000: 2 -> 3 848 # copying a container containing a container containing an address updates refcount 849 +run: {4: "foo"} <- copy {3: ("address" "foo"), "lookup": ()} @@ -1137,7 +1137,7 @@ if ('onhashchange' in window) { 1072 :(code) 1073 void dump_recipe_profile(recipe_ordinal ridx, const recipe& r, ostream& out) { 1074 out << "recipe " << r.name << " [\n"; -1075 for (int i = 0; i < SIZE(r.steps); ++i) { +1075 for (int i = 0; i < SIZE(r.steps); ++i) { 1076 ¦ out << std::setw(6) << Num_refcount_updates[ridx][i] << ' ' << to_string(r.steps.at(i)) << '\n'; 1077 } 1078 out << "]\n\n"; -- cgit 1.4.1-2-gfad0