diff --git a/config/gen/config_h/config_h.in b/config/gen/config_h/config_h.in index cb52980466..b35f944d2d 100644 --- a/config/gen/config_h/config_h.in +++ b/config/gen/config_h/config_h.in @@ -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) diff --git a/src/gc/gc_ms.c b/src/gc/gc_ms.c index 636e872cbf..e47b01209c 100644 --- a/src/gc/gc_ms.c +++ b/src/gc/gc_ms.c @@ -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; @@ -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; diff --git a/src/gc/gc_private.h b/src/gc/gc_private.h index bcb309b64a..f1c80a0b9d 100644 --- a/src/gc/gc_private.h +++ b/src/gc/gc_private.h @@ -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 @@ -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