about summary refs log tree commit diff stats
path: root/072scheduler.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-08-17 12:14:09 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-08-17 12:14:09 -0700
commit75ab8732386096a77113514f767e134e42a5435f (patch)
treea3fd2a9a578b8fd3965b8c7f6905600fbbcfcb58 /072scheduler.cc
parented8e4c17417828528fbb2350b19f24d73c989fc9 (diff)
downloadmu-75ab8732386096a77113514f767e134e42a5435f.tar.gz
3212 - bugfix in refcount management
When updating refcounts for a typed segment of memory being copied over
with another, we were only ever using the new copy's data to determine
any tags for exclusive containers. Looks like the right way to do
refcounts is to increment and decrement separately.

Hopefully this is a complete fix for the intermittent but
non-deterministic errors we've been encountering while running the edit/
app.
Diffstat (limited to '072scheduler.cc')
-rw-r--r--072scheduler.cc24
1 files changed, 0 insertions, 24 deletions
diff --git a/072scheduler.cc b/072scheduler.cc
index de5f5ca5..0b0dd54f 100644
--- a/072scheduler.cc
+++ b/072scheduler.cc
@@ -262,30 +262,6 @@ increment_any_refcounts(ingredient, ingredients.at(i));
 :(before "End should_update_refcounts_in_write_memory Special-cases For Primitives")
 if (inst.operation == NEXT_INGREDIENT || inst.operation == NEXT_INGREDIENT_WITHOUT_TYPECHECKING)
   return false;
-:(code)
-void increment_any_refcounts(const reagent& x, const vector<double>& data) {
-  if (is_mu_address(x)) {
-    assert(scalar(data));
-    assert(x.value);
-    assert(!x.metadata.size);
-    increment_refcount(data.at(0));
-  }
-  if (is_mu_container(x) || is_mu_exclusive_container(x)) {
-    const container_metadata& metadata = get(Container_metadata, x.type);
-    for (map<set<tag_condition_info>, set<address_element_info> >::const_iterator p = metadata.address.begin(); p != metadata.address.end(); ++p) {
-      if (!all_match(data, p->first)) continue;
-      for (set<address_element_info>::const_iterator info = p->second.begin(); info != p->second.end(); ++info)
-        increment_refcount(data.at(info->offset));
-    }
-  }
-}
-
-void increment_refcount(int address) {
-  if (address == 0) return;
-  int refcount = get_or_insert(Memory, address);
-  trace(9999, "mem") << "incrementing refcount of " << address << ": " << refcount << " -> " << refcount+1 << end();
-  put(Memory, address, refcount+1);
-}
 
 :(scenario start_running_returns_routine_id)
 def f1 [