From fc5951534a6808b7a5064d289b98443c1d0e4800 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 12 Mar 2016 18:36:14 -0800 Subject: 2763 --- 037new.cc | 21 +++++++++++---------- 1 file 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; } -- cgit 1.4.1-2-gfad0