I'm sorry, this new weapon is going to give a quick advantage to the fools
side, but luckily, should help the fool-proofers in the long run.
Below patch should be safe to apply, as it does nothing. Turn on GC_DEBUG
if you want to see the hell that ensues. I'm working on a patch to fix the
issues that this causes, but am posting this now so that it can be applied
separately (or should it go as one big lump?)
On a related note, is it possible to make a 'make tinder' and 'make
tindertest' ? These would have things like GC_DEBUG turned on, which makes
Parrot run much slower, but is also more likely to expose problems in
Parrot. Is this a good idea, or would the possibility for divergance
between regular parrot and tinderbox parrot be too great? I'm not much of
a makefile hacker, so it'd be nice if someone else wanted to do this.
Mike Lambert
Index: resources.c
===================================================================
RCS file: /cvs/public/parrot/resources.c,v
retrieving revision 1.37
diff -u -r1.37 resources.c
--- resources.c 30 Mar 2002 05:57:32 -0000 1.37
+++ resources.c 31 Mar 2002 12:32:09 -0000
@@ -35,6 +35,9 @@
pool->pool_buffer.buflen = (UINTVAL)(pool->pool_buffer.buflen * 1.2);
}
+#ifdef GC_DEBUG
+ Parrot_go_collect(interpreter);
+#endif
/* Okay, so there's space. Add the header on */
((PMC *)to_add)->flags = PMC_on_free_list_FLAG;
@@ -119,6 +122,11 @@
if (!interpreter->arena_base->pmc_pool->entries_in_pool) {
alloc_more_pmc_headers(interpreter);
}
+#ifdef GC_DEBUG
+ else {
+ Parrot_do_dod_run(interpreter);
+ }
+#endif
{
/* A stupid temp variable. Our pointer into the pool */
@@ -221,6 +229,11 @@
if (!interpreter->arena_base->buffer_header_pool->entries_in_pool) {
alloc_more_buffer_headers(interpreter);
}
+#ifdef GC_DEBUG
+ else {
+ Parrot_do_dod_run(interpreter);
+ }
+#endif
/* Okay, we do this the long, drawn-out, hard way. Otherwise I get
really confused and things crash. This, generally, is a Bad
@@ -280,6 +293,9 @@
pool->pool_buffer.buflen = (UINTVAL)(pool->pool_buffer.buflen * 1.2);
}
+#ifdef GC_DEBUG
+ Parrot_go_collect(interpreter);
+#endif
/* Okay, so there's space. Add the header on */
((Buffer *)to_add)->flags = BUFFER_on_free_list_FLAG;
@@ -635,6 +651,11 @@
if (!interpreter->arena_base->string_header_pool->entries_in_pool) {
alloc_more_string_headers(interpreter);
}
+#ifdef GC_DEBUG
+ else {
+ Parrot_do_dod_run(interpreter);
+ }
+#endif
/* Okay, we do this the long, drawn-out, hard way. Otherwise I get
really confused and things crash. This, generally, is a Bad
@@ -841,6 +862,9 @@
if (NULL == interpreter) {
return mem_sys_allocate(size);
}
+#ifdef GC_DEBUG
+ Parrot_go_collect(interpreter);
+#endif
/* Make sure we round up to a multiple of 16 */
size += 16;