[svn:parrot] r44892 - in trunk/src: gc interp nci

coke at svn.parrot.org coke at svn.parrot.org
Fri Mar 12 02:24:38 UTC 2010


Author: coke
Date: Fri Mar 12 02:24:37 2010
New Revision: 44892
URL: https://trac.parrot.org/parrot/changeset/44892

Log:
Cleanup some -Wunused.

Modified:
   trunk/src/gc/api.c
   trunk/src/gc/gc_inf.c
   trunk/src/gc/gc_ms.c
   trunk/src/interp/inter_cb.c
   trunk/src/interp/inter_create.c
   trunk/src/nci/api.c

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	Fri Mar 12 02:16:04 2010	(r44891)
+++ trunk/src/gc/api.c	Fri Mar 12 02:24:37 2010	(r44892)
@@ -11,7 +11,7 @@
 This file implements the external-facing API for Parrot's garbage collector.
 The collector itself is composed of various interchangable cores that each
 may operate very differently internally. The functions in this file can be used
-throughtout Parrot without having to be concerned about the internal operations
+throughout Parrot without having to be concerned about the internal operations
 of the GC. This is documented in PDD 9 with supplementary notes in
 F<docs/memory_internals.pod>.
 
@@ -99,29 +99,6 @@
 /* HEADERIZER BEGIN: static */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
-static void fix_pmc_syncs(
-    ARGMOD(Interp *dest_interp),
-    ARGIN(Fixed_Size_Pool *pool))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*dest_interp);
-
-static void Parrot_gc_merge_buffer_pools(PARROT_INTERP,
-    ARGMOD(Fixed_Size_Pool *dest),
-    ARGMOD(Fixed_Size_Pool *source))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*dest)
-        FUNC_MODIFIES(*source);
-
-#define ASSERT_ARGS_fix_pmc_syncs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(dest_interp) \
-    , PARROT_ASSERT_ARG(pool))
-#define ASSERT_ARGS_Parrot_gc_merge_buffer_pools __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(dest) \
-    , PARROT_ASSERT_ARG(source))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
 

Modified: trunk/src/gc/gc_inf.c
==============================================================================
--- trunk/src/gc/gc_inf.c	Fri Mar 12 02:16:04 2010	(r44891)
+++ trunk/src/gc/gc_inf.c	Fri Mar 12 02:24:37 2010	(r44892)
@@ -37,22 +37,6 @@
 /* HEADERIZER BEGIN: static */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
-static void gc_inf_add_free_object(SHIM_INTERP,
-    ARGIN(Memory_Pools *mem_pools),
-    ARGMOD(Fixed_Size_Pool *pool),
-    ARGIN(void *to_add))
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        __attribute__nonnull__(4)
-        FUNC_MODIFIES(*pool);
-
-static void gc_inf_alloc_objects(SHIM_INTERP,
-    ARGIN(Memory_Pools *mem_pools),
-    ARGMOD(Fixed_Size_Pool *pool))
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*pool);
-
 static void gc_inf_allocate_buffer_storage(PARROT_INTERP,
     ARGMOD(Buffer *buffer),
     size_t size)
@@ -116,28 +100,10 @@
     ARGIN_NULLOK(STRING *s))
         __attribute__nonnull__(1);
 
-PARROT_CANNOT_RETURN_NULL
-static void * gc_inf_get_free_object(SHIM_INTERP,
-    ARGIN(Memory_Pools *mem_pools),
-    ARGMOD(Fixed_Size_Pool *pool))
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*pool);
-
 static size_t gc_inf_get_gc_info(PARROT_INTERP, Interpinfo_enum what)
         __attribute__nonnull__(1);
 
 static void gc_inf_mark_and_sweep(SHIM_INTERP, UINTVAL flags);
