[svn:parrot] r47367 - in branches/gc_massacre/src: gc string

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Jun 5 00:12:45 UTC 2010


Author: bacek
Date: Sat Jun  5 00:12:45 2010
New Revision: 47367
URL: https://trac.parrot.org/parrot/changeset/47367

Log:
Hack Parrot_str_copy to clone string and implement freeing of string storage in MS2

Modified:
   branches/gc_massacre/src/gc/gc_ms2.c
   branches/gc_massacre/src/string/api.c

Modified: branches/gc_massacre/src/gc/gc_ms2.c
==============================================================================
--- branches/gc_massacre/src/gc/gc_ms2.c	Sat Jun  5 00:12:32 2010	(r47366)
+++ branches/gc_massacre/src/gc/gc_ms2.c	Sat Jun  5 00:12:45 2010	(r47367)
@@ -735,6 +735,10 @@
             return;
         Parrot_gc_list_remove(interp, self->strings, Obj2LLH(s));
         PObj_on_free_list_SET(s);
+
+        if (Buffer_bufstart(s) && !PObj_external_TEST(s))
+            mem_sys_free(Buffer_bufstart(s));
+
         Parrot_gc_pool_free(self->string_allocator, Obj2LLH(s));
     }
 }
@@ -774,6 +778,8 @@
 {
     STRING *str = (STRING *)obj;
     /* Compact string pool here. Or get rid of "shared buffers" and just free storage */
+    if (Buffer_bufstart(str) && !PObj_external_TEST(str))
+        mem_sys_free(Buffer_bufstart(str));
 }
 
 

Modified: branches/gc_massacre/src/string/api.c
==============================================================================
--- branches/gc_massacre/src/string/api.c	Sat Jun  5 00:12:32 2010	(r47366)
+++ branches/gc_massacre/src/string/api.c	Sat Jun  5 00:12:45 2010	(r47367)
@@ -386,6 +386,9 @@
     STRING *d;
     const int is_movable = PObj_is_movable_TESTALL(s);
 
+    /* XXX Don't use shared buffers */
+    return Parrot_str_clone(interp, s);
+
     /* We set COW flag to avoid cloning buffer in compact_pool */
 
     d = Parrot_gc_new_string_header(interp,


More information about the parrot-commits mailing list