[svn:parrot] r49157 - branches/gc_massacre/src/gc
bacek at svn.parrot.org
bacek at svn.parrot.org
Sun Sep 19 08:58:13 UTC 2010
Author: bacek
Date: Sun Sep 19 08:58:13 2010
New Revision: 49157
URL: https://trac.parrot.org/parrot/changeset/49157
Log:
More decoupling of String GC from Memory_Pools
Modified:
branches/gc_massacre/src/gc/gc_ms.c
branches/gc_massacre/src/gc/gc_ms2.c
branches/gc_massacre/src/gc/gc_private.h
branches/gc_massacre/src/gc/mark_sweep.c
branches/gc_massacre/src/gc/string_gc.c
branches/gc_massacre/src/gc/variable_size_pool.h
Modified: branches/gc_massacre/src/gc/gc_ms.c
==============================================================================
--- branches/gc_massacre/src/gc/gc_ms.c Sun Sep 19 08:57:43 2010 (r49156)
+++ branches/gc_massacre/src/gc/gc_ms.c Sun Sep 19 08:58:13 2010 (r49157)
@@ -44,10 +44,11 @@
static int gc_ms_active_sized_buffers(ARGIN(const Memory_Pools *mem_pools))
__attribute__nonnull__(1);
-static void gc_ms_add_free_object(SHIM_INTERP,
+static void gc_ms_add_free_object(PARROT_INTERP,
ARGMOD(Memory_Pools *mem_pools),
ARGMOD(Fixed_Size_Pool *pool),
ARGIN(void *to_add))
+ __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
@@ -263,7 +264,8 @@
#define ASSERT_ARGS_gc_ms_active_sized_buffers __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(mem_pools))
#define ASSERT_ARGS_gc_ms_add_free_object __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools) \
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(mem_pools) \
, PARROT_ASSERT_ARG(pool) \
, PARROT_ASSERT_ARG(to_add))
#define ASSERT_ARGS_gc_ms_alloc_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -565,7 +567,7 @@
}
else {
- ++mem_pools->stats.gc_lazy_mark_runs;
+ ++interp->gc_sys->stats.gc_lazy_mark_runs;
Parrot_gc_clear_live_bits(interp, mem_pools->pmc_pool);
}
@@ -576,12 +578,12 @@
pt_gc_stop_mark(interp);
/* Note it */
- ++mem_pools->stats.gc_mark_runs;
- mem_pools->stats.header_allocs_since_last_collect = 0;
+ ++interp->gc_sys->stats.gc_mark_runs;
+ interp->gc_sys->stats.header_allocs_since_last_collect = 0;
--mem_pools->gc_mark_block_level;
- mem_pools->stats.header_allocs_since_last_collect = 0;
- mem_pools->stats.mem_used_last_collect = mem_pools->stats.memory_used;
+ interp->gc_sys->stats.header_allocs_since_last_collect = 0;
+ interp->gc_sys->stats.mem_used_last_collect = interp->gc_sys->stats.memory_used;
return;
}
@@ -1470,14 +1472,14 @@
ARGMOD(Fixed_Size_Pool *pool))
{
ASSERT_ARGS(gc_ms_more_traceable_objects)
- size_t new_mem = mem_pools->stats.memory_used
- - mem_pools->stats.mem_used_last_collect;
+ size_t new_mem = interp->gc_sys->stats.memory_used
+ - interp->gc_sys->stats.mem_used_last_collect;
if (pool->skip == GC_ONE_SKIP)
pool->skip = GC_NO_SKIP;
else if (pool->skip == GC_NEVER_SKIP
|| (pool->skip == GC_NO_SKIP
- && (new_mem > (mem_pools->stats.mem_used_last_collect >> 2)
+ && (new_mem > (interp->gc_sys->stats.mem_used_last_collect >> 2)
&& new_mem >= GC_SIZE_THRESHOLD)))
Parrot_gc_mark_and_sweep(interp, GC_trace_stack_FLAG);
@@ -1501,7 +1503,7 @@
*/
static void
-gc_ms_add_free_object(SHIM_INTERP,
+gc_ms_add_free_object(PARROT_INTERP,
ARGMOD(Memory_Pools *mem_pools),
ARGMOD(Fixed_Size_Pool *pool),
ARGIN(void *to_add))
@@ -1517,7 +1519,7 @@
object->next_ptr = pool->free_list;
pool->free_list = object;
- mem_pools->stats.memory_used -= pool->object_size;
+ interp->gc_sys->stats.memory_used -= pool->object_size;
}
/*
@@ -1568,7 +1570,7 @@
}
--pool->num_free_objects;
- mem_pools->stats.memory_used += pool->object_size;
+ interp->gc_sys->stats.memory_used += pool->object_size;
return ptr;
}
@@ -1730,7 +1732,7 @@
case IMPATIENT_PMCS:
return mem_pools->num_early_gc_PMCs;
default:
- return Parrot_gc_get_info(interp, which, &mem_pools->stats);
+ return Parrot_gc_get_info(interp, which, &interp->gc_sys->stats);
break;
}
return 0;
Modified: branches/gc_massacre/src/gc/gc_ms2.c
==============================================================================
--- branches/gc_massacre/src/gc/gc_ms2.c Sun Sep 19 08:57:43 2010 (r49156)
+++ branches/gc_massacre/src/gc/gc_ms2.c Sun Sep 19 08:58:13 2010 (r49157)
@@ -626,6 +626,8 @@
self->gc_threshold = 100 * 1024;
}
interp->gc_sys->gc_private = self;
+
+ Parrot_gc_str_initialize(interp, &self->string_gc);
}
PARROT_MALLOC
Modified: branches/gc_massacre/src/gc/gc_private.h
==============================================================================
--- branches/gc_massacre/src/gc/gc_private.h Sun Sep 19 08:57:43 2010 (r49156)
+++ branches/gc_massacre/src/gc/gc_private.h Sun Sep 19 08:58:13 2010 (r49157)
@@ -94,6 +94,38 @@
GC_NEVER_SKIP /* unused */
} gc_skip_type_enum;
+/** statistics for GC **/
+typedef struct GC_Statistics {
+ size_t gc_mark_runs; /* Number of times we've done a mark run */
+ size_t gc_lazy_mark_runs; /* Number of successful lazy mark runs */
+ size_t gc_collect_runs; /* Number of times we've done a memory
+ compaction */
+ size_t mem_allocs_since_last_collect; /* The number of memory
+ * allocations from the
+ * system since the last
+ * compaction run */
+ size_t header_allocs_since_last_collect; /* The size of header
+ * blocks allocated from
+ * the system since the last
+ * GC run */
+ size_t memory_allocated; /* The total amount of memory allocated
+ * in fixed and variable size pools.
+ * Doesn't count memory for internal
+ * structures */
+ size_t memory_used; /* The total amount of memory used
+ * in fixed and variable size
+ * pools. Also includes memory in
+ * variable size pools that has been
+ * freed but can only be reclaimed
+ * by a GC run */
+ size_t mem_used_last_collect; /* The total amount of
+ * memory used after
+ * the last GC run */
+ UINTVAL memory_collected; /* Total amount of memory copied
+ during collection */
+
+} GC_Statistics;
+
/* Callback for live string. Use Buffer for now... */
typedef void (*string_iterator_callback)(PARROT_INTERP, Buffer *str, void *data);
@@ -162,6 +194,9 @@
/* Iterate over _live_ strings. Used for string pool compacting */
void (*iterate_live_strings)(PARROT_INTERP, string_iterator_callback callback, void *data);
+ /* Statistic for GC */
+ struct GC_Statistics stats;
+
/*Function hooks that GC systems can CHOOSE to provide if they need them
*These will be called via the GC API functions Parrot_gc_func_name
*e.g. read barrier && write barrier hooks can go here later ...*/
@@ -270,38 +305,6 @@
compacted */
} String_GC;
-/** statistics for GC **/
-typedef struct GC_Statistics {
- size_t gc_mark_runs; /* Number of times we've done a mark run */
- size_t gc_lazy_mark_runs; /* Number of successful lazy mark runs */
- size_t gc_collect_runs; /* Number of times we've done a memory
- compaction */
- size_t mem_allocs_since_last_collect; /* The number of memory
- * allocations from the
- * system since the last
- * compaction run */
- size_t header_allocs_since_last_collect; /* The size of header
- * blocks allocated from
- * the system since the last
- * GC run */
- size_t memory_allocated; /* The total amount of memory allocated
- * in fixed and variable size pools.
- * Doesn't count memory for internal
- * structures */
- size_t memory_used; /* The total amount of memory used
- * in fixed and variable size
- * pools. Also includes memory in
- * variable size pools that has been
- * freed but can only be reclaimed
- * by a GC run */
- size_t mem_used_last_collect; /* The total amount of
- * memory used after
- * the last GC run */
- UINTVAL memory_collected; /* Total amount of memory copied
- during collection */
-
-} GC_Statistics;
-
typedef struct Memory_Pools {
String_GC string_gc;
@@ -329,9 +332,6 @@
UINTVAL num_early_gc_PMCs; /* how many PMCs want immediate destruction */
UINTVAL num_early_PMCs_seen; /* how many such PMCs has GC seen */
-
- GC_Statistics stats; /* Stats */
-
/* private data for the GC subsystem */
void *gc_private; /* GC subsystem data */
} Memory_Pools;
Modified: branches/gc_massacre/src/gc/mark_sweep.c
==============================================================================
--- branches/gc_massacre/src/gc/mark_sweep.c Sun Sep 19 08:57:43 2010 (r49156)
+++ branches/gc_massacre/src/gc/mark_sweep.c Sun Sep 19 08:58:13 2010 (r49157)
@@ -456,7 +456,7 @@
*/
void
-Parrot_append_arena_in_pool(SHIM_INTERP,
+Parrot_append_arena_in_pool(PARROT_INTERP,
ARGMOD(Memory_Pools *mem_pools),
ARGMOD(Fixed_Size_Pool *pool),
ARGMOD(Fixed_Size_Arena *new_arena), size_t size)
@@ -481,8 +481,8 @@
new_arena->prev->next = new_arena;
pool->last_Arena = new_arena;
- mem_pools->stats.header_allocs_since_last_collect += size;
- mem_pools->stats.memory_allocated += size;
+ interp->gc_sys->stats.header_allocs_since_last_collect += size;
+ interp->gc_sys->stats.memory_allocated += size;
}
/*
Modified: branches/gc_massacre/src/gc/string_gc.c
==============================================================================
--- branches/gc_massacre/src/gc/string_gc.c Sun Sep 19 08:57:43 2010 (r49156)
+++ branches/gc_massacre/src/gc/string_gc.c Sun Sep 19 08:58:13 2010 (r49157)
@@ -21,7 +21,7 @@
#include "parrot/parrot.h"
#include "gc_private.h"
-typedef void (*compact_f) (Interp *, Memory_Pools * const, Variable_Size_Pool *);
+typedef void (*compact_f) (Interp *, GC_Statistics *stats, Variable_Size_Pool *);
#define POOL_SIZE (65536 * 2)
@@ -48,14 +48,14 @@
__attribute__nonnull__(2);
static void alloc_new_block(
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
size_t size,
ARGMOD(Variable_Size_Pool *pool),
ARGIN(const char *why))
__attribute__nonnull__(1)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
- FUNC_MODIFIES(*mem_pools)
+ FUNC_MODIFIES(*stats)
FUNC_MODIFIES(*pool);
PARROT_CANNOT_RETURN_NULL
@@ -65,12 +65,12 @@
__attribute__nonnull__(2);
static void compact_pool(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
ARGMOD(Variable_Size_Pool *pool))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- FUNC_MODIFIES(*mem_pools)
+ FUNC_MODIFIES(*stats)
FUNC_MODIFIES(*pool);
static void debug_print_buf(PARROT_INTERP, ARGIN(const Buffer *b))
@@ -79,14 +79,14 @@
static void free_memory_pool(ARGFREE(Variable_Size_Pool *pool));
static void free_old_mem_blocks(
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
ARGMOD(Variable_Size_Pool *pool),
ARGMOD(Memory_Block *new_block),
UINTVAL total_size)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- FUNC_MODIFIES(*mem_pools)
+ FUNC_MODIFIES(*stats)
FUNC_MODIFIES(*pool)
FUNC_MODIFIES(*new_block);
@@ -96,13 +96,13 @@
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
static void * mem_allocate(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
size_t size,
ARGMOD(Variable_Size_Pool *pool))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(4)
- FUNC_MODIFIES(*mem_pools)
+ FUNC_MODIFIES(*stats)
FUNC_MODIFIES(*pool);
static void move_buffer_callback(PARROT_INTERP,
@@ -139,7 +139,7 @@
#define ASSERT_ARGS_aligned_mem __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(mem))
#define ASSERT_ARGS_alloc_new_block __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools) \
+ PARROT_ASSERT_ARG(stats) \
, PARROT_ASSERT_ARG(pool) \
, PARROT_ASSERT_ARG(why))
#define ASSERT_ARGS_buffer_location __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -147,21 +147,21 @@
, PARROT_ASSERT_ARG(b))
#define ASSERT_ARGS_compact_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(mem_pools) \
+ , PARROT_ASSERT_ARG(stats) \
, PARROT_ASSERT_ARG(pool))
#define ASSERT_ARGS_debug_print_buf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(b))
#define ASSERT_ARGS_free_memory_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_free_old_mem_blocks __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools) \
+ PARROT_ASSERT_ARG(stats) \
, PARROT_ASSERT_ARG(pool) \
, PARROT_ASSERT_ARG(new_block))
#define ASSERT_ARGS_is_block_almost_full __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(block))
#define ASSERT_ARGS_mem_allocate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(mem_pools) \
+ , PARROT_ASSERT_ARG(stats) \
, PARROT_ASSERT_ARG(pool))
#define ASSERT_ARGS_move_buffer_callback __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
@@ -197,11 +197,11 @@
ASSERT_ARGS(Parrot_gc_str_initialize)
gc->memory_pool = new_memory_pool(POOL_SIZE, &compact_pool);
- alloc_new_block(interp->mem_pools, POOL_SIZE, gc->memory_pool, "init");
+ alloc_new_block(&interp->gc_sys->stats, POOL_SIZE, gc->memory_pool, "init");
/* Constant strings - not compacted */
gc->constant_string_pool = new_memory_pool(POOL_SIZE, NULL);
- alloc_new_block(interp->mem_pools, POOL_SIZE, gc->constant_string_pool, "init");
+ alloc_new_block(&interp->gc_sys->stats, POOL_SIZE, gc->constant_string_pool, "init");
}
/*
@@ -249,7 +249,7 @@
Buffer_bufstart(buffer) = (void *)aligned_mem(buffer,
(char *)mem_allocate(interp,
- interp->mem_pools, new_size, gc->memory_pool));
+ &interp->gc_sys->stats, new_size, gc->memory_pool));
/* Save pool used to allocate into buffer header */
*Buffer_poolptr(buffer) = gc->memory_pool->top_block;
@@ -304,14 +304,14 @@
&& (pool->top_block->top == (char *)Buffer_bufstart(buffer) + old_size)) {
pool->top_block->free -= needed;
pool->top_block->top += needed;
- interp->mem_pools->stats.memory_used += needed;
+ interp->gc_sys->stats.memory_used += needed;
Buffer_buflen(buffer) = newsize;
return;
}
copysize = Buffer_buflen(buffer);
- mem = (char *)mem_allocate(interp, interp->mem_pools, new_size, pool);
+ mem = (char *)mem_allocate(interp, &interp->gc_sys->stats, new_size, pool);
mem = aligned_mem(buffer, mem);
/* We shouldn't ever have a 0 from size, but we do. If we can track down
@@ -365,7 +365,7 @@
: gc->memory_pool;
new_size = ALIGNED_STRING_SIZE(size);
- mem = (char *)mem_allocate(interp, interp->mem_pools, new_size, pool);
+ mem = (char *)mem_allocate(interp, &interp->gc_sys->stats, new_size, pool);
mem += sizeof (void *);
Buffer_bufstart(str) = str->strstart = mem;
@@ -421,7 +421,7 @@
&& pool->top_block->top == (char *)Buffer_bufstart(str) + old_size) {
pool->top_block->free -= needed;
pool->top_block->top += needed;
- interp->mem_pools->stats.memory_used += needed;
+ interp->gc_sys->stats.memory_used += needed;
Buffer_buflen(str) = new_size - sizeof (void *);
return;
}
@@ -431,7 +431,7 @@
/* only copy used memory, not total string buffer */
copysize = str->bufused;
- mem = (char *)mem_allocate(interp, interp->mem_pools, new_size, pool);
+ mem = (char *)mem_allocate(interp, &interp->gc_sys->stats, new_size, pool);
mem += sizeof (void *);
/* Update Memory_Block usage */
@@ -471,7 +471,7 @@
Parrot_gc_str_compact_pool(PARROT_INTERP, ARGIN(String_GC *gc))
{
ASSERT_ARGS(Parrot_gc_str_compact_pool)
- compact_pool(interp, interp->mem_pools, gc->memory_pool);
+ compact_pool(interp, &interp->gc_sys->stats, gc->memory_pool);
}
/*
@@ -552,7 +552,7 @@
/*
-=item C<static void alloc_new_block( Memory_Pools *mem_pools, size_t size,
+=item C<static void alloc_new_block( GC_Statistics *stats, size_t size,
Variable_Size_Pool *pool, const char *why)>
Allocate a new memory block. We allocate either the requested size or the
@@ -565,7 +565,7 @@
static void
alloc_new_block(
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
size_t size,
ARGMOD(Variable_Size_Pool *pool),
ARGIN(const char *why))
@@ -600,7 +600,7 @@
new_block->top = new_block->start;
/* Note that we've allocated it */
- mem_pools->stats.memory_allocated += alloc_size;
+ stats->memory_allocated += alloc_size;
/* If this is for a public pool, add it to the list */
new_block->prev = pool->top_block;
@@ -615,8 +615,8 @@
/*
-=item C<static void * mem_allocate(PARROT_INTERP, Memory_Pools *mem_pools,
-size_t size, Variable_Size_Pool *pool)>
+=item C<static void * mem_allocate(PARROT_INTERP, GC_Statistics *stats, size_t
+size, Variable_Size_Pool *pool)>
Allocates memory for headers.
@@ -643,7 +643,7 @@
PARROT_CANNOT_RETURN_NULL
static void *
mem_allocate(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
size_t size,
ARGMOD(Variable_Size_Pool *pool))
{
@@ -662,10 +662,10 @@
* TODO pass required allocation size to the GC system,
* so that collection can be skipped if needed
*/
- size_t new_mem = mem_pools->stats.memory_used -
- mem_pools->stats.mem_used_last_collect;
- if (!mem_pools->gc_mark_block_level
- && new_mem > (mem_pools->stats.mem_used_last_collect >> 2)
+ size_t new_mem = interp->gc_sys->stats.memory_used -
+ interp->gc_sys->stats.mem_used_last_collect;
+ if (!Parrot_is_blocked_GC_mark(interp)
+ && new_mem > (stats->mem_used_last_collect >> 2)
&& new_mem > GC_SIZE_THRESHOLD) {
Parrot_gc_mark_and_sweep(interp, GC_trace_stack_FLAG);
@@ -675,7 +675,7 @@
/* don't bother reclaiming if it's only a small amount */
if ((pool->possibly_reclaimable * pool->reclaim_factor +
pool->guaranteed_reclaimable) > size) {
- (*pool->compact) (interp, mem_pools, pool);
+ (*pool->compact) (interp, stats, pool);
}
}
}
@@ -689,9 +689,9 @@
* Mark the block as big block (it has just one item)
* And don't set big blocks as the top_block.
*/
- alloc_new_block(mem_pools, size, pool, "compact failed");
+ alloc_new_block(&interp->gc_sys->stats, size, pool, "compact failed");
- ++mem_pools->stats.mem_allocs_since_last_collect;
+ ++interp->gc_sys->stats.mem_allocs_since_last_collect;
if (pool->top_block->free < size) {
fprintf(stderr, "out of mem\n");
@@ -704,7 +704,7 @@
return_val = pool->top_block->top;
pool->top_block->top += size;
pool->top_block->free -= size;
- mem_pools->stats.memory_used += size;
+ interp->gc_sys->stats.memory_used += size;
return return_val;
}
@@ -795,7 +795,7 @@
=over 4
-=item C<static void compact_pool(PARROT_INTERP, Memory_Pools *mem_pools,
+=item C<static void compact_pool(PARROT_INTERP, GC_Statistics *stats,
Variable_Size_Pool *pool)>
Compact the string buffer pool. Does not perform a GC scan, or mark items
@@ -807,7 +807,7 @@
static void
compact_pool(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
ARGMOD(Variable_Size_Pool *pool))
{
ASSERT_ARGS(compact_pool)
@@ -821,26 +821,26 @@
/* Bail if we're blocked */
- if (mem_pools->gc_sweep_block_level)
+ if (Parrot_is_blocked_GC_mark(interp))
return;
- ++mem_pools->gc_sweep_block_level;
+ Parrot_block_GC_mark(interp);
/* We're collecting */
- mem_pools->stats.mem_allocs_since_last_collect = 0;
- mem_pools->stats.header_allocs_since_last_collect = 0;
- ++mem_pools->stats.gc_collect_runs;
+ interp->gc_sys->stats.mem_allocs_since_last_collect = 0;
+ interp->gc_sys->stats.header_allocs_since_last_collect = 0;
+ ++interp->gc_sys->stats.gc_collect_runs;
/* Snag a block big enough for everything */
total_size = pad_pool_size(pool);
if (total_size == 0) {
- free_old_mem_blocks(mem_pools, pool, pool->top_block, total_size);
- --mem_pools->gc_sweep_block_level;
+ free_old_mem_blocks(stats, pool, pool->top_block, total_size);
+ Parrot_unblock_GC_mark(interp);
return;
}
- alloc_new_block(mem_pools, total_size, pool, "inside compact");
+ alloc_new_block(stats, total_size, pool, "inside compact");
cb_data.new_block = pool->top_block;
@@ -861,12 +861,12 @@
/* How much is free. That's the total size minus the amount we used */
cb_data.new_block->free = cb_data.new_block->size
- (cb_data.cur_spot - cb_data.new_block->start);
- mem_pools->stats.memory_collected += (cb_data.cur_spot - cb_data.new_block->start);
- mem_pools->stats.memory_used += (cb_data.cur_spot - cb_data.new_block->start);
+ stats->memory_collected += (cb_data.cur_spot - cb_data.new_block->start);
+ stats->memory_used += (cb_data.cur_spot - cb_data.new_block->start);
- free_old_mem_blocks(mem_pools, pool, cb_data.new_block, total_size);
+ free_old_mem_blocks(stats, pool, cb_data.new_block, total_size);
- --mem_pools->gc_sweep_block_level;
+ Parrot_unblock_GC_mark(interp);
}
/*
@@ -1064,7 +1064,7 @@
/*
-=item C<static void free_old_mem_blocks( Memory_Pools *mem_pools,
+=item C<static void free_old_mem_blocks( GC_Statistics *stats,
Variable_Size_Pool *pool, Memory_Block *new_block, UINTVAL total_size)>
The compact_pool operation collects disjointed blocks of memory allocated on a
@@ -1081,7 +1081,7 @@
static void
free_old_mem_blocks(
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
ARGMOD(Variable_Size_Pool *pool),
ARGMOD(Memory_Block *new_block),
UINTVAL total_size)
@@ -1102,8 +1102,8 @@
}
else {
/* Note that we don't have it any more */
- mem_pools->stats.memory_allocated -= cur_block->size;
- mem_pools->stats.memory_used -= cur_block->size - cur_block->free;
+ stats->memory_allocated -= cur_block->size;
+ stats->memory_used -= cur_block->size - cur_block->free;
/* We know the pool body and pool header are a single chunk, so
* this is enough to get rid of 'em both */
Modified: branches/gc_massacre/src/gc/variable_size_pool.h
==============================================================================
--- branches/gc_massacre/src/gc/variable_size_pool.h Sun Sep 19 08:57:43 2010 (r49156)
+++ branches/gc_massacre/src/gc/variable_size_pool.h Sun Sep 19 08:58:13 2010 (r49157)
@@ -16,6 +16,8 @@
#include "parrot/settings.h"
+struct GC_Statistics;
+
typedef struct Memory_Block {
size_t free;
size_t size;
@@ -30,7 +32,7 @@
typedef struct Variable_Size_Pool {
Memory_Block *top_block;
- void (*compact)(PARROT_INTERP, struct Memory_Pools *, struct Variable_Size_Pool *);
+ void (*compact)(PARROT_INTERP, struct GC_Statistics *, struct Variable_Size_Pool *);
size_t minimum_block_size;
size_t total_allocated; /* total bytes allocated to this pool */
size_t guaranteed_reclaimable; /* bytes that can definitely be reclaimed*/
More information about the parrot-commits
mailing list