-static void gc_inf_more_traceable_objects(SHIM_INTERP,
-    ARGIN(Memory_Pools *mem_pools),
-    ARGMOD(Fixed_Size_Pool *pool))
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*pool);
-
-static void gc_inf_pool_init(SHIM_INTERP, ARGMOD(Fixed_Size_Pool *pool))
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*pool);
 
 static void gc_inf_reallocate_buffer_storage(PARROT_INTERP,
     ARGMOD(Buffer *buffer),
@@ -153,13 +119,6 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*str);
 
-#define ASSERT_ARGS_gc_inf_add_free_object __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(mem_pools) \
-    , PARROT_ASSERT_ARG(pool) \
-    , PARROT_ASSERT_ARG(to_add))
-#define ASSERT_ARGS_gc_inf_alloc_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(mem_pools) \
-    , PARROT_ASSERT_ARG(pool))
 #define ASSERT_ARGS_gc_inf_allocate_buffer_storage \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
@@ -197,17 +156,9 @@
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_inf_free_string_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_gc_inf_get_free_object __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(mem_pools) \
-    , PARROT_ASSERT_ARG(pool))
 #define ASSERT_ARGS_gc_inf_get_gc_info __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_inf_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_gc_inf_more_traceable_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(mem_pools) \
-    , PARROT_ASSERT_ARG(pool))
-#define ASSERT_ARGS_gc_inf_pool_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(pool))
 #define ASSERT_ARGS_gc_inf_reallocate_buffer_storage \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
