[svn:parrot] r43923 - branches/boehm_gc_2/src/gc
bacek at svn.parrot.org
bacek at svn.parrot.org
Sat Feb 13 07:13:49 UTC 2010
Author: bacek
Date: Sat Feb 13 07:13:48 2010
New Revision: 43923
URL: https://trac.parrot.org/parrot/changeset/43923
Log:
Add commented-out finalizers. Apparently they are making parrot 3x times slower
Modified:
branches/boehm_gc_2/src/gc/gc_boehm.c
Modified: branches/boehm_gc_2/src/gc/gc_boehm.c
==============================================================================
--- branches/boehm_gc_2/src/gc/gc_boehm.c Sat Feb 13 07:13:23 2010 (r43922)
+++ branches/boehm_gc_2/src/gc/gc_boehm.c Sat Feb 13 07:13:48 2010 (r43923)
@@ -58,6 +58,10 @@
static void gc_boehm_compact_memory_pool(PARROT_INTERP)
__attribute__nonnull__(1);
+static void gc_boehm_finalize_cb(ARGIN(void *obj), ARGIN(void *user_data))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
static void gc_boehm_free_bufferlike_header(PARROT_INTERP,
Buffer *b,
size_t size)
@@ -116,6 +120,9 @@
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_boehm_compact_memory_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_boehm_finalize_cb __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(obj) \
+ , PARROT_ASSERT_ARG(user_data))
#define ASSERT_ARGS_gc_boehm_free_bufferlike_header \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
@@ -230,14 +237,22 @@
static PMC*
gc_boehm_allocate_pmc_header(PARROT_INTERP, UINTVAL flags)
{
- return (PMC*)GC_MALLOC(sizeof(PMC));
+ PMC *pmc = (PMC*)GC_MALLOC(sizeof(PMC));
+ //GC_REGISTER_FINALIZER_NO_ORDER(pmc, gc_boehm_finalize_cb, interp, NULL, NULL);
+ return pmc;
}
static void
gc_boehm_free_pmc_header(PARROT_INTERP, PMC *pmc)
{
- if (pmc)
- GC_FREE(pmc);
+ if (pmc) {
+ /* Unregister finalizer */
+ //GC_REGISTER_FINALIZER_NO_ORDER(pmc, NULL, interp, NULL, NULL);
+ /* If PMC was destroyed manually - do nothing */
+ if (!PObj_on_free_list_TEST(pmc))
+ Parrot_pmc_destroy(interp, pmc);
+ //GC_FREE(pmc);
+ }
}
@@ -370,6 +385,28 @@
return 0;
}
+/*
+
+=item C<static void gc_boehm_finalize_cb(void *obj, void *user_data)>
+
+this function is passed to the finalizer
+
+=cut
+
+*/
+static void
+gc_boehm_finalize_cb(ARGIN(void *obj), ARGIN(void *user_data))
+{
+ ASSERT_ARGS(gc_boehm_finalize_cb)
+ PMC *pmc = (PMC*)obj;
+ Parrot_Interp interp = (Parrot_Interp)user_data;
+
+ /* If PMC was destroyed manually - do nothing */
+ if (!PObj_on_free_list_TEST(pmc))
+ Parrot_pmc_destroy(interp, pmc);
+}
+
+
/*
More information about the parrot-commits
mailing list