[svn:parrot] r47175 - branches/gc_massacre/src/gc
bacek at svn.parrot.org
bacek at svn.parrot.org
Sun May 30 22:50:10 UTC 2010
Author: bacek
Date: Sun May 30 22:50:10 2010
New Revision: 47175
URL: https://trac.parrot.org/parrot/changeset/47175
Log:
Made Memory_Pools optional during gc_mark_root
Modified:
branches/gc_massacre/src/gc/gc_private.h
branches/gc_massacre/src/gc/mark_sweep.c
branches/gc_massacre/src/gc/system.c
Modified: branches/gc_massacre/src/gc/gc_private.h
==============================================================================
--- branches/gc_massacre/src/gc/gc_private.h Sun May 30 22:39:53 2010 (r47174)
+++ branches/gc_massacre/src/gc/gc_private.h Sun May 30 22:50:10 2010 (r47175)
@@ -320,13 +320,12 @@
/* HEADERIZER BEGIN: src/gc/system.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-void trace_system_areas(PARROT_INTERP, ARGIN(const Memory_Pools *mem_pools))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
+void trace_system_areas(PARROT_INTERP,
+ ARGIN_NULLOK(const Memory_Pools *mem_pools))
+ __attribute__nonnull__(1);
#define ASSERT_ARGS_trace_system_areas __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(mem_pools))
+ PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/gc/system.c */
@@ -413,10 +412,9 @@
FUNC_MODIFIES(*pool);
int Parrot_gc_trace_root(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD_NULLOK(Memory_Pools *mem_pools),
Parrot_gc_trace_type trace)
__attribute__nonnull__(1)
- __attribute__nonnull__(2)
FUNC_MODIFIES(*mem_pools);
#define ASSERT_ARGS_contained_in_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -452,8 +450,7 @@
, PARROT_ASSERT_ARG(mem_pools) \
, PARROT_ASSERT_ARG(pool))
#define ASSERT_ARGS_Parrot_gc_trace_root __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(mem_pools))
+ PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/gc/mark_sweep.c */
Modified: branches/gc_massacre/src/gc/mark_sweep.c
==============================================================================
--- branches/gc_massacre/src/gc/mark_sweep.c Sun May 30 22:39:53 2010 (r47174)
+++ branches/gc_massacre/src/gc/mark_sweep.c Sun May 30 22:50:10 2010 (r47175)
@@ -154,7 +154,7 @@
int
Parrot_gc_trace_root(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD_NULLOK(Memory_Pools *mem_pools),
Parrot_gc_trace_type trace)
{
ASSERT_ARGS(Parrot_gc_trace_root)
@@ -169,7 +169,7 @@
}
/* We have to start somewhere; the interpreter globals is a good place */
- if (!mem_pools->gc_mark_start) {
+ if (mem_pools && !mem_pools->gc_mark_start) {
mem_pools->gc_mark_start
= mem_pools->gc_mark_ptr
= interp->iglobals;
@@ -228,8 +228,9 @@
/* quick check to see if we have already marked all impatient PMCs. If we
have, return 0 and exit here. This will alert other parts of the GC
that if we are in a lazy run we can just stop it. */
- if (mem_pools->lazy_gc
- && mem_pools->num_early_PMCs_seen >= mem_pools->num_early_gc_PMCs)
+ if (mem_pools
+ && mem_pools->lazy_gc
+ && mem_pools->num_early_PMCs_seen >= mem_pools->num_early_gc_PMCs)
return 0;
return 1;
Modified: branches/gc_massacre/src/gc/system.c
==============================================================================
--- branches/gc_massacre/src/gc/system.c Sun May 30 22:39:53 2010 (r47174)
+++ branches/gc_massacre/src/gc/system.c Sun May 30 22:50:10 2010 (r47175)
@@ -39,20 +39,20 @@
__attribute__nonnull__(1);
PARROT_WARN_UNUSED_RESULT
-static size_t get_max_buffer_address(ARGIN(const Memory_Pools *mem_pools))
- __attribute__nonnull__(1);
+static size_t get_max_buffer_address(
+ ARGIN_NULLOK(const Memory_Pools *mem_pools));
PARROT_WARN_UNUSED_RESULT
-static size_t get_max_pmc_address(ARGIN(const Memory_Pools *mem_pools))
- __attribute__nonnull__(1);
+static size_t get_max_pmc_address(
+ ARGIN_NULLOK(const Memory_Pools *mem_pools));
PARROT_WARN_UNUSED_RESULT
-static size_t get_min_buffer_address(ARGIN(const Memory_Pools *mem_pools))
- __attribute__nonnull__(1);
+static size_t get_min_buffer_address(
+ ARGIN_NULLOK(const Memory_Pools *mem_pools));
PARROT_WARN_UNUSED_RESULT
-static size_t get_min_pmc_address(ARGIN(const Memory_Pools *mem_pools))
- __attribute__nonnull__(1);
+static size_t get_min_pmc_address(
+ ARGIN_NULLOK(const Memory_Pools *mem_pools));
PARROT_WARN_UNUSED_RESULT
static int is_buffer_ptr(
@@ -69,11 +69,10 @@
__attribute__nonnull__(2);
static void trace_mem_block(PARROT_INTERP,
- ARGIN(const Memory_Pools *mem_pools),
+ ARGIN_NULLOK(const Memory_Pools *mem_pools),
size_t lo_var_ptr,
size_t hi_var_ptr)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
+ __attribute__nonnull__(1);
static void trace_system_stack(PARROT_INTERP,
ARGIN(const Memory_Pools *mem_pools))
@@ -82,14 +81,10 @@
#define ASSERT_ARGS_find_common_mask __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_get_max_buffer_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools))
-#define ASSERT_ARGS_get_max_pmc_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools))
-#define ASSERT_ARGS_get_min_buffer_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools))
-#define ASSERT_ARGS_get_min_pmc_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools))
+#define ASSERT_ARGS_get_max_buffer_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_get_max_pmc_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_get_min_buffer_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_get_min_pmc_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_is_buffer_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(mem_pools) \
, PARROT_ASSERT_ARG(ptr))
@@ -97,8 +92,7 @@
PARROT_ASSERT_ARG(mem_pools) \
, PARROT_ASSERT_ARG(ptr))
#define ASSERT_ARGS_trace_mem_block __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(mem_pools))
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_trace_system_stack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(mem_pools))
@@ -120,7 +114,7 @@
*/
void
-trace_system_areas(PARROT_INTERP, ARGIN(const Memory_Pools *mem_pools))
+trace_system_areas(PARROT_INTERP, ARGIN_NULLOK(const Memory_Pools *mem_pools))
{
ASSERT_ARGS(trace_system_areas)
{
@@ -271,12 +265,15 @@
PARROT_WARN_UNUSED_RESULT
static size_t
-get_max_buffer_address(ARGIN(const Memory_Pools *mem_pools))
+get_max_buffer_address(ARGIN_NULLOK(const Memory_Pools *mem_pools))
{
ASSERT_ARGS(get_max_buffer_address)
size_t max = 0;
UINTVAL i;
+ if (!mem_pools)
+ return -1;
+
for (i = 0; i < mem_pools->num_sized; ++i) {
if (mem_pools->sized_header_pools[i]) {
if (mem_pools->sized_header_pools[i]->end_arena_memory > max)
@@ -305,12 +302,15 @@
PARROT_WARN_UNUSED_RESULT
static size_t
-get_min_buffer_address(ARGIN(const Memory_Pools *mem_pools))
+get_min_buffer_address(ARGIN_NULLOK(const Memory_Pools *mem_pools))
{
ASSERT_ARGS(get_min_buffer_address)
- size_t min = (size_t) -1;
+ size_t min = (size_t) 0;
UINTVAL i;
+ if (!mem_pools)
+ return 0;
+
for (i = 0; i < mem_pools->num_sized; ++i) {
const Fixed_Size_Pool * const pool = mem_pools->sized_header_pools[i];
if (pool && pool->start_arena_memory) {
@@ -335,10 +335,12 @@
PARROT_WARN_UNUSED_RESULT
static size_t
-get_max_pmc_address(ARGIN(const Memory_Pools *mem_pools))
+get_max_pmc_address(ARGIN_NULLOK(const Memory_Pools *mem_pools))
{
ASSERT_ARGS(get_max_pmc_address)
- return mem_pools->pmc_pool->end_arena_memory;
+ return mem_pools
+ ? mem_pools->pmc_pool->end_arena_memory
+ : -1;
}
@@ -356,10 +358,12 @@
PARROT_WARN_UNUSED_RESULT
static size_t
-get_min_pmc_address(ARGIN(const Memory_Pools *mem_pools))
+get_min_pmc_address(ARGIN_NULLOK(const Memory_Pools *mem_pools))
{
ASSERT_ARGS(get_min_pmc_address)
- return mem_pools->pmc_pool->start_arena_memory;
+ return mem_pools
+ ? mem_pools->pmc_pool->start_arena_memory
+ : 0;
}
@@ -420,17 +424,17 @@
static void
trace_mem_block(PARROT_INTERP,
- ARGIN(const Memory_Pools *mem_pools),
+ ARGIN_NULLOK(const Memory_Pools *mem_pools),
size_t lo_var_ptr, size_t hi_var_ptr)
{
ASSERT_ARGS(trace_mem_block)
size_t prefix;
ptrdiff_t cur_var_ptr;
- const size_t buffer_min = 0; // get_min_buffer_address(mem_pools);
- const size_t buffer_max = -1; // get_max_buffer_address(mem_pools);
- const size_t pmc_min = 0; // get_min_pmc_address(mem_pools);
- const size_t pmc_max = -1; // get_max_pmc_address(mem_pools);
+ const size_t buffer_min = get_min_buffer_address(mem_pools);
+ const size_t buffer_max = get_max_buffer_address(mem_pools);
+ const size_t pmc_min = get_min_pmc_address(mem_pools);
+ const size_t pmc_max = get_max_pmc_address(mem_pools);
const size_t mask =
find_common_mask(interp,
More information about the parrot-commits
mailing list