# New Ticket Created by  Leopold Toetsch 
# Please include the string:  [perl #19349]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=19349 >


Here is another approach, to finally unify the marking routines:
- next_for_GC remains what it is
- instead of current_end_of_list and a return value, mark_used() uuses
   a file static mark_ptr. As we don't have recursive DOD runs, this
   ought to be safe.

leo


-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/46052/36042/805a5c/mark.patch

--- parrot/dod.c        Thu Dec 12 09:07:25 2002
+++ parrot-leo/dod.c    Sun Dec 22 14:42:42 2002
@@ -23,6 +23,38 @@
 extern void flush_register_windows(void);
 static size_t find_common_mask(size_t val1, size_t val2);
 
+#define MARK_USE_MARK_PTR
+
+#ifdef MARK_USE_MARK_PTR
+
+static PMC * mark_ptr;
+
+/* actually this could be:
+ *
+ * void pobject_lives(PObj* obj)
+ */
+
+PMC *
+mark_used(PMC *used_pmc, PMC *current_end_of_list)
+{
+    UINTVAL mask = PObj_is_PMC_ptr_FLAG | PObj_is_buffer_ptr_FLAG
+            | PObj_custom_mark_FLAG;
+
+    UNUSED(current_end_of_list);
+
+    if (PObj_is_live_or_free_TESTALL(used_pmc)) {
+        return NULL;    /* only for compatibility */
+    }
+    PObj_live_SET(used_pmc);
+    if ((PObj_get_FLAGS(used_pmc) & mask) || used_pmc->metadata) {
+        mark_ptr->next_for_GC = used_pmc;
+        mark_ptr = used_pmc->next_for_GC = used_pmc;
+    }
+    return NULL;        /* only for compatibility */
+}
+
+#else
+
 PMC *
 mark_used(PMC *used_pmc, PMC *current_end_of_list)
 {
@@ -49,6 +81,8 @@
     return used_pmc;
 }
 
+#endif
+
 #if DISABLE_GC_DEBUG
 void
 buffer_lives(struct Parrot_Interp *interpreter, Buffer *buffer)
@@ -120,6 +154,9 @@
     /* We have to start somewhere, and the global stash is a good place */
     last = current = interpreter->perl_stash->stash_hash;
 
+#ifdef MARK_USE_MARK_PTR
+    mark_ptr = last;
+#endif
     /* mark it as used and get an updated end of list */
     last = mark_used(current, last);
     /* Parrot_base_classname_hash */

Reply via email to