# New Ticket Created by Steve Fink # Please include the string: [perl #16857] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=16857 >
Small cleanups, but also a piece of my attempted fixes to the BUFFER_external_FLAG. (The CVS version currently doesn't work anyway, so don't worry about only getting parts of my fixes in; nothing depends on it.) -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/36048/29172/84a80b/dod-nits.patch
Index: dod.c =================================================================== RCS file: /cvs/public/parrot/dod.c,v retrieving revision 1.21 diff -p -u -r1.21 dod.c --- dod.c 23 Aug 2002 07:53:35 -0000 1.21 +++ dod.c 29 Aug 2002 20:16:20 -0000 @@ -274,6 +274,13 @@ trace_active_buffers(struct Parrot_Inter } } +static int +pmc_freeable(UINTVAL flags) +{ + UINTVAL mask = PMC_live_FLAG | PMC_on_free_list_FLAG | PMC_constant_FLAG; + return !(flags & mask); +} + /* Free up any PMCs that aren't in use */ static void free_unused_PMCs(struct Parrot_Interp *interpreter) @@ -291,11 +298,10 @@ free_unused_PMCs(struct Parrot_Interp *i * Note that it is technically possible to have a PMC be both * on_free_list and live, because of our conservative stack-walk * collection. We must be wary of this case. */ - if (!(pmc_array[i].flags & (PMC_live_FLAG | PMC_on_free_list_FLAG | - PMC_constant_FLAG))) { + if (pmc_freeable(pmc_array[i].flags)) { add_free_pmc(interpreter, - interpreter->arena_base->pmc_pool, - &pmc_array[i]); + interpreter->arena_base->pmc_pool, + &pmc_array[i]); } else if(!(pmc_array[i].flags & PMC_on_free_list_FLAG)) { total_used++; pmc_array[i].flags &= ~PMC_live_FLAG; @@ -308,6 +314,16 @@ free_unused_PMCs(struct Parrot_Interp *i interpreter->arena_base->pmc_pool->total_objects - total_used; } +static int +buffer_freeable(UINTVAL flags) +{ + UINTVAL mask = BUFFER_on_free_list_FLAG + | BUFFER_constant_FLAG + | BUFFER_live_FLAG + | BUFFER_external_FLAG; + return !(flags & mask); +} + /* Put any buffers that are now unused, on to the free list * Avoid buffers that are immune from collection (ie, constant) */ static void @@ -328,10 +344,7 @@ free_unused_buffers(struct Parrot_Interp * Note that it is technically possible to have a Buffer be both * on_free_list and live, because of our conservative stack-walk * collection. We must be wary of this case. */ - if (!(b->flags & ( BUFFER_on_free_list_FLAG - | BUFFER_constant_FLAG - | BUFFER_live_FLAG ))) - { + if (buffer_freeable(b->flags)) { if (pool->mem_pool) { if (!(b->flags & BUFFER_COW_FLAG)) { ((struct Memory_Pool *)