about summary refs log tree commit diff stats
path: root/036refcount.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-05-21 14:25:16 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-05-21 14:25:16 -0700
commit829fcd8374ea9029119bb37c42aeecf53523995c (patch)
treec3b346ad03273e93f843d085e5bcf70e26ee60a6 /036refcount.cc
parent9d2d0593b4e78958de1322574b058f2a6d8fe521 (diff)
downloadmu-829fcd8374ea9029119bb37c42aeecf53523995c.tar.gz
3875
Diffstat (limited to '036refcount.cc')
-rw-r--r--036refcount.cc31
1 files changed, 15 insertions, 16 deletions
diff --git a/036refcount.cc b/036refcount.cc
index f3d27c82..80000347 100644
--- a/036refcount.cc
+++ b/036refcount.cc
@@ -69,24 +69,23 @@ void decrement_any_refcounts(const reagent& canonized_x) {
 
 void decrement_refcount(int old_address, const type_tree* payload_type, int payload_size) {
   assert(old_address >= 0);
-  if (old_address) {
-    int old_refcount = get_or_insert(Memory, old_address);
-    trace(9999, "mem") << "decrementing refcount of " << old_address << ": " << old_refcount << " -> " << old_refcount-1 << end();
-    --old_refcount;
-    put(Memory, old_address, old_refcount);
-    if (old_refcount < 0) {
-      tb_shutdown();
-      cerr << "Negative refcount!!! " << old_address << ' ' << old_refcount << '\n';
-      if (Trace_stream) {
-        cerr << "Saving trace to last_trace.\n";
-        ofstream fout("last_trace");
-        fout << Trace_stream->readable_contents("");
-        fout.close();
-      }
-      exit(0);
+  if (old_address == 0) return;
+  int old_refcount = get_or_insert(Memory, old_address);
+  trace(9999, "mem") << "decrementing refcount of " << old_address << ": " << old_refcount << " -> " << old_refcount-1 << end();
+  --old_refcount;
+  put(Memory, old_address, old_refcount);
+  if (old_refcount < 0) {
+    tb_shutdown();
+    cerr << "Negative refcount!!! " << old_address << ' ' << old_refcount << '\n';
+    if (Trace_stream) {
+      cerr << "Saving trace to last_trace.\n";
+      ofstream fout("last_trace");
+      fout << Trace_stream->readable_contents("");
+      fout.close();
     }
-    // End Decrement Refcount(old_address, payload_type, payload_size)
+    exit(0);
   }
+  // End Decrement Refcount(old_address, payload_type, payload_size)
 }
 
 int payload_size(reagent/*copy*/ x) {