[svn:parrot] r38841 - trunk/src/gc
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Sat May 16 20:48:58 UTC 2009
Author: whiteknight
Date: Sat May 16 20:48:58 2009
New Revision: 38841
URL: https://trac.parrot.org/parrot/changeset/38841
Log:
[gc] rearrange a few more things
Modified:
trunk/src/gc/gc_ms.c
trunk/src/gc/gc_private.h
trunk/src/gc/mark_sweep.c
trunk/src/gc/pools.c
Modified: trunk/src/gc/gc_ms.c
==============================================================================
--- trunk/src/gc/gc_ms.c Sat May 16 20:42:54 2009 (r38840)
+++ trunk/src/gc/gc_ms.c Sat May 16 20:48:58 2009 (r38841)
@@ -311,8 +311,8 @@
/*
-=item C<static void more_traceable_objects(PARROT_INTERP, Small_Object_Pool
-*pool)>
+=item C<static void gc_ms_more_traceable_objects(PARROT_INTERP,
+Small_Object_Pool *pool)>
We're out of traceable objects. First we try a GC run to free some up. If
that doesn't work, allocate a new arena.
Modified: trunk/src/gc/gc_private.h
==============================================================================
--- trunk/src/gc/gc_private.h Sat May 16 20:42:54 2009 (r38840)
+++ trunk/src/gc/gc_private.h Sat May 16 20:48:58 2009 (r38841)
@@ -346,13 +346,6 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-void Parrot_gc_free_pmc(PARROT_INTERP,
- SHIM(Small_Object_Pool *pool),
- ARGMOD(PObj *p))
- __attribute__nonnull__(1)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*p);
-
void Parrot_gc_run_init(PARROT_INTERP)
__attribute__nonnull__(1);
@@ -391,9 +384,6 @@
#define ASSERT_ARGS_Parrot_gc_clear_live_bits __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(pool)
-#define ASSERT_ARGS_Parrot_gc_free_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp) \
- || PARROT_ASSERT_ARG(p)
#define ASSERT_ARGS_Parrot_gc_run_init __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = \
Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c Sat May 16 20:42:54 2009 (r38840)
+++ trunk/src/gc/mark_sweep.c Sat May 16 20:48:58 2009 (r38841)
@@ -188,45 +188,6 @@
return 1;
}
-/*
-
-=item C<void Parrot_ms_free_pmc(PARROT_INTERP, Small_Object_Pool *pool, PObj
-*p)>
-
-Frees a PMC that is no longer being used. Calls a custom C<destroy> VTABLE
-method if one is available. If the PMC uses a PMC_EXT structure, that is freed
-as well.
-
-=cut
-
-*/
-
-void
-Parrot_gc_free_pmc(PARROT_INTERP, SHIM(Small_Object_Pool *pool),
- ARGMOD(PObj *p))
-{
- ASSERT_ARGS(Parrot_gc_free_pmc)
- PMC * const pmc = (PMC *)p;
- Arenas * const arena_base = interp->arena_base;
-
- /* TODO collect objects with finalizers */
- if (PObj_needs_early_gc_TEST(p))
- --arena_base->num_early_gc_PMCs;
-
- if (PObj_active_destroy_TEST(p))
- VTABLE_destroy(interp, pmc);
-
- if (PObj_is_PMC_EXT_TEST(p))
- Parrot_gc_free_pmc_ext(interp, pmc);
-
-#ifndef NDEBUG
-
- pmc->pmc_ext = (PMC_EXT *)0xdeadbeef;
- pmc->vtable = (VTABLE *)0xdeadbeef;
-
-#endif
-
-}
/*
Modified: trunk/src/gc/pools.c
==============================================================================
--- trunk/src/gc/pools.c Sat May 16 20:42:54 2009 (r38840)
+++ trunk/src/gc/pools.c Sat May 16 20:48:58 2009 (r38841)
@@ -22,6 +22,13 @@
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+static void gc_pool_free_pmc(PARROT_INTERP,
+ SHIM(Small_Object_Pool *pool),
+ ARGMOD(PObj *p))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*p);
+
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
static Small_Object_Pool * new_small_object_pool(
@@ -42,6 +49,9 @@
__attribute__nonnull__(3)
FUNC_MODIFIES(*b);
+#define ASSERT_ARGS_gc_pool_free_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp) \
+ || PARROT_ASSERT_ARG(p)
#define ASSERT_ARGS_new_small_object_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
#define ASSERT_ARGS_Parrot_gc_free_buffer __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(pool) \
@@ -228,12 +238,53 @@
new_small_object_pool(sizeof (PMC), num_headers);
pmc_pool->mem_pool = NULL;
- pmc_pool->gc_object = Parrot_gc_free_pmc;
+ pmc_pool->gc_object = gc_pool_free_pmc;
(interp->arena_base->init_pool)(interp, pmc_pool);
return pmc_pool;
}
+/*
+
+=item C<static void gc_pool_free_pmc(PARROT_INTERP, Small_Object_Pool *pool,
+PObj *p)>
+
+Frees a PMC that is no longer being used. Calls a custom C<destroy> VTABLE
+method if one is available. If the PMC uses a PMC_EXT structure, that is freed
+as well.
+
+=cut
+
+*/
+
+static void
+gc_pool_free_pmc(PARROT_INTERP, SHIM(Small_Object_Pool *pool),
+ ARGMOD(PObj *p))
+{
+ ASSERT_ARGS(gc_pool_free_pmc)
+ PMC * const pmc = (PMC *)p;
+ Arenas * const arena_base = interp->arena_base;
+
+ /* TODO collect objects with finalizers */
+ if (PObj_needs_early_gc_TEST(p))
+ --arena_base->num_early_gc_PMCs;
+
+ if (PObj_active_destroy_TEST(p))
+ VTABLE_destroy(interp, pmc);
+
+ if (PObj_is_PMC_EXT_TEST(p))
+ Parrot_gc_free_pmc_ext(interp, pmc);
+
+#ifndef NDEBUG
+
+ pmc->pmc_ext = (PMC_EXT *)0xdeadbeef;
+ pmc->vtable = (VTABLE *)0xdeadbeef;
+
+#endif
+
+}
+
+
/*
More information about the parrot-commits
mailing list