about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-03-12 18:36:14 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-03-12 18:36:14 -0800
commitfc5951534a6808b7a5064d289b98443c1d0e4800 (patch)
tree9ccbb7e59e1302d56bf61ef765f4a035b4ad6c32
parenta2739bc6340514078055f4c2e5085660d34e0528 (diff)
downloadmu-fc5951534a6808b7a5064d289b98443c1d0e4800.tar.gz
2763
-rw-r--r--037new.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/037new.cc b/037new.cc
index a465e335..04780edc 100644
--- a/037new.cc
+++ b/037new.cc
@@ -443,17 +443,18 @@ if (x.type->value == get(Type_ordinal, "address")
   }
   // abandon old address if necessary
   // do this after all refcount updates are done just in case old and new are identical
+  assert(old_address >= 0);
+  if (old_address == 0) return;
   assert(get_or_insert(Memory, old_address) >= 0);
-  if (old_address && get_or_insert(Memory, old_address) == 0) {
-    // lookup_memory without drop_one_lookup {
-    trace(9999, "mem") << "automatically abandoning " << old_address << end();
-    trace(9999, "mem") << "computing size to abandon at " << x.value << end();
-    x.set_value(get_or_insert(Memory, x.value)+/*skip refcount*/1);
-    drop_from_type(x, "address");
-    drop_from_type(x, "shared");
-    // }
-    abandon(old_address, size_of(x)+/*refcount*/1);
-  }
+  if (get_or_insert(Memory, old_address) > 0) return;
+  // lookup_memory without drop_one_lookup {
+  trace(9999, "mem") << "automatically abandoning " << old_address << end();
+  trace(9999, "mem") << "computing size to abandon at " << x.value << end();
+  x.set_value(get_or_insert(Memory, x.value)+/*skip refcount*/1);
+  drop_from_type(x, "address");
+  drop_from_type(x, "shared");
+  // }
+  abandon(old_address, size_of(x)+/*refcount*/1);
   return;
 }