[svn:parrot] r43896 - branches/boehm_gc_2/src/gc

bacek at svn.parrot.org bacek at svn.parrot.org
Thu Feb 11 13:14:44 UTC 2010


Author: bacek
Date: Thu Feb 11 13:14:44 2010
New Revision: 43896
URL: https://trac.parrot.org/parrot/changeset/43896

Log:
First cut - use GC_* functions in gc_boehm.

Modified:
   branches/boehm_gc_2/src/gc/gc_boehm.c

Modified: branches/boehm_gc_2/src/gc/gc_boehm.c
==============================================================================
--- branches/boehm_gc_2/src/gc/gc_boehm.c	Thu Feb 11 13:14:04 2010	(r43895)
+++ branches/boehm_gc_2/src/gc/gc_boehm.c	Thu Feb 11 13:14:44 2010	(r43896)
@@ -19,6 +19,8 @@
 
 #ifdef PARROT_HAS_BOEHM_GC
 
+#include <gc.h>
+
 /* HEADERIZER HFILE: src/gc/gc_private.h */
 
 /* HEADERIZER BEGIN: static */
@@ -228,42 +230,42 @@
 static PMC*
 gc_boehm_allocate_pmc_header(PARROT_INTERP, UINTVAL flags)
 {
-    return (PMC*)calloc(sizeof(PMC), 1);
+    return (PMC*)GC_MALLOC(sizeof(PMC));
 }
 
 static void
 gc_boehm_free_pmc_header(PARROT_INTERP, PMC *pmc)
 {
     if (pmc)
-        free(pmc);
+        GC_FREE(pmc);
 }
 
 
 static STRING*
 gc_boehm_allocate_string_header(PARROT_INTERP, UINTVAL flags)
 {
-    return (STRING*)calloc(sizeof(STRING), 1);
+    return (STRING*)GC_MALLOC(sizeof(STRING));
 }
 
 static void
 gc_boehm_free_string_header(PARROT_INTERP, STRING *s)
 {
     if (s)
-        free(s);
+        GC_FREE(s);
 }
 
 
 static Buffer*
 gc_boehm_allocate_bufferlike_header(PARROT_INTERP, size_t size)
 {
-    return (Buffer*)calloc(sizeof(Buffer), 1);
+    return (Buffer*)GC_MALLOC(sizeof(Buffer));
 }
 
 static void
 gc_boehm_free_bufferlike_header(PARROT_INTERP, Buffer *b, size_t size)
 {
     if (b)
-        free(b);
+        GC_FREE(b);
 }
 
 
@@ -271,7 +273,7 @@
 gc_boehm_allocate_pmc_attributes(PARROT_INTERP, PMC *pmc)
 {
     const size_t attr_size = pmc->vtable->attr_size;
-    PMC_data(pmc) = calloc(attr_size, 1);
+    PMC_data(pmc) = GC_MALLOC(attr_size);
     return PMC_data(pmc);
 }
 
@@ -279,7 +281,7 @@
 gc_boehm_free_pmc_attributes(PARROT_INTERP, PMC *pmc)
 {
     if (PMC_data(pmc))
-        free(PMC_data(pmc));
+        GC_FREE(PMC_data(pmc));
 }
 
 
@@ -294,7 +296,7 @@
     if (size == 0)
         return;
 
-    mem      = (char *)mem_sys_allocate(size);
+    mem      = (char *)GC_MALLOC_ATOMIC(size);
 
     Buffer_bufstart(str) = str->strstart = mem;
     Buffer_buflen(str)   = size;
@@ -305,7 +307,7 @@
 {
     char *mem;
 
-    mem      = (char *)mem_sys_realloc(Buffer_bufstart(str), size);
+    mem      = (char *)GC_REALLOC(Buffer_bufstart(str), size);
 
     Buffer_bufstart(str) = str->strstart = mem;
     Buffer_buflen(str)   = size;
@@ -322,7 +324,7 @@
     if (size == 0)
         return;
 
-    mem      = (char *)mem_sys_allocate(size);
+    mem      = (char *)GC_MALLOC_ATOMIC(size);
 
     Buffer_bufstart(buffer) = mem;
     Buffer_buflen(buffer)   = size;
@@ -333,7 +335,7 @@
 {
     char *mem;
 
-    mem = (char *)mem_sys_realloc(Buffer_bufstart(buffer), size);
+    mem = (char *)GC_REALLOC(Buffer_bufstart(buffer), size);
 
     Buffer_bufstart(buffer) = mem;
     Buffer_buflen(buffer)   = size;
@@ -343,14 +345,14 @@
 static void*
 gc_boehm_allocate_fixed_size_storage(PARROT_INTERP, size_t size)
 {
-    return calloc(size, 1);
+    return GC_MALLOC(size);
 }
 
 static void
 gc_boehm_free_fixed_size_storage(PARROT_INTERP, size_t size, void *data)
 {
     if (data)
-        free(data);
+        GC_FREE(data);
 }
 
 /*


More information about the parrot-commits mailing list