develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35568 - in trunk: include/parrot src/pmc

From:
Whiteknight
Date:
January 14, 2009 16:18
Subject:
[svn:parrot] r35568 - in trunk: include/parrot src/pmc
Message ID:
20090115001830.05C66CB9AE@x12.develooper.com
Author: Whiteknight
Date: Wed Jan 14 16:18:28 2009
New Revision: 35568

Modified:
   trunk/include/parrot/oo.h
   trunk/src/pmc/callsignature.pmc
   trunk/src/pmc/capture.pmc
   trunk/src/pmc/fixedpmcarray.pmc

Log:
[Core] remove dependence on PObj_data_is_PMC_array_FLAG, which was only used in three PMCs. Replaced with custom mark VTABLE routines.

Modified: trunk/include/parrot/oo.h
==============================================================================
--- trunk/include/parrot/oo.h	(original)
+++ trunk/include/parrot/oo.h	Wed Jan 14 16:18:28 2009
@@ -39,7 +39,6 @@
         ((PMC **)(x))[(y)] = (z); \
     } while (0)
 #define set_attrib_flags(x) do { \
-        PObj_data_is_PMC_array_SET(x); \
         PObj_active_destroy_SET(x); \
     } while (0)
 #define set_attrib_array_size(o, y) do { \

Modified: trunk/src/pmc/callsignature.pmc
==============================================================================
--- trunk/src/pmc/callsignature.pmc	(original)
+++ trunk/src/pmc/callsignature.pmc	Wed Jan 14 16:18:28 2009
@@ -57,7 +57,6 @@
         sig_struct->hash       = NULL;
         PMC_int_val(SELF)      = CAPTURE_DATA_SIZE;
         PObj_active_destroy_SET(SELF);
-        PObj_data_is_PMC_array_SET(SELF);
         PObj_custom_mark_SET(SELF);
     }
 
@@ -187,6 +186,9 @@
 
 */
     VTABLE void mark() {
+        PMC ** const data = PMC_data_typed(SELF, PMC **);
+        INTVAL i;
+
         if (PARROT_CALLSIGNATURE(SELF)) {
             Parrot_CallSignature_attributes * const attrs = PARROT_CALLSIGNATURE(SELF);
 
@@ -201,6 +203,13 @@
             if (attrs->short_sig)
                 pobject_lives(interp, (PObj*)attrs->short_sig);
         }
+
+        if (!data)
+            return;
+
+        for (i = PMC_int_val(SELF) - 1; i >= 0; --i)
+            if (data[i])
+                pobject_lives(interp, (PObj *)data[i]);
     }
 
 

Modified: trunk/src/pmc/capture.pmc
==============================================================================
--- trunk/src/pmc/capture.pmc	(original)
+++ trunk/src/pmc/capture.pmc	Wed Jan 14 16:18:28 2009
@@ -54,7 +54,7 @@
         capture->hash           = NULL;
         PMC_int_val(SELF)       = CAPTURE_DATA_SIZE;
         PObj_active_destroy_SET(SELF);
-        PObj_data_is_PMC_array_SET(SELF);
+        PObj_custom_mark_SET(SELF);
     }
 
     VTABLE void destroy() {
@@ -509,6 +509,28 @@
 
 /*
 
+=item C<void mark(void)>
+
+Mark the array.
+
+=cut
+
+*/
+
+    VTABLE void mark() {
+        PMC ** const data = PMC_data_typed(SELF, PMC **);
+        INTVAL i;
+
+        if (!data)
+            return;
+
+        for (i = PMC_int_val(SELF) - 1; i >= 0; --i)
+            if (data[i])
+                pobject_lives(interp, (PObj *)data[i]);
+    }
+
+/*
+
 =back
 
 =head2 Methods

Modified: trunk/src/pmc/fixedpmcarray.pmc
==============================================================================
--- trunk/src/pmc/fixedpmcarray.pmc	(original)
+++ trunk/src/pmc/fixedpmcarray.pmc	Wed Jan 14 16:18:28 2009
@@ -65,7 +65,7 @@
         PMC_int_val(SELF) = 0;
         PMC_data(SELF)    = NULL;
         PObj_active_destroy_SET(SELF);
-        PObj_data_is_PMC_array_SET(SELF);
+        PObj_custom_mark_SET(SELF);
     }
 
 /*
@@ -104,7 +104,7 @@
             PMC_int_val(dest) = size;
             PMC_data(dest)    = mem_allocate_n_typed(size, PMC *);
             mem_copy_n_typed(PMC_data(dest), PMC_data(SELF), size, PMC *);
-            PObj_data_is_PMC_array_SET(dest);
+            PObj_custom_mark_SET(dest);
         }
 
         return dest;
@@ -412,7 +412,7 @@
         }
 
         PMC_int_val2(SELF) = size;
-        PObj_data_is_PMC_array_SET(SELF);
+        PObj_custom_mark_SET(SELF);
     }
 /*
 
@@ -789,8 +789,32 @@
         return VTABLE_defined(INTERP, val);
     }
 
+/*
+
+=item C<void mark(void)>
+
+Mark the array.
+
+=cut
+
+*/
+
+    VTABLE void mark() {
+        PMC ** const data = PMC_data_typed(SELF, PMC **);
+        INTVAL i;
+
+        if (!data)
+            return;
+
+        for (i = PMC_int_val(SELF) - 1; i >= 0; --i)
+            if (data[i])
+                pobject_lives(interp, (PObj *)data[i]);
+    }
+
+
 }
 
+
 /*
 
 =back



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About