[svn:parrot] r49656 - trunk/src/gc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Mon Oct 25 03:14:48 UTC 2010
Author: chromatic
Date: Mon Oct 25 03:14:48 2010
New Revision: 49656
URL: https://trac.parrot.org/parrot/changeset/49656
Log:
[GC] Removed GC indirection to free PObjs.
This gives a 0.9% performance improvement on oofib.pir; small but decent.
Modified:
trunk/src/gc/gc_ms2.c
Modified: trunk/src/gc/gc_ms2.c
==============================================================================
--- trunk/src/gc/gc_ms2.c Sun Oct 24 21:33:22 2010 (r49655)
+++ trunk/src/gc/gc_ms2.c Mon Oct 25 03:14:48 2010 (r49656)
@@ -234,19 +234,24 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-static void gc_ms2_sweep_pool(PARROT_INTERP,
+static void gc_ms2_sweep_pmc_pool(PARROT_INTERP,
ARGIN(Pool_Allocator *pool),
- ARGIN(Linked_List *list),
- ARGIN(sweep_cb callback))
+ ARGIN(Linked_List *list))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
- __attribute__nonnull__(3)
- __attribute__nonnull__(4);
+ __attribute__nonnull__(3);
static void gc_ms2_sweep_string_cb(PARROT_INTERP, ARGIN(PObj *obj))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
+static void gc_ms2_sweep_string_pool(PARROT_INTERP,
+ ARGIN(Pool_Allocator *pool),
+ ARGIN(Linked_List *list))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
static void gc_ms2_unblock_GC_mark(PARROT_INTERP)
__attribute__nonnull__(1);
@@ -351,14 +356,17 @@
#define ASSERT_ARGS_gc_ms2_sweep_pmc_cb __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(obj))
-#define ASSERT_ARGS_gc_ms2_sweep_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+#define ASSERT_ARGS_gc_ms2_sweep_pmc_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pool) \
- , PARROT_ASSERT_ARG(list) \
- , PARROT_ASSERT_ARG(callback))
+ , PARROT_ASSERT_ARG(list))
#define ASSERT_ARGS_gc_ms2_sweep_string_cb __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(obj))
+#define ASSERT_ARGS_gc_ms2_sweep_string_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pool) \
+ , PARROT_ASSERT_ARG(list))
#define ASSERT_ARGS_gc_ms2_unblock_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms2_unblock_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -1087,12 +1095,9 @@
/* objects contains "dead" or "constant" PMCs */
/* sweep of new_objects will repaint them white */
/* sweep of objects will destroy dead objects leaving only "constant" */
- gc_ms2_sweep_pool(interp, self->pmc_allocator, self->new_objects,
- gc_ms2_sweep_pmc_cb);
- gc_ms2_sweep_pool(interp, self->pmc_allocator, self->objects,
- gc_ms2_sweep_pmc_cb);
- gc_ms2_sweep_pool(interp, self->string_allocator, self->strings,
- gc_ms2_sweep_string_cb);
+ gc_ms2_sweep_pmc_pool(interp, self->pmc_allocator, self->new_objects);
+ gc_ms2_sweep_pmc_pool(interp, self->pmc_allocator, self->objects);
+ gc_ms2_sweep_string_pool(interp, self->string_allocator, self->strings);
/* Replace objects with new_objects. Ignoring "constant" one */
list = self->objects;
@@ -1122,10 +1127,9 @@
*/
static void
-gc_ms2_sweep_pool(PARROT_INTERP,
+gc_ms2_sweep_pmc_pool(PARROT_INTERP,
ARGIN(Pool_Allocator *pool),
- ARGIN(Linked_List *list),
- ARGIN(sweep_cb callback))
+ ARGIN(Linked_List *list))
{
ASSERT_ARGS(gc_ms2_sweep_pool)
List_Item_Header *tmp = list->first;
@@ -1141,7 +1145,38 @@
else if (!PObj_constant_TEST(obj)) {
LIST_REMOVE(list, tmp);
- callback(interp, obj);
+ Parrot_pmc_destroy(interp, (PMC *)obj);
+ PObj_on_free_list_SET(obj);
+
+ Parrot_gc_pool_free(interp, pool, tmp);
+ }
+
+ tmp = next;
+ }
+}
+
+static void
+gc_ms2_sweep_string_pool(PARROT_INTERP,
+ ARGIN(Pool_Allocator *pool),
+ ARGIN(Linked_List *list))
+{
+ ASSERT_ARGS(gc_ms2_sweep_pool)
+ List_Item_Header *tmp = list->first;
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+
+ while (tmp) {
+ List_Item_Header *next = tmp->next;
+ PObj *obj = LLH2Obj_typed(tmp, PObj);
+
+ /* Paint live objects white */
+ if (PObj_live_TEST(obj))
+ PObj_live_CLEAR(obj);
+
+ else if (!PObj_constant_TEST(obj)) {
+ Buffer *str = (Buffer *)obj;
+ LIST_REMOVE(list, tmp);
+ if (Buffer_bufstart(str) && !PObj_external_TEST(str))
+ Parrot_gc_str_free_buffer_storage(interp, &self->string_gc, str);
PObj_on_free_list_SET(obj);
More information about the parrot-commits
mailing list