[svn:parrot] r38643 - in branches/gc_api: include/parrot src src/gc src/interp src/ops
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Sat May 9 14:04:00 UTC 2009
Author: whiteknight
Date: Sat May 9 14:03:59 2009
New Revision: 38643
URL: https://trac.parrot.org/parrot/changeset/38643
Log:
[gc_api] move Arenas struct into gc_private.h. It is no longer directly accessible from outside the GC system. Notice also that the block/unblock routines are no longer macros, they are now regular API functions.
Modified:
branches/gc_api/include/parrot/gc_api.h
branches/gc_api/src/gc/api.c
branches/gc_api/src/gc/gc_private.h
branches/gc_api/src/interp/inter_create.c
branches/gc_api/src/interp/inter_misc.c
branches/gc_api/src/list.c
branches/gc_api/src/ops/core.ops
branches/gc_api/src/thread.c
Modified: branches/gc_api/include/parrot/gc_api.h
==============================================================================
--- branches/gc_api/include/parrot/gc_api.h Sat May 9 13:58:32 2009 (r38642)
+++ branches/gc_api/include/parrot/gc_api.h Sat May 9 14:03:59 2009 (r38643)
@@ -45,6 +45,7 @@
struct Small_Object_Pool;
struct Small_Object_Arena;
+struct Arenas;
typedef int (*pool_iter_fn)(PARROT_INTERP, struct Small_Object_Pool *, int, void*);
@@ -68,67 +69,6 @@
FLOATVAL reclaim_factor; /* minimum percentage we will reclaim */
} Memory_Pool;
-typedef struct Arenas {
- Memory_Pool *memory_pool;
- Memory_Pool *constant_string_pool;
- struct Small_Object_Pool *string_header_pool;
- struct Small_Object_Pool *pmc_pool;
- struct Small_Object_Pool *pmc_ext_pool;
- struct Small_Object_Pool *constant_pmc_pool;
- struct Small_Object_Pool *buffer_header_pool;
- struct Small_Object_Pool *constant_string_header_pool;
- struct Small_Object_Pool **sized_header_pools;
- size_t num_sized;
- /*
- * function slots that each subsystem must provide
- */
- void (*do_gc_mark)(PARROT_INTERP, UINTVAL flags);
- void (*finalize_gc_system) (PARROT_INTERP);
- void (*init_pool)(PARROT_INTERP, struct Small_Object_Pool *);
- /*
- * statistics for GC
- */
- 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 number of header
- * blocks allocated from
- * the system since the last
- * GC run */
- size_t memory_allocated; /* The total amount of
- * allocatable memory
- * allocated. Doesn't count
- * memory for headers or
- * internal structures or
- * anything */
- UINTVAL memory_collected; /* Total amount of memory copied
- during collection */
- UINTVAL num_early_gc_PMCs; /* how many PMCs want immediate destruction */
- UINTVAL num_early_PMCs_seen; /* how many such PMCs has GC seen */
- UINTVAL num_extended_PMCs; /* active PMCs having pmc_ext */
- PMC* gc_mark_start; /* first PMC marked during a GC run */
- PMC* gc_mark_ptr; /* last PMC marked during a GC run */
- PMC* gc_trace_ptr; /* last PMC trace_children was called on */
- int lazy_gc; /* flag that indicates whether we should stop
- when we've seen all impatient PMCs */
- /*
- * GC blocking
- */
- UINTVAL gc_mark_block_level; /* How many outstanding GC block
- requests are there? */
- UINTVAL gc_sweep_block_level; /* How many outstanding GC block
- requests are there? */
- /*
- * private data for the GC subsystem
- */
- void * gc_private; /* gc subsystem data */
-} Arenas;
-
typedef enum {
GC_TRACE_FULL,
GC_TRACE_ROOT_ONLY,
@@ -187,35 +127,6 @@
/* &end_gen */
-
-/* Macros for recursively blocking and unblocking GC mark */
-#define Parrot_block_GC_mark(interp) \
- { \
- (interp)->arena_base->gc_mark_block_level++; \
- Parrot_shared_gc_block(interp); \
- }
-
-#define Parrot_unblock_GC_mark(interp) \
- if ((interp)->arena_base->gc_mark_block_level) { \
- (interp)->arena_base->gc_mark_block_level--; \
- Parrot_shared_gc_unblock(interp); \
- }
-
-/* Macros for recursively blocking and unblocking GC sweep */
-#define Parrot_block_GC_sweep(interp) \
- (interp)->arena_base->gc_sweep_block_level++
-
-#define Parrot_unblock_GC_sweep(interp) \
- if ((interp)->arena_base->gc_sweep_block_level) \
- (interp)->arena_base->gc_sweep_block_level--
-
-/* Macros for testing if the GC mark and sweep are blocked */
-#define Parrot_is_blocked_GC_mark(interp) \
- ((interp)->arena_base->gc_mark_block_level)
-
-#define Parrot_is_blocked_GC_sweep(interp) \
- ((interp)->arena_base->gc_sweep_block_level)
-
#define GC_trace_stack_FLAG (UINTVAL)(1 << 0) /* trace system areas and stack */
#define GC_trace_normal (UINTVAL)(1 << 0) /* the same */
#define GC_lazy_FLAG (UINTVAL)(1 << 1) /* timely destruction run */
@@ -226,11 +137,35 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
PARROT_EXPORT
+void Parrot_block_GC_mark(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+void Parrot_block_GC_sweep(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
void Parrot_gc_mark_PObj_alive(PARROT_INTERP, ARGMOD(PObj *obj))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*obj);
+PARROT_EXPORT
+int Parrot_is_blocked_GC_mark(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+int Parrot_is_blocked_GC_sweep(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+void Parrot_unblock_GC_mark(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+void Parrot_unblock_GC_sweep(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
int Parrot_gc_active_pmcs(PARROT_INTERP)
__attribute__nonnull__(1);
@@ -267,6 +202,9 @@
void Parrot_gc_compact_memory_pool(PARROT_INTERP)
__attribute__nonnull__(1);
+void Parrot_gc_completely_unblock(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
int Parrot_gc_count_collect_runs(PARROT_INTERP)
__attribute__nonnull__(1);
@@ -282,6 +220,12 @@
void Parrot_gc_destroy_memory_pools(PARROT_INTERP)
__attribute__nonnull__(1);
+int Parrot_gc_extended_pmcs(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+void Parrot_gc_finalize(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
void Parrot_gc_free_bufferlike_header(PARROT_INTERP,
ARGMOD(PObj *obj),
size_t size)
@@ -308,6 +252,12 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
+int Parrot_gc_headers_alloc_since_last_collect(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+int Parrot_gc_impatient_pmcs(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
void Parrot_gc_initialize(PARROT_INTERP, ARGIN(void *stacktop))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -315,6 +265,9 @@
void Parrot_gc_mark_and_sweep(PARROT_INTERP, UINTVAL flags)
__attribute__nonnull__(1);
+int Parrot_gc_mem_alloc_since_last_collect(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
void Parrot_gc_merge_header_pools(
ARGMOD(Interp *dest_interp),
ARGIN(Interp *source_interp))
@@ -337,6 +290,11 @@
STRING * Parrot_gc_new_string_header(PARROT_INTERP, UINTVAL flags)
__attribute__nonnull__(1);
+void Parrot_gc_pmc_needs_early_collection(PARROT_INTERP, ARGMOD(PMC *pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*pmc);
+
PARROT_WARN_UNUSED_RESULT
int Parrot_gc_ptr_in_memory_pool(PARROT_INTERP, ARGIN(void *bufstart))
__attribute__nonnull__(1)
@@ -353,6 +311,12 @@
__attribute__nonnull__(2)
FUNC_MODIFIES(*str);
+int Parrot_gc_total_copied(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+int Parrot_gc_total_memory_allocated(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
int Parrot_gc_total_pmcs(PARROT_INTERP)
__attribute__nonnull__(1);
@@ -366,9 +330,21 @@
__attribute__nonnull__(2)
FUNC_MODIFIES(*buffer);
+#define ASSERT_ARGS_Parrot_block_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_block_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_mark_PObj_alive __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(obj)
+#define ASSERT_ARGS_Parrot_is_blocked_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_is_blocked_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_unblock_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_unblock_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_active_pmcs __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_active_sized_buffers \
@@ -391,6 +367,8 @@
PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_compact_memory_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_gc_completely_unblock __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_count_collect_runs __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_count_lazy_mark_runs \
@@ -404,6 +382,10 @@
#define ASSERT_ARGS_Parrot_gc_destroy_memory_pools \
__attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_gc_extended_pmcs __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_gc_finalize __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_free_bufferlike_header \
__attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
@@ -420,11 +402,19 @@
#define ASSERT_ARGS_Parrot_gc_get_pmc_index __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(pmc)
+#define ASSERT_ARGS_Parrot_gc_headers_alloc_since_last_collect \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_gc_impatient_pmcs __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_initialize __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(stacktop)
#define ASSERT_ARGS_Parrot_gc_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_gc_mem_alloc_since_last_collect \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_merge_header_pools __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(dest_interp) \
|| PARROT_ASSERT_ARG(source_interp)
@@ -435,6 +425,10 @@
PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_new_string_header __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_gc_pmc_needs_early_collection \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp) \
+ || PARROT_ASSERT_ARG(pmc)
#define ASSERT_ARGS_Parrot_gc_ptr_in_memory_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(bufstart)
@@ -445,6 +439,11 @@
__attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(str)
+#define ASSERT_ARGS_Parrot_gc_total_copied __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_gc_total_memory_allocated \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_total_pmcs __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_gc_total_sized_buffers __attribute__unused__ int _ASSERT_ARGS_CHECK = \
Modified: branches/gc_api/src/gc/api.c
==============================================================================
--- branches/gc_api/src/gc/api.c Sat May 9 13:58:32 2009 (r38642)
+++ branches/gc_api/src/gc/api.c Sat May 9 14:03:59 2009 (r38643)
@@ -1199,6 +1199,18 @@
=item C<int Parrot_gc_count_lazy_mark_runs(PARROT_INTERP)>
+=item C<int Parrot_gc_total_memory_allocated(PARROT_INTERP)>
+
+=item C<int Parrot_gc_headers_alloc_since_last_collect(PARROT_INTERP)>
+
+=item C<int Parrot_gc_mem_alloc_since_last_collect(PARROT_INTERP)>
+
+=item C<int Parrot_gc_total_copied(PARROT_INTERP)>
+
+=item C<int Parrot_gc_impatient_pmcs(PARROT_INTERP)>
+
+=item C<int Parrot_gc_extended_pmcs(PARROT_INTERP)>
+
=cut
*/
@@ -1224,6 +1236,152 @@
return arena_base->gc_lazy_mark_runs;;
}
+int
+Parrot_gc_total_memory_allocated(PARROT_INTERP)
+{
+ const Arenas * const arena_base = interp->arena_base;
+ return arena_base->memory_allocated;
+}
+
+int
+Parrot_gc_headers_alloc_since_last_collect(PARROT_INTERP)
+{
+ const Arenas * const arena_base = interp->arena_base;
+ return arena_base->header_allocs_since_last_collect;
+}
+
+int
+Parrot_gc_mem_alloc_since_last_collect(PARROT_INTERP)
+{
+ const Arenas * const arena_base = interp->arena_base;
+ return arena_base->mem_allocs_since_last_collect;
+}
+
+int
+Parrot_gc_total_copied(PARROT_INTERP)
+{
+ const Arenas * const arena_base = interp->arena_base;
+ return arena_base->memory_collected;
+}
+
+int
+Parrot_gc_impatient_pmcs(PARROT_INTERP)
+{
+ const Arenas * const arena_base = interp->arena_base;
+ return arena_base->num_early_gc_PMCs;
+}
+
+int
+Parrot_gc_extended_pmcs(PARROT_INTERP)
+{
+ const Arenas * const arena_base = interp->arena_base;
+ return arena_base->num_extended_PMCs;
+}
+
+/*
+
+=item C<void Parrot_block_GC_mark(PARROT_INTERP)>
+
+=item C<void Parrot_unblock_GC_mark(PARROT_INTERP)>
+
+=item C<void Parrot_block_GC_sweep(PARROT_INTERP)>
+
+=item C<void Parrot_unblock_GC_sweep(PARROT_INTERP)>
+
+=item C<int Parrot_is_blocked_GC_mark(PARROT_INTERP)>
+
+=item C<int Parrot_is_blocked_GC_sweep(PARROT_INTERP)>
+
+=item C<void Parrot_gc_completely_unblock(PARROT_INTERP)>
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_block_GC_mark(PARROT_INTERP)
+{
+ interp->arena_base->gc_mark_block_level++;
+ Parrot_shared_gc_block(interp);
+}
+
+PARROT_EXPORT
+void
+Parrot_unblock_GC_mark(PARROT_INTERP)
+{
+ if (interp->arena_base->gc_mark_block_level) {
+ interp->arena_base->gc_mark_block_level--;
+ Parrot_shared_gc_unblock(interp);
+ }
+}
+
+PARROT_EXPORT
+void
+Parrot_block_GC_sweep(PARROT_INTERP)
+{
+ interp->arena_base->gc_sweep_block_level++;
+}
+
+PARROT_EXPORT
+void
+Parrot_unblock_GC_sweep(PARROT_INTERP)
+{
+ if (interp->arena_base->gc_sweep_block_level)
+ interp->arena_base->gc_sweep_block_level--;
+}
+
+PARROT_EXPORT
+int
+Parrot_is_blocked_GC_mark(PARROT_INTERP)
+{
+ interp->arena_base->gc_mark_block_level;
+}
+
+PARROT_EXPORT
+int
+Parrot_is_blocked_GC_sweep(PARROT_INTERP)
+{
+ interp->arena_base->gc_sweep_block_level;
+}
+
+void
+Parrot_gc_completely_unblock(PARROT_INTERP)
+{
+ interp->arena_base->gc_mark_block_level = 0;
+ interp->arena_base->gc_sweep_block_level = 0;
+}
+
+/*
+
+=item C<void Parrot_gc_pmc_needs_early_collection(PARROT_INTERP, PMC *pmc)>
+
+=cut
+
+*/
+
+void
+Parrot_gc_pmc_needs_early_collection(PARROT_INTERP, ARGMOD(PMC *pmc))
+{
+ PObj_needs_early_gc_SET(pmc);
+ ++interp->arena_base->num_early_gc_PMCs;
+}
+
+/*
+
+=item C<void Parrot_gc_finalize(PARROT_INTERP)>
+
+=cut
+
+*/
+
+void
+Parrot_gc_finalize(PARROT_INTERP)
+{
+ if (interp->arena_base->finalize_gc_system)
+ interp->arena_base->finalize_gc_system(interp);
+}
+
/*
=back
Modified: branches/gc_api/src/gc/gc_private.h
==============================================================================
--- branches/gc_api/src/gc/gc_private.h Sat May 9 13:58:32 2009 (r38642)
+++ branches/gc_api/src/gc/gc_private.h Sat May 9 14:03:59 2009 (r38643)
@@ -146,6 +146,67 @@
#endif
} Small_Object_Pool;
+typedef struct Arenas {
+ Memory_Pool *memory_pool;
+ Memory_Pool *constant_string_pool;
+ struct Small_Object_Pool *string_header_pool;
+ struct Small_Object_Pool *pmc_pool;
+ struct Small_Object_Pool *pmc_ext_pool;
+ struct Small_Object_Pool *constant_pmc_pool;
+ struct Small_Object_Pool *buffer_header_pool;
+ struct Small_Object_Pool *constant_string_header_pool;
+ struct Small_Object_Pool **sized_header_pools;
+ size_t num_sized;
+ /*
+ * function slots that each subsystem must provide
+ */
+ void (*do_gc_mark)(PARROT_INTERP, UINTVAL flags);
+ void (*finalize_gc_system) (PARROT_INTERP);
+ void (*init_pool)(PARROT_INTERP, struct Small_Object_Pool *);
+ /*
+ * statistics for GC
+ */
+ 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 number of header
+ * blocks allocated from
+ * the system since the last
+ * GC run */
+ size_t memory_allocated; /* The total amount of
+ * allocatable memory
+ * allocated. Doesn't count
+ * memory for headers or
+ * internal structures or
+ * anything */
+ UINTVAL memory_collected; /* Total amount of memory copied
+ during collection */
+ UINTVAL num_early_gc_PMCs; /* how many PMCs want immediate destruction */
+ UINTVAL num_early_PMCs_seen; /* how many such PMCs has GC seen */
+ UINTVAL num_extended_PMCs; /* active PMCs having pmc_ext */
+ PMC* gc_mark_start; /* first PMC marked during a GC run */
+ PMC* gc_mark_ptr; /* last PMC marked during a GC run */
+ PMC* gc_trace_ptr; /* last PMC trace_children was called on */
+ int lazy_gc; /* flag that indicates whether we should stop
+ when we've seen all impatient PMCs */
+ /*
+ * GC blocking
+ */
+ UINTVAL gc_mark_block_level; /* How many outstanding GC block
+ requests are there? */
+ UINTVAL gc_sweep_block_level; /* How many outstanding GC block
+ requests are there? */
+ /*
+ * private data for the GC subsystem
+ */
+ void * gc_private; /* gc subsystem data */
+} Arenas;
+
/* HEADERIZER BEGIN: src/gc/system.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
Modified: branches/gc_api/src/interp/inter_create.c
==============================================================================
--- branches/gc_api/src/interp/inter_create.c Sat May 9 13:58:32 2009 (r38642)
+++ branches/gc_api/src/interp/inter_create.c Sat May 9 14:03:59 2009 (r38643)
@@ -334,8 +334,7 @@
* Need to turn off GC blocking, else things stay alive and IO
* handles aren't closed
*/
- interp->arena_base->gc_mark_block_level = 0;
- interp->arena_base->gc_sweep_block_level = 0;
+ Parrot_gc_completely_unblock(interp);
if (Interp_trace_TEST(interp, ~0)) {
Parrot_io_eprintf(interp, "FileHandle objects (like stdout and stderr)"
@@ -388,8 +387,7 @@
Parrot_gc_merge_header_pools(interp->parent_interpreter, interp);
}
- if (interp->arena_base->finalize_gc_system)
- interp->arena_base->finalize_gc_system(interp);
+ Parrot_gc_finalize(interp);
/* MMD cache */
Parrot_mmd_cache_destroy(interp, interp->op_mmd_cache);
Modified: branches/gc_api/src/interp/inter_misc.c
==============================================================================
--- branches/gc_api/src/interp/inter_misc.c Sat May 9 13:58:32 2009 (r38642)
+++ branches/gc_api/src/interp/inter_misc.c Sat May 9 14:03:59 2009 (r38643)
@@ -211,7 +211,6 @@
ASSERT_ARGS(interpinfo)
INTVAL ret = 0;
int j;
- Arenas *arena_base = interp->arena_base;
switch (what) {
case TOTAL_MEM_ALLOC:
@@ -220,7 +219,7 @@
interp->memory_allocated = mallinfo().uordblks;
# endif
#endif
- ret = arena_base->memory_allocated;
+ ret = Parrot_gc_total_memory_allocated(interp);
break;
case GC_MARK_RUNS:
ret = Parrot_gc_count_mark_runs(interp);
@@ -244,19 +243,19 @@
ret = Parrot_gc_total_sized_buffers(interp);
break;
case HEADER_ALLOCS_SINCE_COLLECT:
- ret = arena_base->header_allocs_since_last_collect;
+ ret = Parrot_gc_headers_alloc_since_last_collect(interp);
break;
case MEM_ALLOCS_SINCE_COLLECT:
- ret = arena_base->mem_allocs_since_last_collect;
+ ret = Parrot_gc_mem_alloc_since_last_collect(interp);
break;
case TOTAL_COPIED:
- ret = arena_base->memory_collected;
+ ret = Parrot_gc_total_copied(interp);
break;
case IMPATIENT_PMCS:
- ret = arena_base->num_early_gc_PMCs;
+ ret = Parrot_gc_impatient_pmcs(interp);
break;
case EXTENDED_PMCS:
- ret = arena_base->num_extended_PMCs;
+ ret = Parrot_gc_extended_pmcs(interp);
break;
case CURRENT_RUNCORE:
ret = interp->run_core;
Modified: branches/gc_api/src/list.c
==============================================================================
--- branches/gc_api/src/list.c Sat May 9 13:58:32 2009 (r38642)
+++ branches/gc_api/src/list.c Sat May 9 14:03:59 2009 (r38643)
@@ -594,7 +594,7 @@
/* allocate a new chunk_list buffer, if old one has moved or is too small */
len = list->n_chunks;
- if (list->collect_runs != interp->arena_base->gc_collect_runs ||
+ if (list->collect_runs != Parrot_gc_count_collect_runs(interp) ||
len > chunk_list_size(list)) {
/* round up to reasonable size */
len = 1 << (ld(len) + 1);
@@ -605,7 +605,7 @@
if (list->container) {
GC_WRITE_BARRIER(interp, list->container, 0, list);
}
- list->collect_runs = interp->arena_base->gc_collect_runs;
+ list->collect_runs = Parrot_gc_count_collect_runs(interp);
}
/* reset type, actual state of chunks will show, what we really have */
@@ -937,7 +937,7 @@
UINTVAL i;
#ifndef GC_IS_MALLOC
- if (list->collect_runs != interp->arena_base->gc_collect_runs)
+ if (list->collect_runs != Parrot_gc_count_collect_runs(interp))
rebuild_chunk_list(interp, list);
#endif
#ifdef SLOW_AND_BORING
Modified: branches/gc_api/src/ops/core.ops
==============================================================================
--- branches/gc_api/src/ops/core.ops Sat May 9 13:58:32 2009 (r38642)
+++ branches/gc_api/src/ops/core.ops Sat May 9 14:03:59 2009 (r38643)
@@ -1247,7 +1247,7 @@
if ($1)
Parrot_gc_mark_and_sweep(interp, 0);
else
- if (interp->arena_base->num_early_gc_PMCs)
+ if (Parrot_gc_impatient_pmcs(interp))
Parrot_gc_mark_and_sweep(interp, GC_lazy_FLAG);
}
@@ -1309,8 +1309,7 @@
=cut
op needs_destroy(invar PMC) {
- PObj_needs_early_gc_SET($1);
- ++interp->arena_base->num_early_gc_PMCs;
+ Parrot_gc_pmc_needs_early_collection(interp, $1);
}
=back
Modified: branches/gc_api/src/thread.c
==============================================================================
--- branches/gc_api/src/thread.c Sat May 9 13:58:32 2009 (r38642)
+++ branches/gc_api/src/thread.c Sat May 9 14:03:59 2009 (r38643)
@@ -1260,7 +1260,7 @@
{
ASSERT_ARGS(pt_suspend_self_for_gc)
PARROT_ASSERT(interp);
- PARROT_ASSERT(!interp->arena_base->gc_mark_block_level);
+ PARROT_ASSERT(!Parrot_is_blocked_GC_mark(interp));
DEBUG_ONLY(fprintf(stderr, "%p: suspend_self_for_gc\n", interp));
/* since we are modifying our own state, we need to lock
* the interpreter_array_mutex.
More information about the parrot-commits
mailing list