[svn:parrot] r43717 - trunk/src/gc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Thu Feb 4 21:26:54 UTC 2010


Author: chromatic
Date: Thu Feb  4 21:26:52 2010
New Revision: 43717
URL: https://trac.parrot.org/parrot/changeset/43717

Log:
[GC] Don't run a full mark and sweep when a constant pool is out of free
objects; they won't get freed.  This is a minor improvement on short-lived
benchmarks.

Modified:
   trunk/src/gc/gc_ms.c
   trunk/src/gc/gc_private.h
   trunk/src/gc/mark_sweep.c

Modified: trunk/src/gc/gc_ms.c
==============================================================================
--- trunk/src/gc/gc_ms.c	Thu Feb  4 17:06:54 2010	(r43716)
+++ trunk/src/gc/gc_ms.c	Thu Feb  4 21:26:52 2010	(r43717)
@@ -332,9 +332,9 @@
 {
     ASSERT_ARGS(gc_ms_more_traceable_objects)
 
-    if (pool->skip)
-        pool->skip = 0;
-    else {
+    if (pool->skip == GC_ONE_SKIP)
+        pool->skip = GC_NO_SKIP;
+    else if (pool->skip == GC_NO_SKIP) {
         Fixed_Size_Arena * const arena = pool->last_Arena;
         if (arena
         &&  arena->used == arena->total_objects)

Modified: trunk/src/gc/gc_private.h
==============================================================================
--- trunk/src/gc/gc_private.h	Thu Feb  4 17:06:54 2010	(r43716)
+++ trunk/src/gc/gc_private.h	Thu Feb  4 21:26:52 2010	(r43717)
@@ -87,6 +87,13 @@
     INF /*infinite memory core*/
 } gc_sys_type_enum;
 
+/* how often to skip a full GC when this pool has nothing free */
+typedef enum _gc_skip_type_enum {
+    GC_NO_SKIP = 0,
+    GC_ONE_SKIP,
+    GC_ALWAYS_SKIP
+} gc_skip_type_enum;
+
 typedef struct GC_Subsystem {
     /* Which GC subsystem are we using? See PARROT_GC_DEFAULT_TYPE in
      * include/parrot/settings.h for possible values */

Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c	Thu Feb  4 17:06:54 2010	(r43716)
+++ trunk/src/gc/mark_sweep.c	Thu Feb  4 21:26:52 2010	(r43717)
@@ -814,6 +814,7 @@
     /* Init the constant string header pool */
     mem_pools->constant_string_header_pool       = new_string_pool(interp, 1);
     mem_pools->constant_string_header_pool->name = "constant_string_header";
+    mem_pools->constant_string_header_pool->skip = GC_ALWAYS_SKIP;
 
     /* Init the buffer header pool
      *
@@ -832,6 +833,7 @@
     /* constant PMCs */
     mem_pools->constant_pmc_pool                    = new_pmc_pool(interp);
     mem_pools->constant_pmc_pool->name              = "constant_pmc";
+    mem_pools->constant_pmc_pool->skip              = GC_ALWAYS_SKIP;
     mem_pools->constant_pmc_pool->objects_per_alloc =
         CONSTANT_PMC_HEADERS_PER_ALLOC;
 }


More information about the parrot-commits mailing list