[svn:parrot] r47368 - branches/gc_massacre/src/gc
bacek at svn.parrot.org
bacek at svn.parrot.org
Sat Jun 5 00:12:57 UTC 2010
Author: bacek
Date: Sat Jun 5 00:12:57 2010
New Revision: 47368
URL: https://trac.parrot.org/parrot/changeset/47368
Log:
Implement .is_string_ptr in old GC.
Modified:
branches/gc_massacre/src/gc/gc_ms.c
Modified: branches/gc_massacre/src/gc/gc_ms.c
==============================================================================
--- branches/gc_massacre/src/gc/gc_ms.c Sat Jun 5 00:12:45 2010 (r47367)
+++ branches/gc_massacre/src/gc/gc_ms.c Sat Jun 5 00:12:57 2010 (r47368)
@@ -154,6 +154,9 @@
static int gc_ms_is_pmc_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
__attribute__nonnull__(1);
+static int gc_ms_is_string_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+ __attribute__nonnull__(1);
+
static void gc_ms_mark_and_sweep(PARROT_INTERP, UINTVAL flags)
__attribute__nonnull__(1);
@@ -321,6 +324,8 @@
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms_is_pmc_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms_is_string_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms_mark_pobj_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -422,6 +427,7 @@
interp->gc_sys->free_bufferlike_header = gc_ms_free_bufferlike_header;
interp->gc_sys->is_pmc_ptr = gc_ms_is_pmc_ptr;
+ interp->gc_sys->is_string_ptr = gc_ms_is_string_ptr;
interp->gc_sys->mark_pmc_header = gc_ms_mark_pmc_header;
interp->gc_sys->mark_pobj_header = gc_ms_mark_pobj_header;
@@ -763,6 +769,21 @@
return contained_in_pool(interp->mem_pools->pmc_pool, ptr);
}
+static int
+gc_ms_is_string_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+{
+ ASSERT_ARGS(gc_ms_is_string_ptr)
+ UINTVAL i;
+
+ for (i = 0; i < interp->mem_pools->num_sized; ++i) {
+ if (interp->mem_pools->sized_header_pools[i]
+ && contained_in_pool(interp->mem_pools->sized_header_pools[i], ptr))
+ return 1;
+ }
+
+ return 0;
+}
+
/*
=item C<static STRING* gc_ms_allocate_string_header(PARROT_INTERP, UINTVAL
More information about the parrot-commits
mailing list