diff --git a/src/array.c b/src/array.c index 83790c34f45986adf1003a25732c0e1ede2cfcb9..2c815a7256e617ddd8671db20140a6c8fa7e0651 100644 --- a/src/array.c +++ b/src/array.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: array.c,v 1.133 2002/12/01 00:16:54 mast Exp $ +|| $Id: array.c,v 1.134 2003/01/11 00:01:20 mast Exp $ */ #include "global.h" @@ -25,7 +25,7 @@ #include "bignum.h" #include "cyclic.h" -RCSID("$Id: array.c,v 1.133 2002/12/01 00:16:54 mast Exp $"); +RCSID("$Id: array.c,v 1.134 2003/01/11 00:01:20 mast Exp $"); PMOD_EXPORT struct array empty_array= { @@ -86,7 +86,7 @@ PMOD_EXPORT struct array *low_allocate_array(ptrdiff_t size, ptrdiff_t extra_spa Pike_error("Couldn't allocate array, out of memory.\n"); GC_ALLOC(v); - + /* for now, we don't know what will go in here */ v->type_field=BIT_MIXED | BIT_UNFINISHED; @@ -2244,9 +2244,10 @@ void gc_zap_ext_weak_refs_in_arrays(void) discard_queue(&gc_mark_queue); } -void gc_free_all_unreferenced_arrays(void) +size_t gc_free_all_unreferenced_arrays(void) { struct array *a,*next; + size_t freed = 0; for (a = gc_internal_array; a != &weak_empty_array; a = next) { @@ -2262,12 +2263,15 @@ void gc_free_all_unreferenced_arrays(void) gc_free_extra_ref(a); SET_NEXT_AND_FREE(a, free_array); + freed++; } else { next=a->next; } } + + return freed; } diff --git a/src/array.h b/src/array.h index d99788dfd8a8496be876cda826ff2662d3d42bc8..b18bcf7e08fc40c82ccf1307ac26745f3885359c 100644 --- a/src/array.h +++ b/src/array.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: array.h,v 1.44 2002/10/11 01:39:28 nilsson Exp $ +|| $Id: array.h,v 1.45 2003/01/11 00:01:20 mast Exp $ */ #ifndef ARRAY_H @@ -171,7 +171,7 @@ void gc_check_all_arrays(void); void gc_mark_all_arrays(void); void gc_cycle_check_all_arrays(void); void gc_zap_ext_weak_refs_in_arrays(void); -void gc_free_all_unreferenced_arrays(void); +size_t gc_free_all_unreferenced_arrays(void); void debug_dump_type_field(TYPE_FIELD t); void debug_dump_array(struct array *a); void zap_all_arrays(void); diff --git a/src/mapping.c b/src/mapping.c index 4fd5d5039feb40fa210de7ef288e83708bbfa845..5d69878588e87449aeb65957e25ea2b221720d40 100644 --- a/src/mapping.c +++ b/src/mapping.c @@ -2,11 +2,11 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: mapping.c,v 1.159 2003/01/10 12:49:03 grubba Exp $ +|| $Id: mapping.c,v 1.160 2003/01/11 00:01:20 mast Exp $ */ #include "global.h" -RCSID("$Id: mapping.c,v 1.159 2003/01/10 12:49:03 grubba Exp $"); +RCSID("$Id: mapping.c,v 1.160 2003/01/11 00:01:20 mast Exp $"); #include "main.h" #include "object.h" #include "mapping.h" @@ -2392,10 +2392,11 @@ void gc_zap_ext_weak_refs_in_mappings(void) discard_queue(&gc_mark_queue); } -void gc_free_all_unreferenced_mappings(void) +size_t gc_free_all_unreferenced_mappings(void) { struct mapping *m,*next; struct mapping_data *md; + size_t freed = 0; for(m=gc_internal_mapping;m;m=next) { @@ -2420,12 +2421,15 @@ void gc_free_all_unreferenced_mappings(void) #endif gc_free_extra_ref(m); SET_NEXT_AND_FREE(m, free_mapping); + freed++; } else { next=m->next; } } + + return freed; } #ifdef PIKE_DEBUG diff --git a/src/mapping.h b/src/mapping.h index e6172b469e4fbab6ae910e039b5eb5645fb464c0..72599b24cd3f021f5bbea359009d090b0e47d31a 100644 --- a/src/mapping.h +++ b/src/mapping.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: mapping.h,v 1.47 2003/01/10 12:49:03 grubba Exp $ +|| $Id: mapping.h,v 1.48 2003/01/11 00:01:20 mast Exp $ */ #ifndef MAPPING_H @@ -173,7 +173,7 @@ void gc_check_all_mappings(void); void gc_mark_all_mappings(void); void gc_cycle_check_all_mappings(void); void gc_zap_ext_weak_refs_in_mappings(void); -void gc_free_all_unreferenced_mappings(void); +size_t gc_free_all_unreferenced_mappings(void); void simple_describe_mapping(struct mapping *m); void debug_dump_mapping(struct mapping *m); void zap_all_mappings(void); diff --git a/src/multiset.c b/src/multiset.c index 60a204bcd5e12d57c0ee6d264dd6ba33382d8f8c..a953a3eba7e83b7ddadd741c14afab54ae4e5317 100644 --- a/src/multiset.c +++ b/src/multiset.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: multiset.c,v 1.65 2003/01/09 15:21:27 grubba Exp $ +|| $Id: multiset.c,v 1.66 2003/01/11 00:01:20 mast Exp $ */ #include "global.h" @@ -14,7 +14,7 @@ * Created by Martin Stjernholm 2001-05-07 */ -RCSID("$Id: multiset.c,v 1.65 2003/01/09 15:21:27 grubba Exp $"); +RCSID("$Id: multiset.c,v 1.66 2003/01/11 00:01:20 mast Exp $"); #include "builtin_functions.h" #include "gc.h" @@ -4122,9 +4122,10 @@ void gc_zap_ext_weak_refs_in_multisets (void) discard_queue (&gc_mark_queue); } -void gc_free_all_unreferenced_multisets (void) +size_t gc_free_all_unreferenced_multisets (void) { struct multiset *l, *next; + size_t freed = 0; for (l = gc_internal_multiset; l; l = next) { if (gc_do_free (l)) { @@ -4137,9 +4138,12 @@ void gc_free_all_unreferenced_multisets (void) } gc_free_extra_ref (l); SET_NEXT_AND_FREE (l, free_multiset); + freed++; } else next = l->next; } + + return freed; } void init_multiset() @@ -5277,7 +5281,7 @@ void test_multiset (void) #include "gc.h" #include "security.h" -RCSID("$Id: multiset.c,v 1.65 2003/01/09 15:21:27 grubba Exp $"); +RCSID("$Id: multiset.c,v 1.66 2003/01/11 00:01:20 mast Exp $"); struct multiset *first_multiset; @@ -5669,9 +5673,10 @@ void gc_cycle_check_all_multisets(void) } } -void gc_free_all_unreferenced_multisets(void) +size_t gc_free_all_unreferenced_multisets(void) { struct multiset *l,*next; + size_t freed = 0; for(l=gc_internal_multiset;l;l=next) { @@ -5683,10 +5688,13 @@ void gc_free_all_unreferenced_multisets(void) gc_free_extra_ref(l); SET_NEXT_AND_FREE(l, free_multiset); + freed++; }else{ next=l->next; } } + + return freed; } void count_memory_in_multisets(INT32 *num_, INT32 *size_) diff --git a/src/multiset.h b/src/multiset.h index ac7d5108840bdcf255abac3459c001d5710e228d..84b0fa5706c023d6b6c4855268af5dd7a08f7e99 100644 --- a/src/multiset.h +++ b/src/multiset.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: multiset.h,v 1.30 2002/12/22 17:18:55 mast Exp $ +|| $Id: multiset.h,v 1.31 2003/01/11 00:01:20 mast Exp $ */ #ifndef MULTISET_H @@ -420,7 +420,7 @@ void gc_mark_all_multisets (void); void gc_zap_ext_weak_refs_in_multisets (void); void real_gc_cycle_check_multiset (struct multiset *l, int weak); void gc_cycle_check_all_multisets (void); -void gc_free_all_unreferenced_multisets (void); +size_t gc_free_all_unreferenced_multisets (void); #define gc_cycle_check_multiset(X, WEAK) \ gc_cycle_enqueue ((gc_cycle_check_cb *) real_gc_cycle_check_multiset, (X), (WEAK)) @@ -488,7 +488,7 @@ unsigned gc_touch_all_multisets(void); void gc_check_all_multisets(void); void gc_mark_all_multisets(void); void gc_cycle_check_all_multisets(void); -void gc_free_all_unreferenced_multisets(void); +size_t gc_free_all_unreferenced_multisets(void); void count_memory_in_multisets(INT32 *num_, INT32 *size_); int multiset_is_constant(struct multiset *m, struct processing *p); diff --git a/src/object.c b/src/object.c index 7968eb250b0e33f9845a70b662eb6f01ef69186f..ce35e72332be0a08b0558060134ba80f8bd0c237 100644 --- a/src/object.c +++ b/src/object.c @@ -2,11 +2,11 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: object.c,v 1.215 2002/12/20 19:07:27 grubba Exp $ +|| $Id: object.c,v 1.216 2003/01/11 00:01:20 mast Exp $ */ #include "global.h" -RCSID("$Id: object.c,v 1.215 2002/12/20 19:07:27 grubba Exp $"); +RCSID("$Id: object.c,v 1.216 2003/01/11 00:01:20 mast Exp $"); #include "object.h" #include "dynamic_buffer.h" #include "interpret.h" @@ -1723,9 +1723,10 @@ void gc_zap_ext_weak_refs_in_objects(void) discard_queue(&gc_mark_queue); } -void gc_free_all_unreferenced_objects(void) +size_t gc_free_all_unreferenced_objects(void) { struct object *o,*next; + size_t freed = 0; for(o=gc_internal_object; o; o=next) { @@ -1742,10 +1743,13 @@ void gc_free_all_unreferenced_objects(void) gc_free_extra_ref(o); SET_NEXT_AND_FREE(o,free_object); + freed++; }else{ next=o->next; } } + + return freed; } struct magic_index_struct diff --git a/src/object.h b/src/object.h index 80c8b4d535224b6a17664e0910dcc520aab89512..906b3557378fdd415c780a11b40776e1c5dd0a9e 100644 --- a/src/object.h +++ b/src/object.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: object.h,v 1.75 2002/11/24 22:47:06 mast Exp $ +|| $Id: object.h,v 1.76 2003/01/11 00:01:20 mast Exp $ */ #ifndef OBJECT_H @@ -109,7 +109,7 @@ void gc_check_all_objects(void); void gc_mark_all_objects(void); void gc_cycle_check_all_objects(void); void gc_zap_ext_weak_refs_in_objects(void); -void gc_free_all_unreferenced_objects(void); +size_t gc_free_all_unreferenced_objects(void); struct magic_index_struct; void push_magic_index(struct program *type, int inherit_no, int parent_level); void init_object(void); diff --git a/src/program.c b/src/program.c index 636da5d2a0fc6bff6036803a62fe4277fbbacb4a..3670bb466e2b0ec2f135a5aa0bfdbb0cf583e06c 100644 --- a/src/program.c +++ b/src/program.c @@ -2,11 +2,11 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: program.c,v 1.471 2003/01/09 18:59:00 grubba Exp $ +|| $Id: program.c,v 1.472 2003/01/11 00:01:20 mast Exp $ */ #include "global.h" -RCSID("$Id: program.c,v 1.471 2003/01/09 18:59:00 grubba Exp $"); +RCSID("$Id: program.c,v 1.472 2003/01/11 00:01:20 mast Exp $"); #include "program.h" #include "object.h" #include "dynamic_buffer.h" @@ -6234,7 +6234,7 @@ static void gc_recurse_trampoline(struct object *o) } -/* This placeholder should is used +/* This placeholder should be used * in the first compiler pass to take the place * of unknown things */ @@ -6568,9 +6568,10 @@ void gc_zap_ext_weak_refs_in_programs(void) discard_queue(&gc_mark_queue); } -void gc_free_all_unreferenced_programs(void) +size_t gc_free_all_unreferenced_programs(void) { struct program *p,*next; + size_t freed = 0; #ifdef PIKE_DEBUG int first = 1; #endif @@ -6610,6 +6611,7 @@ void gc_free_all_unreferenced_programs(void) gc_free_extra_ref(p); SET_NEXT_AND_FREE(p, free_program); + freed++; #ifdef PIKE_DEBUG if (first) gc_internal_program = next; #endif @@ -6636,6 +6638,8 @@ void gc_free_all_unreferenced_programs(void) gc_fatal(p, 1 ,"garbage collector failed to free program!!!\n"); } #endif + + return freed; } #endif /* GC2 */ diff --git a/src/program.h b/src/program.h index 6c051149b07993e3fbf69e78a0695b739046ea3f..c547580df5cae12b6ee5cf981aa0099a03566860 100644 --- a/src/program.h +++ b/src/program.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: program.h,v 1.171 2002/12/16 14:32:21 grubba Exp $ +|| $Id: program.h,v 1.172 2003/01/11 00:01:21 mast Exp $ */ #ifndef PROGRAM_H @@ -630,7 +630,7 @@ void gc_check_all_programs(void); void gc_mark_all_programs(void); void gc_cycle_check_all_programs(void); void gc_zap_ext_weak_refs_in_programs(void); -void gc_free_all_unreferenced_programs(void); +size_t gc_free_all_unreferenced_programs(void); void push_compiler_frame(int lexical_scope); void low_pop_local_variables(int level); void pop_local_variables(int level);