[svn:parrot] r40846 - in trunk: include/parrot src/gc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Fri Aug 28 20:50:11 UTC 2009


Author: NotFound
Date: Fri Aug 28 20:50:10 2009
New Revision: 40846
URL: https://trac.parrot.org/parrot/changeset/40846

Log:
[cage] add some checks to C stack gc related code

Modified:
   trunk/include/parrot/extend.h
   trunk/src/gc/system.c

Modified: trunk/include/parrot/extend.h
==============================================================================
--- trunk/include/parrot/extend.h	Fri Aug 28 20:45:06 2009	(r40845)
+++ trunk/include/parrot/extend.h	Fri Aug 28 20:50:10 2009	(r40846)
@@ -35,10 +35,15 @@
    pointer, which is on the stack and as good a thing as any to use as
    an anchor */
 #define PARROT_CALLIN_START(x) void *oldtop = (x)->lo_var_ptr; \
-                               if (!oldtop) (x)->lo_var_ptr = &oldtop;
+                               if (oldtop) {} else (x)->lo_var_ptr = &oldtop
 /* Put the stack top back, if what we cached was NULL. Otherwise we
    leave it alone and assume it's OK */
-#define PARROT_CALLIN_END(x)   if (!oldtop) (x)->lo_var_ptr = NULL;
+#define PARROT_CALLIN_END(x)   do {\
+                if (!oldtop) {\
+                    PARROT_ASSERT((x)->lo_var_ptr == &oldtop);\
+                    (x)->lo_var_ptr = NULL;\
+                }\
+            } while (0)
 
 #else
 

Modified: trunk/src/gc/system.c
==============================================================================
--- trunk/src/gc/system.c	Fri Aug 28 20:45:06 2009	(r40845)
+++ trunk/src/gc/system.c	Fri Aug 28 20:50:10 2009	(r40846)
@@ -238,6 +238,7 @@
        the "bottom" of the stack. We must trace the entire area between the
        top and bottom. */
     const size_t lo_var_ptr = (size_t)interp->lo_var_ptr;
+    PARROT_ASSERT(lo_var_ptr);
 
     trace_mem_block(interp, (size_t)lo_var_ptr,
             (size_t)&lo_var_ptr);


More information about the parrot-commits mailing list