attempt to clear stale references on VM C stack
[bpt/guile.git] / libguile / vm-engine.h
index 000397d..52467c2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
 #define ASSERT_BOUND(x)
 #endif
 
+#define DEAD(v) v = SCM_UNDEFINED
+
 #if VM_CHECK_OBJECT
 #define SET_OBJECT_COUNT(n) object_count = n
 #else
@@ -325,6 +327,7 @@ do                                          \
       CONS (l, x, l);                           \
     }                                           \
   PUSH (l);                                    \
+  DEAD (l);                                     \
 } while (0)
 
 /* The opposite: push all of the elements in L onto the list. */
@@ -350,7 +353,9 @@ do {                                                \
       CONS (l, o, l);                          \
       POP (o);                                 \
     }                                          \
+  DEAD (o);                                     \
   PUSH (l);                                    \
+  DEAD (l);                                     \
 } while (0)
 
 #define POP_CONS_MARK()                                \
@@ -363,7 +368,9 @@ do {                                                \
       CONS (l, o, l);                          \
       POP (o);                                 \
     }                                          \
+  DEAD (o);                                     \
   PUSH (l);                                    \
+  DEAD (l);                                     \
 } while (0)
 
 \f