[svn:parrot] r47361 - branches/gc_massacre/src/gc

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Jun 5 00:11:35 UTC 2010


Author: bacek
Date: Sat Jun  5 00:11:35 2010
New Revision: 47361
URL: https://trac.parrot.org/parrot/changeset/47361

Log:
Add GC.is_string_ptr

Modified:
   branches/gc_massacre/src/gc/gc_ms2.c
   branches/gc_massacre/src/gc/gc_private.h

Modified: branches/gc_massacre/src/gc/gc_ms2.c
==============================================================================
--- branches/gc_massacre/src/gc/gc_ms2.c	Sat Jun  5 00:11:23 2010	(r47360)
+++ branches/gc_massacre/src/gc/gc_ms2.c	Sat Jun  5 00:11:35 2010	(r47361)
@@ -150,6 +150,9 @@
         __attribute__nonnull__(3)
         __attribute__nonnull__(4);
 
+static int gc_ms2_is_string_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+        __attribute__nonnull__(1);
+
 static void gc_ms2_mark_and_sweep(PARROT_INTERP, UINTVAL flags)
         __attribute__nonnull__(1);
 
@@ -239,6 +242,8 @@
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(pool) \
     , PARROT_ASSERT_ARG(list))
+#define ASSERT_ARGS_gc_ms2_is_string_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms2_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms2_mark_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -517,6 +522,7 @@
     interp->gc_sys->free_pmc_attributes     = gc_ms2_free_pmc_attributes;
 
     interp->gc_sys->is_pmc_ptr              = gc_ms2_is_pmc_ptr;
+    interp->gc_sys->is_string_ptr           = gc_ms2_is_string_ptr;
     interp->gc_sys->mark_pmc_header         = gc_ms2_mark_pmc_header;
     interp->gc_sys->mark_pobj_header        = gc_ms2_mark_pobj_header;
 
@@ -744,6 +750,14 @@
     return gc_ms2_is_ptr_owned(interp, ptr, self->pmc_allocator, self->objects);
 }
 
+static int
+gc_ms2_is_string_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+{
+    ASSERT_ARGS(gc_ms2_is_pmc_ptr)
+    MarkSweep_GC      *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+    return gc_ms2_is_ptr_owned(interp, ptr, self->string_allocator, self->strings);
+}
+
 /*
 =item C<static int gc_ms2_is_ptr_owned(PARROT_INTERP, void *ptr, Pool_Allocator
 *pool, Linked_List *list)>

Modified: branches/gc_massacre/src/gc/gc_private.h
==============================================================================
--- branches/gc_massacre/src/gc/gc_private.h	Sat Jun  5 00:11:23 2010	(r47360)
+++ branches/gc_massacre/src/gc/gc_private.h	Sat Jun  5 00:11:35 2010	(r47361)
@@ -125,6 +125,7 @@
     void    (*free_bufferlike_header)(PARROT_INTERP, Buffer*, size_t size);
 
     int  (*is_pmc_ptr)(PARROT_INTERP, void*);
+    int  (*is_string_ptr)(PARROT_INTERP, void*);
     void (*mark_pobj_header)(PARROT_INTERP, PObj*);
     void (*mark_pmc_header)(PARROT_INTERP, PMC *);
 


More information about the parrot-commits mailing list