Skip to content

Commit

Permalink
gc: define the default GC, for PARROT_GC_DEFAULT_MS
Browse files Browse the repository at this point in the history
We need a compile-time definition, to skip num_free_objects on gms or inf
  • Loading branch information
Reini Urban committed Jan 23, 2015
1 parent 53139d9 commit 9ff9bd6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions config/gen/config_h/config_h.in
Expand Up @@ -96,6 +96,7 @@ typedef @float8_t@ Parrot_Float8;
*/
#ifndef PARROT_GC_DEFAULT_TYPE
# define PARROT_GC_DEFAULT_TYPE @gc_type@
# define PARROT_GC_DEFAULT_@gc_type@
#endif

#if defined(PARROT_IN_CORE)
Expand Down
4 changes: 2 additions & 2 deletions src/gc/gc_ms.c
Expand Up @@ -1204,9 +1204,7 @@ Parrot_gc_create_attrib_pool(size_t attrib_idx)
newpool->attr_size = attrib_size;
newpool->total_objects = 0;
newpool->objects_per_alloc = num_objs;
#ifdef GC_STATS
newpool->num_free_objects = 0;
#endif
newpool->free_list = NULL;
newpool->top_arena = NULL;

Expand Down Expand Up @@ -1665,7 +1663,9 @@ gc_ms_get_free_object(PARROT_INTERP,
goto HAVE_FREE;
}

#ifdef GC_STATS
--pool->num_free_objects;
#endif
interp->gc_sys->stats.memory_used += pool->object_size;

return ptr;
Expand Down
14 changes: 5 additions & 9 deletions src/gc/gc_private.h
Expand Up @@ -25,14 +25,12 @@ Parrot.
#include "parrot/settings.h"
#include "variable_size_pool.h"

/* Do not calculate private gc statistics, only used in gc_ms.
Currently skipped: num_free_objects.
*/
/* Do not calculate num_free_objects, only used in gc_ms. */
#ifndef GC_STATS
# ifdef NDEBUG
# undef GC_STATS
# else
# if !defined(NDEBUG) || defined(PARROT_GC_DEFAULT_MS) || defined(PARROT_GC_DEFAULT_MS2)
# define GC_STATS
# else
# undef GC_STATS
# endif
#endif

Expand Down Expand Up @@ -325,11 +323,9 @@ typedef struct PMC_Attribute_Arena {

typedef struct PMC_Attribute_Pool {
size_t attr_size; /* Size of attribute object. */
size_t num_free_objects; /* Number of objects on the free list. */
size_t total_objects; /* Total objects in the pool. */
size_t objects_per_alloc; /* Number of object slots to allocate. */
#ifdef GC_STATS
size_t num_free_objects; /* Number of objects on the free list. */
#endif
PMC_Attribute_Free_List * free_list; /* List of free object slots, or NULL. */
PMC_Attribute_Arena * top_arena; /* Pointer to most recent arena. */
PMC_Attribute_Free_List * newfree; /* Pointer to next object slot in
Expand Down

0 comments on commit 9ff9bd6

Please sign in to comment.