[svn:parrot] r38569 - in branches/gc_api: include/parrot src/gc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Fri May 8 00:59:22 UTC 2009


Author: whiteknight
Date: Fri May  8 00:59:22 2009
New Revision: 38569
URL: https://trac.parrot.org/parrot/changeset/38569

Log:
[gc_api] Parrot_gc_free_buffer_malloc is not an API function. moving it and making it static

Modified:
   branches/gc_api/include/parrot/gc_api.h
   branches/gc_api/src/gc/api.c
   branches/gc_api/src/gc/pools.c

Modified: branches/gc_api/include/parrot/gc_api.h
==============================================================================
--- branches/gc_api/include/parrot/gc_api.h	Fri May  8 00:57:52 2009	(r38568)
+++ branches/gc_api/include/parrot/gc_api.h	Fri May  8 00:59:22 2009	(r38569)
@@ -76,12 +76,6 @@
         FUNC_MODIFIES(*pool)
         FUNC_MODIFIES(*b);
 
-void Parrot_gc_free_buffer_malloc(SHIM_INTERP,
-    SHIM(Small_Object_Pool *pool),
-    ARGMOD(PObj *b))
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*b);
-
 void Parrot_gc_free_bufferlike_header(PARROT_INTERP,
     ARGMOD(PObj *obj),
     size_t size)
@@ -129,8 +123,6 @@
 #define ASSERT_ARGS_Parrot_gc_free_buffer __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(pool) \
     || PARROT_ASSERT_ARG(b)
-#define ASSERT_ARGS_Parrot_gc_free_buffer_malloc __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(b)
 #define ASSERT_ARGS_Parrot_gc_free_bufferlike_header \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp) \

Modified: branches/gc_api/src/gc/api.c
==============================================================================
--- branches/gc_api/src/gc/api.c	Fri May  8 00:57:52 2009	(r38568)
+++ branches/gc_api/src/gc/api.c	Fri May  8 00:59:22 2009	(r38569)
@@ -296,41 +296,6 @@
     p->pmc_ext = NULL;
 }
 
-/*
-
-=item C<void Parrot_gc_free_buffer_malloc(PARROT_INTERP, Small_Object_Pool
-*pool, PObj *b)>
-
-Frees the given buffer, returning the storage space to the operating system
-and removing it from Parrot's memory management system. If the buffer is COW,
-The buffer is not freed if the reference count is greater then 1.
-
-=cut
-
-*/
-
-void
-Parrot_gc_free_buffer_malloc(SHIM_INTERP, SHIM(Small_Object_Pool *pool),
-        ARGMOD(PObj *b))
-{
-    ASSERT_ARGS(Parrot_gc_free_buffer_malloc)
-    /* free allocated space at (int *)bufstart - 1, but not if it used COW or is
-     * external */
-    PObj_buflen(b) = 0;
-
-    if (!PObj_bufstart(b) || PObj_is_external_or_free_TESTALL(b))
-        return;
-
-    if (PObj_COW_TEST(b)) {
-        INTVAL * const refcount = PObj_bufrefcountptr(b);
-
-        if (--(*refcount) == 0) {
-            mem_sys_free(refcount); /* the actual bufstart */
-        }
-    }
-    else
-        mem_sys_free(PObj_bufrefcountptr(b));
-}
 
 /*
 

Modified: branches/gc_api/src/gc/pools.c
==============================================================================
--- branches/gc_api/src/gc/pools.c	Fri May  8 00:57:52 2009	(r38568)
+++ branches/gc_api/src/gc/pools.c	Fri May  8 00:59:22 2009	(r38569)
@@ -33,6 +33,12 @@
         __attribute__nonnull__(1)
         FUNC_MODIFIES(*pool);
 
+static void Parrot_gc_free_buffer_malloc(SHIM_INTERP,
+    SHIM(Small_Object_Pool *pool),
+    ARGMOD(PObj *b))
+        __attribute__nonnull__(3)
+        FUNC_MODIFIES(*b);
+
 static int sweep_cb_buf(PARROT_INTERP,
     ARGMOD(Small_Object_Pool *pool),
     SHIM(int flag),
@@ -55,6 +61,8 @@
     || PARROT_ASSERT_ARG(pool)
 #define ASSERT_ARGS_free_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(pool)
+#define ASSERT_ARGS_Parrot_gc_free_buffer_malloc __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+       PARROT_ASSERT_ARG(b)
 #define ASSERT_ARGS_sweep_cb_buf __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp) \
     || PARROT_ASSERT_ARG(pool) \
@@ -209,6 +217,43 @@
     return pool;
 }
 
+/*
+
+=item C<static void Parrot_gc_free_buffer_malloc(PARROT_INTERP,
+Small_Object_Pool *pool, PObj *b)>
+
+Frees the given buffer, returning the storage space to the operating system
+and removing it from Parrot's memory management system. If the buffer is COW,
+The buffer is not freed if the reference count is greater then 1.
+
+=cut
+
+*/
+
+static void
+Parrot_gc_free_buffer_malloc(SHIM_INTERP, SHIM(Small_Object_Pool *pool),
+        ARGMOD(PObj *b))
+{
+    ASSERT_ARGS(Parrot_gc_free_buffer_malloc)
+    /* free allocated space at (int *)bufstart - 1, but not if it used COW or is
+     * external */
+    PObj_buflen(b) = 0;
+
+    if (!PObj_bufstart(b) || PObj_is_external_or_free_TESTALL(b))
+        return;
+
+    if (PObj_COW_TEST(b)) {
+        INTVAL * const refcount = PObj_bufrefcountptr(b);
+
+        if (--(*refcount) == 0) {
+            mem_sys_free(refcount); /* the actual bufstart */
+        }
+    }
+    else
+        mem_sys_free(PObj_bufrefcountptr(b));
+}
+
+
 
 /*
 


More information about the parrot-commits mailing list