@@ -251,144 +202,6 @@
 
 /*
 
-=item C<static void gc_inf_add_free_object(PARROT_INTERP, Memory_Pools
-*mem_pools, Fixed_Size_Pool *pool, void *to_add)>
-
-Manually frees a chunk of memory. Normally this would return the memory
-to the free list of the pool, but in this case we just return it to the
-OS.
-
-This function is called from places like C<Parrot_gc_free_pmc_header> and
-related manual freeing functions. Some cores will also use it internally to
-add items to the freelist from a freshly allocated arena.
-
-=cut
-
-*/
-
-static void
-gc_inf_add_free_object(SHIM_INTERP,
-        ARGIN(Memory_Pools *mem_pools),
-        ARGMOD(Fixed_Size_Pool *pool),
-        ARGIN(void *to_add))
-{
-    ASSERT_ARGS(gc_inf_add_free_object)
-    if (to_add)
-        free(to_add);
-}
-
-/*
-
-=item C<static void * gc_inf_get_free_object(PARROT_INTERP, Memory_Pools
-*mem_pools, Fixed_Size_Pool *pool)>
-
-Gets a new object from the pool. Each pool specifies an object size in
-C<pool->object_size> so we can use that number to make the allocation. For
-GCs that manage their own memory through the use of arenas or similar
-structures, we can use this basic algorithm here:
-
- 1) Check if we have any items on the free list and allocate one from there
-    if so.
- 2) Do a GC run to try and free up new items, and allocate a newly freed
-    item if one becomes available
- 3) Allocate a new arena from the OS and allocate a new item from there.
-
-This function is called from GC API functions like
-C<Parrot_Gc_get_new_pmc_header>
-
-=cut
-
-*/
-
-PARROT_CANNOT_RETURN_NULL
-static void *
-gc_inf_get_free_object(SHIM_INTERP,
-        ARGIN(Memory_Pools *mem_pools),
-        ARGMOD(Fixed_Size_Pool *pool))
-{
-    ASSERT_ARGS(gc_inf_get_free_object)
-    return calloc(pool->object_size, 1);
-}
-
-/*
-
-=item C<static void gc_inf_alloc_objects(PARROT_INTERP, Memory_Pools *mem_pools,
-Fixed_Size_Pool *pool)>
-
-Allocates a new arena of objects from the system. This function is only
-really used internally by the core, the API functions don't need to call
-it directly. However, this function is necessary because we may have
-different behaviors for certain pools, so we can't allocate for all of them
-in the same way. We will need to have a new "alloc_objects" function
-for each special case pool.
-
-=cut
-
-*/
-
-static void
-gc_inf_alloc_objects(SHIM_INTERP,
-        ARGIN(Memory_Pools *mem_pools),
-        ARGMOD(Fixed_Size_Pool *pool))
-{
-    ASSERT_ARGS(gc_inf_alloc_objects)
-    UNUSED(pool);
-}
-
-/*
-
-=item C<static void gc_inf_more_traceable_objects(PARROT_INTERP, Memory_Pools
-*mem_pools, Fixed_Size_Pool *pool)>
-
-Would normally try to find new traceable objects by first running a GC sweep
-and then allocating a new arena from the system. Neither of these are
-necessary in the infinite memory collector.
-
-This function is only used internally to the core, and is not called directly
-from the GC API. Different pools may have special requirements so multiple
-"more_traceable_objects" functions may need to be written and used.
-
-=cut
-
-*/
-
-static void
-gc_inf_more_traceable_objects(SHIM_INTERP,
-        ARGIN(Memory_Pools *mem_pools),
-        ARGMOD(Fixed_Size_Pool *pool))
-{
-    ASSERT_ARGS(gc_inf_more_traceable_objects)
-    UNUSED(pool);
-}
-
-/*
-
-=item C<static void gc_inf_pool_init(PARROT_INTERP, Fixed_Size_Pool *pool)>
-
-Initializes the function pointers in a new pool. When a new pool is created
-we assign several function pointers to it for managing memory in the pool.
-In this way we can treat different pools differently if they have special
-management needs. In general all PObj-like pools are treated the same.
-
-This function is mostly called from the function C<initialize_fixed_size_pools>
-in F<src/gc/mark_sweep.c> at Parrot startup.
-
-=cut
-
-*/
-
-static void
-gc_inf_pool_init(SHIM_INTERP, ARGMOD(Fixed_Size_Pool *pool))
-{
-    ASSERT_ARGS(gc_inf_pool_init)
-    pool->add_free_object = gc_inf_add_free_object;
-    pool->get_free_object = gc_inf_get_free_object;
-    pool->alloc_objects   = gc_inf_alloc_objects;
-    pool->more_objects    = gc_inf_more_traceable_objects;
-}
-
-/*
-
 =item C<static void gc_inf_compact_memory_pool(PARROT_INTERP)>
 
 Stub for compacting memory pools.
@@ -447,7 +260,7 @@
 
 PARROT_CAN_RETURN_NULL
 static PMC*
-gc_inf_allocate_pmc_header(PARROT_INTERP, UINTVAL flags)
+gc_inf_allocate_pmc_header(PARROT_INTERP, SHIM(UINTVAL flags))
 {
     ASSERT_ARGS(gc_inf_allocate_pmc_header)
     return (PMC*)calloc(sizeof (PMC), 1);
@@ -463,7 +276,7 @@
 
 PARROT_CAN_RETURN_NULL
 static STRING*
-gc_inf_allocate_string_header(PARROT_INTERP, UINTVAL flags)
+gc_inf_allocate_string_header(PARROT_INTERP, SHIM(UINTVAL flags))
 {
     ASSERT_ARGS(gc_inf_allocate_string_header)
     return (STRING*)calloc(sizeof (STRING), 1);
@@ -479,14 +292,14 @@
 
 PARROT_CAN_RETURN_NULL
 static Buffer*
-gc_inf_allocate_bufferlike_header(PARROT_INTERP, size_t size)
+gc_inf_allocate_bufferlike_header(PARROT_INTERP, SHIM(size_t size))
 {
     ASSERT_ARGS(gc_inf_allocate_bufferlike_header)
     return (Buffer*)calloc(sizeof (Buffer), 1);
 }
 
 static void
-gc_inf_free_bufferlike_header(PARROT_INTERP, ARGIN_NULLOK(Buffer *b), size_t size)
+gc_inf_free_bufferlike_header(PARROT_INTERP, ARGIN_NULLOK(Buffer *b), SHIM(size_t size))
 {
     ASSERT_ARGS(gc_inf_free_bufferlike_header)
     if (b)
@@ -582,7 +395,7 @@
 }
 
 static void
-gc_inf_free_fixed_size_storage(PARROT_INTERP, size_t size, ARGMOD(void *data))
+gc_inf_free_fixed_size_storage(PARROT_INTERP, SHIM(size_t size), ARGMOD(void *data))
 {
     ASSERT_ARGS(gc_inf_free_fixed_size_storage)
     if (data)
@@ -599,7 +412,7 @@
 
 */
 static size_t
