aboutsummaryrefslogtreecommitdiff
path: root/boehm-gc/reclaim.c
diff options
context:
space:
mode:
authorHans Boehm <hboehm@gcc.gnu.org>2002-03-29 22:52:13 +0000
committerHans Boehm <hboehm@gcc.gnu.org>2002-03-29 22:52:13 +0000
commit4d6ac5424e9c34988954c62da68b39dd5374a095 (patch)
tree4a0636ad329ed8fd9f9e42dd3c0ea29b3c5fb6b2 /boehm-gc/reclaim.c
parent02a566dcf0d6b8055a34e7d771840c43fde3aba5 (diff)
downloadgcc-4d6ac5424e9c34988954c62da68b39dd5374a095.zip
gcc-4d6ac5424e9c34988954c62da68b39dd5374a095.tar.gz
gcc-4d6ac5424e9c34988954c62da68b39dd5374a095.tar.bz2
linux_threads.c (return_free_lists): Clear fl[i] unconditionally.
* linux_threads.c (return_free_lists): Clear fl[i] unconditionally. (GC_local_gcj_malloc): Add assertion. (start_mark_threads): Fix abort message. * mark.c (GC_mark_from): Generalize assertion. * reclaim.c (GC_clear_fl_links): New function. (GC_start_reclaim): Must clear some freelist links. * include/private/specific.h, specific.c: Add assertions. Safer definition for INVALID_QTID, quick_thread_id. Fix/add comments. Rearrange tse fields. From-SVN: r51582
Diffstat (limited to 'boehm-gc/reclaim.c')
-rw-r--r--boehm-gc/reclaim.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/boehm-gc/reclaim.c b/boehm-gc/reclaim.c
index 846215e..0418e9d 100644
--- a/boehm-gc/reclaim.c
+++ b/boehm-gc/reclaim.c
@@ -862,6 +862,25 @@ void GC_print_block_list()
#endif /* NO_DEBUGGING */
/*
+ * Clear all obj_link pointers in the list of free objects *flp.
+ * Clear *flp.
+ * This must be done before dropping a list of free gcj-style objects,
+ * since may otherwise end up with dangling "descriptor" pointers.
+ * It may help for other pointer-containg objects.
+ */
+void GC_clear_fl_links(flp)
+ptr_t *flp;
+{
+ ptr_t next = *flp;
+
+ while (0 != next) {
+ *flp = 0;
+ flp = &(obj_link(next));
+ next = *flp;
+ }
+}
+
+/*
* Perform GC_reclaim_block on the entire heap, after first clearing
* small object free lists (if we are not just looking for leaks).
*/
@@ -875,17 +894,24 @@ int report_if_found; /* Abort if a GC_reclaimable object is found */
# endif
/* Clear reclaim- and free-lists */
for (kind = 0; kind < GC_n_kinds; kind++) {
- register ptr_t *fop;
- register ptr_t *lim;
- register struct hblk ** rlp;
- register struct hblk ** rlim;
- register struct hblk ** rlist = GC_obj_kinds[kind].ok_reclaim_list;
+ ptr_t *fop;
+ ptr_t *lim;
+ struct hblk ** rlp;
+ struct hblk ** rlim;
+ struct hblk ** rlist = GC_obj_kinds[kind].ok_reclaim_list;
+ GC_bool should_clobber = (GC_obj_kinds[kind].ok_descriptor != 0);
if (rlist == 0) continue; /* This kind not used. */
if (!report_if_found) {
lim = &(GC_obj_kinds[kind].ok_freelist[MAXOBJSZ+1]);
for( fop = GC_obj_kinds[kind].ok_freelist; fop < lim; fop++ ) {
- *fop = 0;
+ if (*fop != 0) {
+ if (should_clobber) {
+ GC_clear_fl_links(fop);
+ } else {
+ *fop = 0;
+ }
+ }
}
} /* otherwise free list objects are marked, */
/* and its safe to leave them */