[svn:parrot] r44220 - branches/sys_mem_reduce/src

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Feb 20 11:39:58 UTC 2010


Author: bacek
Date: Sat Feb 20 11:39:58 2010
New Revision: 44220
URL: https://trac.parrot.org/parrot/changeset/44220

Log:
Switch to GC allocation

Modified:
   branches/sys_mem_reduce/src/multidispatch.c

Modified: branches/sys_mem_reduce/src/multidispatch.c
==============================================================================
--- branches/sys_mem_reduce/src/multidispatch.c	Sat Feb 20 11:39:39 2010	(r44219)
+++ branches/sys_mem_reduce/src/multidispatch.c	Sat Feb 20 11:39:58 2010	(r44220)
@@ -1278,14 +1278,14 @@
     const INTVAL num_values = VTABLE_elements(interp, values);
     const INTVAL name_len   = name ? strlen(name) + 1: 0;
     const size_t id_size    = num_values * sizeof (INTVAL) + name_len;
-    INTVAL *type_ids        = (INTVAL *)mem_sys_allocate(id_size);
+    INTVAL *type_ids        = mem_gc_allocate_n_typed(interp, num_values + name_len, INTVAL);
     STRING *key;
     INTVAL  i;
 
     for (i = 0; i < num_values; i++) {
         const INTVAL id = VTABLE_type(interp, VTABLE_get_pmc_keyed_int(interp, values, i));
         if (id == 0) {
-            mem_sys_free(type_ids);
+            mem_gc_free(interp, type_ids);
             return NULL;
         }
 
@@ -1296,7 +1296,7 @@
         strcpy((char *)(type_ids + num_values), name);
 
     key = Parrot_str_new(interp, (char *)type_ids, id_size);
-    mem_sys_free(type_ids);
+    mem_gc_free(interp, type_ids);
 
     return key;
 }
@@ -1378,7 +1378,7 @@
     const INTVAL num_types  = VTABLE_elements(interp, types);
     const INTVAL name_len   = name ? strlen(name) + 1: 0;
     const size_t id_size    = num_types * sizeof (INTVAL) + name_len;
-    INTVAL * const type_ids = (INTVAL *)mem_sys_allocate(id_size);
+    INTVAL * const type_ids = mem_gc_allocate_n_typed(interp, num_types + name_len, INTVAL);
 
     STRING *key;
     INTVAL  i;
@@ -1387,7 +1387,7 @@
         const INTVAL id = VTABLE_get_integer_keyed_int(interp, types, i);
 
         if (id == 0) {
-            mem_sys_free(type_ids);
+            mem_gc_free(interp, type_ids);
             return NULL;
         }
 
@@ -1399,7 +1399,7 @@
 
     key = Parrot_str_new(interp, (char *)type_ids, id_size);
 
-    mem_sys_free(type_ids);
+    mem_gc_free(interp, type_ids);
     return key;
 }
 


More information about the parrot-commits mailing list