-gc_inf_get_gc_info(PARROT_INTERP, Interpinfo_enum what)
+gc_inf_get_gc_info(PARROT_INTERP, SHIM(Interpinfo_enum what))
 {
     ASSERT_ARGS(gc_inf_get_gc_info)
     return 0;

Modified: trunk/src/gc/gc_ms.c
==============================================================================
--- trunk/src/gc/gc_ms.c	Fri Mar 12 02:16:04 2010	(r44891)
+++ trunk/src/gc/gc_ms.c	Fri Mar 12 02:24:37 2010	(r44892)
@@ -1093,7 +1093,6 @@
 {
     ASSERT_ARGS(gc_ms_free_fixed_size_storage)
 
-    const size_t item_size = size < sizeof (void *) ? sizeof (void *) : size;
     const size_t idx   = size - sizeof (void *);
     PMC_Attribute_Pool ** const pools = interp->mem_pools->attrib_pools;
     gc_ms_free_attributes_from_pool(interp, pools[idx], data);
@@ -1231,7 +1230,7 @@
 gc_ms_sweep_cb(PARROT_INTERP,
         ARGIN(Memory_Pools *mem_pools),
         ARGMOD(Fixed_Size_Pool *pool),
-        int flag, ARGMOD(void *arg))
+        SHIM(int flag), ARGMOD(void *arg))
 {
     ASSERT_ARGS(gc_ms_sweep_cb)
     int * const total_free = (int *) arg;

Modified: trunk/src/interp/inter_cb.c
==============================================================================
--- trunk/src/interp/inter_cb.c	Fri Mar 12 02:16:04 2010	(r44891)
+++ trunk/src/interp/inter_cb.c	Fri Mar 12 02:24:37 2010	(r44892)
@@ -159,7 +159,6 @@
 {
     ASSERT_ARGS(verify_CD)
     PARROT_INTERP = NULL;
-    size_t i;
     PMC    *interp_pmc;
     STRING *sc;
 

Modified: trunk/src/interp/inter_create.c
==============================================================================
--- trunk/src/interp/inter_create.c	Fri Mar 12 02:16:04 2010	(r44891)
+++ trunk/src/interp/inter_create.c	Fri Mar 12 02:24:37 2010	(r44892)
@@ -118,7 +118,6 @@
 allocate_interpreter(ARGIN_NULLOK(Interp *parent), INTVAL flags)
 {
     ASSERT_ARGS(allocate_interpreter)
-    int stacktop;
     Interp *interp;
 
     /* Get an empty interpreter from system memory */

Modified: trunk/src/nci/api.c
==============================================================================
--- trunk/src/nci/api.c	Fri Mar 12 02:16:04 2010	(r44891)
+++ trunk/src/nci/api.c	Fri Mar 12 02:24:37 2010	(r44892)
@@ -18,14 +18,6 @@
 /* HEADERIZER HFILE: include/parrot/nci.h */
 /* HEADERIZER STOP */
 
-static void
-init_nci_funcs(PARROT_INTERP) {
-    VTABLE_set_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_NCI_FUNCS,
-        Parrot_pmc_new(interp, enum_class_Hash));
-    Parrot_nci_load_core_thunks(interp);
-    Parrot_nci_load_extra_thunks(interp);
-}
-
 /* This function serves a single purpose. It takes the function
    signature for a C function we want to call and returns a pointer
    to a function that can call it. */


More information about the parrot-commits mailing list