]> granicus.if.org Git - gc/commitdiff
Make GC_generic_malloc_ignore_off_page() public
authorIvan Maidanski <ivmai@mail.ru>
Sat, 8 Dec 2012 08:39:07 +0000 (12:39 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sat, 8 Dec 2012 08:39:07 +0000 (12:39 +0400)
* include/gc_mark.h (GC_generic_malloc): Refine comment.
* include/gc_mark.h (GC_generic_malloc_ignore_off_page): Move
prototype from gc_priv.h and make it public; add GC_ATTR_MALLOC
attribute.
* include/private/gc_priv.h (GC_generic_malloc): Move comment to
gc_mark.h.
* include/private/gc_priv.h (GC_generic_malloc_ignore_off_page):
Remove GC-inner prototype.
* include/private/gc_priv.h (GC_generic_malloc_inner): Update comment.
* mallocx.c (GC_generic_malloc_ignore_off_page): Likewise.
* mallocx.c (GC_generic_malloc_ignore_off_page): Make public.

include/gc_mark.h
include/private/gc_priv.h
mallocx.c

index 508fb2cc3b0e9433f82b4b5d4e5ce5fbef82bc24..4c003c03826a97ec89cf271095efe20e972d8e1e 100644 (file)
@@ -183,14 +183,24 @@ GC_API unsigned GC_CALL GC_new_kind_inner(void ** /* free_list */,
 GC_API unsigned GC_CALL GC_new_proc(GC_mark_proc);
 GC_API unsigned GC_CALL GC_new_proc_inner(GC_mark_proc);
 
-/* Allocate an object of a given kind.  Note that in multithreaded      */
+/* Allocate an object of a given kind.  By default, there are only      */
+/* a few kinds: composite (pointer-free), atomic, uncollectable, etc.   */
+/* We claim it is possible for clever client code that understands the  */
+/* GC internals to add more, e.g. to communicate object layout          */
+/* information to the collector.  Note that in the multi-threaded       */
 /* contexts, this is usually unsafe for kinds that have the descriptor  */
 /* in the object itself, since there is otherwise a window in which     */
 /* the descriptor is not correct.  Even in the single-threaded case,    */
 /* we need to be sure that cleared objects on a free list don't         */
 /* cause a GC crash if they are accidentally traced.                    */
-GC_API GC_ATTR_MALLOC void * GC_CALL
-        GC_generic_malloc(size_t /* lb */, int /* k */);
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_generic_malloc(size_t /* lb */,
+                                                       int /* k */);
+
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_generic_malloc_ignore_off_page(
+                                        size_t /* lb */, int /* k */);
+                                /* As above, but pointers to past the   */
+                                /* first page of the resulting object   */
+                                /* are ignored.                         */
 
 typedef void (GC_CALLBACK * GC_describe_type_fn)(void * /* p */,
                                                  char * /* out_buf */);
index fb0d9644c15953d1e9022a7c35e19d02ab739d07..c3125170f7b7c8be0717a056b1684fe9673f0307 100644 (file)
@@ -1769,23 +1769,10 @@ GC_INNER void GC_collect_a_little_inner(int n);
                                 /* collection work, if appropriate.     */
                                 /* A unit is an amount appropriate for  */
                                 /* HBLKSIZE bytes of allocation.        */
-/* void * GC_generic_malloc(size_t lb, int k); */
-                                /* Allocate an object of the given      */
-                                /* kind.  By default, there are only    */
-                                /* a few kinds: composite(pointerfree), */
-                                /* atomic, uncollectable, etc.          */
-                                /* We claim it's possible for clever    */
-                                /* client code that understands GC      */
-                                /* internals to add more, e.g. to       */
-                                /* communicate object layout info       */
-                                /* to the collector.                    */
-                                /* The actual decl is in gc_mark.h.     */
-GC_INNER void * GC_generic_malloc_ignore_off_page(size_t b, int k);
-                                /* As above, but pointers past the      */
-                                /* first page of the resulting object   */
-                                /* are ignored.                         */
+
 GC_INNER void * GC_generic_malloc_inner(size_t lb, int k);
-                                /* Ditto, but I already hold lock, etc. */
+                                /* Allocate an object of the given      */
+                                /* kind but assuming lock already held. */
 GC_INNER void * GC_generic_malloc_inner_ignore_off_page(size_t lb, int k);
                                 /* Allocate an object, where            */
                                 /* the client guarantees that there     */
index bf7f9f06013c86c5d0748266839515efbcd4a20e..db265103e8b9e474cdfd8fa877526035e1ea36fe 100644 (file)
--- a/mallocx.c
+++ b/mallocx.c
@@ -165,11 +165,10 @@ void * realloc(void * p, size_t lb)
 # undef GC_debug_realloc_replacement
 # endif /* REDIRECT_REALLOC */
 
-
 /* Allocate memory such that only pointers to near the          */
 /* beginning of the object are considered.                      */
-/* We avoid holding allocation lock while we clear memory.      */
-GC_INNER void * GC_generic_malloc_ignore_off_page(size_t lb, int k)
+/* We avoid holding allocation lock while we clear the memory.  */
+GC_API void * GC_CALL GC_generic_malloc_ignore_off_page(size_t lb, int k)
 {
     void *result;
     size_t lg;