[svn:parrot] r45007 - branches/pcc_megrecells/src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Thu Mar 18 10:48:41 UTC 2010


Author: bacek
Date: Thu Mar 18 10:48:41 2010
New Revision: 45007
URL: https://trac.parrot.org/parrot/changeset/45007

Log:
Switch to sys_mem allocations for large amount of params

Modified:
   branches/pcc_megrecells/src/pmc/callcontext.pmc

Modified: branches/pcc_megrecells/src/pmc/callcontext.pmc
==============================================================================
--- branches/pcc_megrecells/src/pmc/callcontext.pmc	Thu Mar 18 10:09:35 2010	(r45006)
+++ branches/pcc_megrecells/src/pmc/callcontext.pmc	Thu Mar 18 10:48:41 2010	(r45007)
@@ -67,15 +67,22 @@
         size = 8;
 
     GETATTR_CallContext_positionals(interp, self, array);
-    new_array = (struct Pcc_cell*)Parrot_gc_allocate_fixed_size_storage(interp,
-            size * sizeof (Pcc_cell));
+    if (size > 8)
+        new_array = (struct Pcc_cell*)Parrot_gc_allocate_memory_chunk(interp,
+                size * sizeof (Pcc_cell));
+    else
+        new_array = (struct Pcc_cell*)Parrot_gc_allocate_fixed_size_storage(interp,
+                size * sizeof (Pcc_cell));
 
     if (array) {
         memset(new_array, size * sizeof (Pcc_cell), 0);
         GETATTR_CallContext_num_positionals(interp, self, num_positionals);
         memcpy(new_array, array, num_positionals * sizeof (Pcc_cell));
-        Parrot_gc_free_fixed_size_storage(interp, allocated_positionals * sizeof (Pcc_cell),
-                array);
+        if (num_positionals > 8)
+            Parrot_gc_free_memory_chunk(interp, array);
+        else
+            Parrot_gc_free_fixed_size_storage(interp, allocated_positionals * sizeof (Pcc_cell),
+                    array);
     }
 
     SETATTR_CallContext_allocated_positionals(interp, self, size);
@@ -505,8 +512,11 @@
             Pcc_cell *c;
 
             GET_ATTR_positionals(INTERP, SELF, c);
-            Parrot_gc_free_fixed_size_storage(INTERP, allocated_positionals * sizeof (Pcc_cell),
-                    c);
+            if (allocated_positionals > 8)
+                Parrot_gc_free_memory_chunk(INTERP, c);
+            else
+                Parrot_gc_free_fixed_size_storage(INTERP, allocated_positionals * sizeof (Pcc_cell),
+                        c);
         }
 
         if (hash) {


More information about the parrot-commits mailing list