[svn:parrot] r47288 - branches/gc_massacre/src/gc

bacek at svn.parrot.org bacek at svn.parrot.org
Wed Jun 2 09:56:29 UTC 2010


Author: bacek
Date: Wed Jun  2 09:56:29 2010
New Revision: 47288
URL: https://trac.parrot.org/parrot/changeset/47288

Log:
Avoid double-initialisation on TMS in child interp.

Just reuse parrent one. Not particulary fast, but we can implement
proper merging of GCs later.

Modified:
   branches/gc_massacre/src/gc/gc_tms.c

Modified: branches/gc_massacre/src/gc/gc_tms.c
==============================================================================
--- branches/gc_massacre/src/gc/gc_tms.c	Wed Jun  2 09:56:14 2010	(r47287)
+++ branches/gc_massacre/src/gc/gc_tms.c	Wed Jun  2 09:56:29 2010	(r47288)
@@ -562,16 +562,22 @@
 
     interp->gc_sys->get_gc_info      = gc_tms_get_gc_info;
 
-    self = mem_allocate_zeroed_typed(TriColor_GC);
+    if (interp->parent_interpreter && interp->parent_interpreter->gc_sys) {
+        /* This is a "child" interpreter. Just reuse parent one */
+        self = (TriColor_GC*)interp->parent_interpreter->gc_sys->gc_private;
+    }
+    else {
+        self = mem_allocate_zeroed_typed(TriColor_GC);
 
-    self->pmc_allocator = Parrot_gc_create_pool_allocator(
+        self->pmc_allocator = Parrot_gc_create_pool_allocator(
             sizeof (List_Item_Header) + sizeof (PMC));
 
-    self->constant_pmc_allocator = Parrot_gc_create_pool_allocator(
+        self->constant_pmc_allocator = Parrot_gc_create_pool_allocator(
             sizeof (List_Item_Header) + sizeof (PMC));
 
-    self->objects = Parrot_gc_allocate_linked_list(interp);
+        self->objects = Parrot_gc_allocate_linked_list(interp);
 
+    }
     interp->gc_sys->gc_private = self;
 }
 


More information about the parrot-commits mailing list