[svn:parrot] r49168 - in branches/gc_massacre: include/parrot src/gc

bacek at svn.parrot.org bacek at svn.parrot.org
Mon Sep 20 10:56:41 UTC 2010


Author: bacek
Date: Mon Sep 20 10:56:41 2010
New Revision: 49168
URL: https://trac.parrot.org/parrot/changeset/49168

Log:
Intriduce GC_string_cb_FLAG to distinguish situation when String GC
request M&S.

Modified:
   branches/gc_massacre/include/parrot/gc_api.h
   branches/gc_massacre/src/gc/gc_ms2.c
   branches/gc_massacre/src/gc/string_gc.c

Modified: branches/gc_massacre/include/parrot/gc_api.h
==============================================================================
--- branches/gc_massacre/include/parrot/gc_api.h	Mon Sep 20 10:55:53 2010	(r49167)
+++ branches/gc_massacre/include/parrot/gc_api.h	Mon Sep 20 10:56:41 2010	(r49168)
@@ -97,6 +97,7 @@
 #define GC_trace_normal_FLAG   (UINTVAL)(1 << 1)   /* the same */
 #define GC_lazy_FLAG           (UINTVAL)(1 << 2)   /* timely destruction run */
 #define GC_finish_FLAG         (UINTVAL)(1 << 3)   /* on Parrot exit: mark (almost) all PMCs dead and */
+#define GC_strings_cb_FLAG     (UINTVAL)(1 << 4)   /* Invoked from String GC during mem_alloc to sweep dead strings */
                                                    /* garbage collect. */
 
 /* HEADERIZER BEGIN: src/gc/api.c */

Modified: branches/gc_massacre/src/gc/gc_ms2.c
==============================================================================
--- branches/gc_massacre/src/gc/gc_ms2.c	Mon Sep 20 10:55:53 2010	(r49167)
+++ branches/gc_massacre/src/gc/gc_ms2.c	Mon Sep 20 10:56:41 2010	(r49168)
@@ -989,8 +989,8 @@
         return;
     }
 
-    /* Ugly hack to skip call from String GC */
-    if (flags & GC_trace_stack_FLAG) {
+    /* Ignore calls from String GC. We know better when to trigger GC */
+    if (flags & GC_strings_cb_FLAG) {
         return;
     }
 

Modified: branches/gc_massacre/src/gc/string_gc.c
==============================================================================
--- branches/gc_massacre/src/gc/string_gc.c	Mon Sep 20 10:55:53 2010	(r49167)
+++ branches/gc_massacre/src/gc/string_gc.c	Mon Sep 20 10:56:41 2010	(r49168)
@@ -667,7 +667,7 @@
         if (!Parrot_is_blocked_GC_mark(interp)
             && new_mem > (stats->mem_used_last_collect >> 2)
             && new_mem > GC_SIZE_THRESHOLD) {
-            Parrot_gc_mark_and_sweep(interp, GC_trace_stack_FLAG);
+            Parrot_gc_mark_and_sweep(interp, GC_trace_stack_FLAG | GC_strings_cb_FLAG);
 
             if (interp->gc_sys->sys_type != INF) {
                 /* Compact the pool if allowed and worthwhile */


More information about the parrot-commits mailing list