2 * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
3 * Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved.
4 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
5 * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
7 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
10 * Permission is hereby granted to use or copy this program
11 * for any purpose, provided the above notices are retained on all copies.
12 * Permission to modify the code and to distribute modified code is granted,
13 * provided the above notices are retained, and a notice that the code was
14 * modified is included with the above copyright notice.
17 #include "private/gc_priv.h"
19 #ifdef ENABLE_DISCLAIM
20 # include "gc_disclaim.h"
25 GC_INNER signed_word GC_bytes_found = 0;
26 /* Number of bytes of memory reclaimed */
27 /* minus the number of bytes originally */
28 /* on free lists which we had to drop. */
30 #if defined(PARALLEL_MARK)
31 GC_INNER word GC_fl_builder_count = 0;
32 /* Number of threads currently building free lists without */
33 /* holding GC lock. It is not safe to collect if this is */
35 #endif /* PARALLEL_MARK */
37 /* We defer printing of leaked objects until we're done with the GC */
38 /* cycle, since the routine for printing objects needs to run outside */
39 /* the collector, e.g. without the allocation lock. */
41 # define MAX_LEAKED 40
43 STATIC ptr_t GC_leaked[MAX_LEAKED] = { NULL };
44 STATIC unsigned GC_n_leaked = 0;
46 GC_INNER GC_bool GC_have_errors = FALSE;
48 #if !defined(EAGER_SWEEP) && defined(ENABLE_DISCLAIM)
49 STATIC void GC_reclaim_unconditionally_marked(void);
52 GC_INLINE void GC_add_leaked(ptr_t leaked)
54 # ifndef SHORT_DBG_HDRS
55 if (GC_findleak_delay_free && !GC_check_leaked(leaked))
59 GC_have_errors = TRUE;
60 if (GC_n_leaked < MAX_LEAKED) {
61 GC_leaked[GC_n_leaked++] = leaked;
62 /* Make sure it's not reclaimed this cycle */
63 GC_set_mark_bit(leaked);
67 /* Print all objects on the list after printing any smashed objects. */
68 /* Clear both lists. Called without the allocation lock held. */
69 GC_INNER void GC_print_all_errors(void)
71 static GC_bool printing_errors = FALSE;
74 ptr_t leaked[MAX_LEAKED];
78 if (printing_errors) {
82 have_errors = GC_have_errors;
83 printing_errors = TRUE;
84 n_leaked = GC_n_leaked;
85 GC_ASSERT(n_leaked <= MAX_LEAKED);
86 BCOPY(GC_leaked, leaked, n_leaked * sizeof(ptr_t));
88 BZERO(GC_leaked, n_leaked * sizeof(ptr_t));
91 if (GC_debugging_started) {
92 GC_print_all_smashed();
98 GC_err_printf("Found %u leaked objects:\n", n_leaked);
101 for (i = 0; i < n_leaked; i++) {
103 GC_print_heap_obj(p);
108 # ifndef GC_ABORT_ON_LEAK
109 && GETENV("GC_ABORT_ON_LEAK") != NULL
112 ABORT("Leaked or smashed objects encountered");
116 printing_errors = FALSE;
126 /* Test whether a block is completely empty, i.e. contains no marked */
127 /* objects. This does not require the block to be in physical memory. */
128 GC_INNER GC_bool GC_block_empty(hdr *hhdr)
130 return (hhdr -> hb_n_marks == 0);
133 STATIC GC_bool GC_block_nearly_full(hdr *hhdr)
135 return (hhdr -> hb_n_marks > 7 * HBLK_OBJS(hhdr -> hb_sz)/8);
138 /* FIXME: This should perhaps again be specialized for USE_MARK_BYTES */
139 /* and USE_MARK_BITS cases. */
142 * Restore unmarked small objects in h of size sz to the object
143 * free list. Returns the new list.
144 * Clears unmarked objects. Sz is in bytes.
146 STATIC ptr_t GC_reclaim_clear(struct hblk *hbp, hdr *hhdr, size_t sz,
147 ptr_t list, signed_word *count)
151 signed_word n_bytes_found = 0;
153 GC_ASSERT(hhdr == GC_find_header((ptr_t)hbp));
154 GC_ASSERT(sz == hhdr -> hb_sz);
155 GC_ASSERT((sz & (BYTES_PER_WORD-1)) == 0);
156 p = (word *)(hbp->hb_body);
157 plim = (word *)(hbp->hb_body + HBLKSIZE - sz);
159 /* go through all words in block */
160 while ((word)p <= (word)plim) {
161 if (mark_bit_from_hdr(hhdr, bit_no)) {
162 p = (word *)((ptr_t)p + sz);
165 /* object is available - put on list */
168 /* Clear object, advance p to next object in the process */
169 q = (word *)((ptr_t)p + sz);
170 # ifdef USE_MARK_BYTES
172 && !((word)p & (2 * sizeof(word) - 1)));
175 while ((word)p < (word)q) {
180 p++; /* Skip link field */
181 while ((word)p < (word)q) {
186 bit_no += MARK_BIT_OFFSET(sz);
188 *count += n_bytes_found;
192 /* The same thing, but don't clear objects: */
193 STATIC ptr_t GC_reclaim_uninit(struct hblk *hbp, hdr *hhdr, size_t sz,
194 ptr_t list, signed_word *count)
198 signed_word n_bytes_found = 0;
200 GC_ASSERT(sz == hhdr -> hb_sz);
201 p = (word *)(hbp->hb_body);
202 plim = (word *)((ptr_t)hbp + HBLKSIZE - sz);
204 /* go through all words in block */
205 while ((word)p <= (word)plim) {
206 if (!mark_bit_from_hdr(hhdr, bit_no)) {
208 /* object is available - put on list */
212 p = (word *)((ptr_t)p + sz);
213 bit_no += MARK_BIT_OFFSET(sz);
215 *count += n_bytes_found;
219 #ifdef ENABLE_DISCLAIM
220 /* Call reclaim notifier for block's kind on each unmarked object in */
221 /* block, all within a pair of corresponding enter/leave callbacks. */
222 STATIC ptr_t GC_disclaim_and_reclaim(struct hblk *hbp, hdr *hhdr, size_t sz,
223 ptr_t list, signed_word *count)
227 signed_word n_bytes_found = 0;
228 struct obj_kind *ok = &GC_obj_kinds[hhdr->hb_obj_kind];
229 int (GC_CALLBACK *disclaim)(void *) = ok->ok_disclaim_proc;
231 GC_ASSERT(sz == hhdr -> hb_sz);
232 p = (word *)(hbp -> hb_body);
233 plim = (word *)((ptr_t)p + HBLKSIZE - sz);
235 while ((word)p <= (word)plim) {
236 int marked = mark_bit_from_hdr(hhdr, bit_no);
237 if (!marked && (*disclaim)(p)) {
238 hhdr -> hb_n_marks++;
242 p = (word *)((ptr_t)p + sz);
245 /* object is available - put on list */
248 /* Clear object, advance p to next object in the process */
249 q = (word *)((ptr_t)p + sz);
250 # ifdef USE_MARK_BYTES
251 GC_ASSERT((sz & 1) == 0);
252 GC_ASSERT(((word)p & (2 * sizeof(word) - 1)) == 0);
255 while ((word)p < (word)q) {
260 p++; /* Skip link field */
261 while ((word)p < (word)q) {
266 bit_no += MARK_BIT_OFFSET(sz);
268 *count += n_bytes_found;
271 #endif /* ENABLE_DISCLAIM */
273 /* Don't really reclaim objects, just check for unmarked ones: */
274 STATIC void GC_reclaim_check(struct hblk *hbp, hdr *hhdr, word sz)
278 GC_ASSERT(sz == hhdr -> hb_sz);
280 /* go through all words in block */
282 plim = p + HBLKSIZE - sz;
283 for (bit_no = 0; (word)p <= (word)plim;
284 p += sz, bit_no += MARK_BIT_OFFSET(sz)) {
285 if (!mark_bit_from_hdr(hhdr, bit_no)) {
292 * Generic procedure to rebuild a free list in hbp.
293 * Also called directly from GC_malloc_many.
294 * Sz is now in bytes.
296 GC_INNER ptr_t GC_reclaim_generic(struct hblk * hbp, hdr *hhdr, size_t sz,
297 GC_bool init, ptr_t list,
302 GC_ASSERT(GC_find_header((ptr_t)hbp) == hhdr);
303 # ifndef GC_DISABLE_INCREMENTAL
304 GC_remove_protection(hbp, 1, (hhdr)->hb_descr == 0 /* Pointer-free? */);
306 # ifdef ENABLE_DISCLAIM
307 if ((hhdr -> hb_flags & HAS_DISCLAIM) != 0) {
308 result = GC_disclaim_and_reclaim(hbp, hhdr, sz, list, count);
311 /* else */ if (init || GC_debugging_started) {
312 result = GC_reclaim_clear(hbp, hhdr, sz, list, count);
314 GC_ASSERT((hhdr)->hb_descr == 0 /* Pointer-free block */);
315 result = GC_reclaim_uninit(hbp, hhdr, sz, list, count);
317 if (IS_UNCOLLECTABLE(hhdr -> hb_obj_kind)) GC_set_hdr_marks(hhdr);
322 * Restore unmarked small objects in the block pointed to by hbp
323 * to the appropriate object free list.
324 * If entirely empty blocks are to be completely deallocated, then
325 * caller should perform that check.
327 STATIC void GC_reclaim_small_nonempty_block(struct hblk *hbp,
328 GC_bool report_if_found)
330 hdr *hhdr = HDR(hbp);
331 size_t sz = hhdr -> hb_sz;
332 struct obj_kind * ok = &GC_obj_kinds[hhdr -> hb_obj_kind];
333 void **flh = &(ok -> ok_freelist[BYTES_TO_GRANULES(sz)]);
335 hhdr -> hb_last_reclaimed = (unsigned short) GC_gc_no;
337 if (report_if_found) {
338 GC_reclaim_check(hbp, hhdr, sz);
340 *flh = GC_reclaim_generic(hbp, hhdr, sz, ok -> ok_init,
341 *flh, &GC_bytes_found);
345 #ifdef ENABLE_DISCLAIM
346 STATIC void GC_disclaim_and_reclaim_or_free_small_block(struct hblk *hbp)
348 hdr *hhdr = HDR(hbp);
349 size_t sz = hhdr -> hb_sz;
350 struct obj_kind * ok = &GC_obj_kinds[hhdr -> hb_obj_kind];
351 void **flh = &(ok -> ok_freelist[BYTES_TO_GRANULES(sz)]);
354 hhdr -> hb_last_reclaimed = (unsigned short) GC_gc_no;
355 flh_next = GC_reclaim_generic(hbp, hhdr, sz, ok -> ok_init,
356 *flh, &GC_bytes_found);
357 if (hhdr -> hb_n_marks)
360 GC_bytes_found += HBLKSIZE;
364 #endif /* ENABLE_DISCLAIM */
367 * Restore an unmarked large object or an entirely empty blocks of small objects
368 * to the heap block free list.
369 * Otherwise enqueue the block for later processing
370 * by GC_reclaim_small_nonempty_block.
371 * If report_if_found is TRUE, then process any block immediately, and
372 * simply report free objects; do not actually reclaim them.
374 STATIC void GC_reclaim_block(struct hblk *hbp, word report_if_found)
376 hdr * hhdr = HDR(hbp);
377 size_t sz = hhdr -> hb_sz; /* size of objects in current block */
378 struct obj_kind * ok = &GC_obj_kinds[hhdr -> hb_obj_kind];
380 if( sz > MAXOBJBYTES ) { /* 1 big object */
381 if( !mark_bit_from_hdr(hhdr, 0) ) {
382 if (report_if_found) {
383 GC_add_leaked((ptr_t)hbp);
387 # ifdef ENABLE_DISCLAIM
388 if (EXPECT(hhdr->hb_flags & HAS_DISCLAIM, 0)) {
389 struct obj_kind *ok = &GC_obj_kinds[hhdr->hb_obj_kind];
390 if ((*ok->ok_disclaim_proc)(hbp)) {
391 /* Not disclaimed => resurrect the object. */
392 set_mark_bit_from_hdr(hhdr, 0);
397 blocks = OBJ_SZ_TO_BLOCKS(sz);
399 GC_large_allocd_bytes -= blocks * HBLKSIZE;
401 GC_bytes_found += sz;
405 # ifdef ENABLE_DISCLAIM
408 if (hhdr -> hb_descr != 0) {
409 GC_composite_in_use += sz;
411 GC_atomic_in_use += sz;
415 GC_bool empty = GC_block_empty(hhdr);
416 # ifdef PARALLEL_MARK
417 /* Count can be low or one too high because we sometimes */
418 /* have to ignore decrements. Objects can also potentially */
419 /* be repeatedly marked by each marker. */
420 /* Here we assume two markers, but this is extremely */
421 /* unlikely to fail spuriously with more. And if it does, it */
422 /* should be looked at. */
423 GC_ASSERT(hhdr -> hb_n_marks <= 2 * (HBLKSIZE/sz + 1) + 16);
425 GC_ASSERT(sz * hhdr -> hb_n_marks <= HBLKSIZE);
427 if (report_if_found) {
428 GC_reclaim_small_nonempty_block(hbp, TRUE /* report_if_found */);
430 # ifdef ENABLE_DISCLAIM
431 if ((hhdr -> hb_flags & HAS_DISCLAIM) != 0) {
432 GC_disclaim_and_reclaim_or_free_small_block(hbp);
436 GC_bytes_found += HBLKSIZE;
439 } else if (GC_find_leak || !GC_block_nearly_full(hhdr)) {
440 /* group of smaller objects, enqueue the real work */
441 struct hblk **rlh = ok -> ok_reclaim_list + BYTES_TO_GRANULES(sz);
443 hhdr -> hb_next = *rlh;
445 } /* else not worth salvaging. */
446 /* We used to do the nearly_full check later, but we */
447 /* already have the right cache context here. Also */
448 /* doing it here avoids some silly lock contention in */
449 /* GC_malloc_many. */
451 if (hhdr -> hb_descr != 0) {
452 GC_composite_in_use += sz * hhdr -> hb_n_marks;
454 GC_atomic_in_use += sz * hhdr -> hb_n_marks;
459 #if !defined(NO_DEBUGGING)
460 /* Routines to gather and print heap block info */
461 /* intended for debugging. Otherwise should be called */
466 size_t number_of_blocks;
470 #ifdef USE_MARK_BYTES
472 /* Return the number of set mark bits in the given header. */
473 /* Remains externally visible as used by GNU GCJ currently. */
474 int GC_n_set_marks(hdr *hhdr)
478 size_t sz = hhdr -> hb_sz;
479 int offset = (int)MARK_BIT_OFFSET(sz);
480 int limit = (int)FINAL_MARK_BIT(sz);
482 for (i = 0; i < limit; i += offset) {
483 result += hhdr -> hb_marks[i];
485 GC_ASSERT(hhdr -> hb_marks[limit]);
491 /* Number of set bits in a word. Not performance critical. */
492 static int set_bits(word n)
504 int GC_n_set_marks(hdr *hhdr)
509 # ifdef MARK_BIT_PER_OBJ
510 int n_objs = (int)HBLK_OBJS(hhdr -> hb_sz);
512 if (0 == n_objs) n_objs = 1;
513 n_mark_words = divWORDSZ(n_objs + WORDSZ - 1);
514 # else /* MARK_BIT_PER_GRANULE */
515 n_mark_words = MARK_BITS_SZ;
517 for (i = 0; i < n_mark_words - 1; i++) {
518 result += set_bits(hhdr -> hb_marks[i]);
520 # ifdef MARK_BIT_PER_OBJ
521 result += set_bits((hhdr -> hb_marks[n_mark_words - 1])
522 << (n_mark_words * WORDSZ - n_objs));
524 result += set_bits(hhdr -> hb_marks[n_mark_words - 1]);
529 #endif /* !USE_MARK_BYTES */
531 STATIC void GC_print_block_descr(struct hblk *h,
532 word /* struct PrintStats */ raw_ps)
535 size_t bytes = hhdr -> hb_sz;
536 struct Print_stats *ps;
537 unsigned n_marks = GC_n_set_marks(hhdr);
538 unsigned n_objs = HBLK_OBJS((unsigned)bytes);
540 if (0 == n_objs) n_objs = 1;
541 if (hhdr -> hb_n_marks != n_marks) {
542 GC_printf("%u,%u,%u!=%u,%u\n", hhdr->hb_obj_kind, (unsigned)bytes,
543 (unsigned)hhdr->hb_n_marks, n_marks, n_objs);
545 GC_printf("%u,%u,%u,%u\n", hhdr->hb_obj_kind, (unsigned)bytes,
549 ps = (struct Print_stats *)raw_ps;
550 ps->total_bytes += (bytes + (HBLKSIZE-1)) & ~(HBLKSIZE-1); /* round up */
551 ps->number_of_blocks++;
554 void GC_print_block_list(void)
556 struct Print_stats pstats;
558 GC_printf("kind(0=ptrfree,1=normal,2=unc.),"
559 "size_in_bytes,#_marks_set,#objs\n");
560 pstats.number_of_blocks = 0;
561 pstats.total_bytes = 0;
562 GC_apply_to_all_blocks(GC_print_block_descr, (word)&pstats);
563 GC_printf("blocks= %lu, bytes= %lu\n",
564 (unsigned long)pstats.number_of_blocks,
565 (unsigned long)pstats.total_bytes);
568 #include "gc_inline.h" /* for GC_print_free_list prototype */
570 /* Currently for debugger use only: */
571 GC_API void GC_CALL GC_print_free_list(int kind, size_t sz_in_granules)
576 GC_ASSERT(kind < MAXOBJKINDS);
577 GC_ASSERT(sz_in_granules <= MAXOBJGRANULES);
578 flh = GC_obj_kinds[kind].ok_freelist[sz_in_granules];
579 for (n = 0; flh; n++) {
580 struct hblk *block = HBLKPTR(flh);
581 GC_printf("Free object in heap block %p [%d]: %p\n",
582 (void *)block, n, (void *)flh);
587 #endif /* !NO_DEBUGGING */
590 * Clear all obj_link pointers in the list of free objects *flp.
592 * This must be done before dropping a list of free gcj-style objects,
593 * since may otherwise end up with dangling "descriptor" pointers.
594 * It may help for other pointer-containing objects.
596 STATIC void GC_clear_fl_links(void **flp)
602 flp = &(obj_link(next));
608 * Perform GC_reclaim_block on the entire heap, after first clearing
609 * small object free lists (if we are not just looking for leaks).
611 GC_INNER void GC_start_reclaim(GC_bool report_if_found)
615 # if defined(PARALLEL_MARK)
616 GC_ASSERT(0 == GC_fl_builder_count);
618 /* Reset in use counters. GC_reclaim_block recomputes them. */
619 GC_composite_in_use = 0;
620 GC_atomic_in_use = 0;
621 /* Clear reclaim- and free-lists */
622 for (kind = 0; kind < GC_n_kinds; kind++) {
623 struct hblk ** rlist = GC_obj_kinds[kind].ok_reclaim_list;
624 GC_bool should_clobber = (GC_obj_kinds[kind].ok_descriptor != 0);
626 if (rlist == 0) continue; /* This kind not used. */
627 if (!report_if_found) {
629 void **lim = &(GC_obj_kinds[kind].ok_freelist[MAXOBJGRANULES+1]);
631 for (fop = GC_obj_kinds[kind].ok_freelist;
632 (word)fop < (word)lim; (*(word **)&fop)++) {
634 if (should_clobber) {
635 GC_clear_fl_links(fop);
641 } /* otherwise free list objects are marked, */
642 /* and its safe to leave them */
643 BZERO(rlist, (MAXOBJGRANULES + 1) * sizeof(void *));
647 /* Go through all heap blocks (in hblklist) and reclaim unmarked objects */
648 /* or enqueue the block for later processing. */
649 GC_apply_to_all_blocks(GC_reclaim_block, (word)report_if_found);
652 /* This is a very stupid thing to do. We make it possible anyway, */
653 /* so that you can convince yourself that it really is very stupid. */
654 GC_reclaim_all((GC_stop_func)0, FALSE);
655 # elif defined(ENABLE_DISCLAIM)
656 /* However, make sure to clear reclaimable objects of kinds with */
657 /* unconditional marking enabled before we do any significant */
659 GC_reclaim_unconditionally_marked();
661 # if defined(PARALLEL_MARK)
662 GC_ASSERT(0 == GC_fl_builder_count);
668 * Sweep blocks of the indicated object size and kind until either the
669 * appropriate free list is nonempty, or there are no more blocks to
672 GC_INNER void GC_continue_reclaim(size_t sz /* granules */, int kind)
676 struct obj_kind * ok = &(GC_obj_kinds[kind]);
677 struct hblk ** rlh = ok -> ok_reclaim_list;
678 void **flh = &(ok -> ok_freelist[sz]);
680 if (rlh == 0) return; /* No blocks of this kind. */
682 while ((hbp = *rlh) != 0) {
684 *rlh = hhdr -> hb_next;
685 GC_reclaim_small_nonempty_block(hbp, FALSE);
686 if (*flh != 0) break;
691 * Reclaim all small blocks waiting to be reclaimed.
692 * Abort and return FALSE when/if (*stop_func)() returns TRUE.
693 * If this returns TRUE, then it's safe to restart the world
694 * with incorrectly cleared mark bits.
695 * If ignore_old is TRUE, then reclaim only blocks that have been
696 * recently reclaimed, and discard the rest.
697 * Stop_func may be 0.
699 GC_INNER GC_bool GC_reclaim_all(GC_stop_func stop_func, GC_bool ignore_old)
705 struct obj_kind * ok;
708 # ifndef SMALL_CONFIG
709 CLOCK_TYPE start_time = 0; /* initialized to prevent warning. */
711 if (GC_print_stats == VERBOSE)
712 GET_TIME(start_time);
715 for (kind = 0; kind < GC_n_kinds; kind++) {
716 ok = &(GC_obj_kinds[kind]);
717 rlp = ok -> ok_reclaim_list;
718 if (rlp == 0) continue;
719 for (sz = 1; sz <= MAXOBJGRANULES; sz++) {
721 while ((hbp = *rlh) != 0) {
722 if (stop_func != (GC_stop_func)0 && (*stop_func)()) {
726 *rlh = hhdr -> hb_next;
727 if (!ignore_old || hhdr -> hb_last_reclaimed == GC_gc_no - 1) {
728 /* It's likely we'll need it this time, too */
729 /* It's been touched recently, so this */
730 /* shouldn't trigger paging. */
731 GC_reclaim_small_nonempty_block(hbp, FALSE);
736 # ifndef SMALL_CONFIG
737 if (GC_print_stats == VERBOSE) {
738 CLOCK_TYPE done_time;
741 GC_verbose_log_printf("Disposing of reclaim lists took %lu msecs\n",
742 MS_TIME_DIFF(done_time,start_time));
748 #if !defined(EAGER_SWEEP) && defined(ENABLE_DISCLAIM)
749 /* We do an eager sweep on heap blocks where unconditional marking has */
750 /* been enabled, so that any reclaimable objects have been reclaimed */
751 /* before we start marking. This is a simplified GC_reclaim_all */
752 /* restricted to kinds where ok_mark_unconditionally is true. */
753 STATIC void GC_reclaim_unconditionally_marked(void)
759 struct obj_kind * ok;
763 for (kind = 0; kind < GC_n_kinds; kind++) {
764 ok = &(GC_obj_kinds[kind]);
765 if (!ok->ok_mark_unconditionally)
767 rlp = ok->ok_reclaim_list;
770 for (sz = 1; sz <= MAXOBJGRANULES; sz++) {
772 while ((hbp = *rlh) != 0) {
774 *rlh = hhdr->hb_next;
775 GC_reclaim_small_nonempty_block(hbp, FALSE);
780 #endif /* !EAGER_SWEEP && ENABLE_DISCLAIM */
782 struct enumerate_reachable_s {
783 GC_reachable_object_proc proc;
787 STATIC void GC_do_enumerate_reachable_objects(struct hblk *hbp, word ped)
789 struct hblkhdr *hhdr = HDR(hbp);
790 size_t sz = hhdr -> hb_sz;
794 if (GC_block_empty(hhdr)) {
799 if (sz > MAXOBJBYTES) { /* one big object */
802 plim = hbp->hb_body + HBLKSIZE - sz;
804 /* Go through all words in block. */
805 for (bit_no = 0; p <= plim; bit_no += MARK_BIT_OFFSET(sz), p += sz) {
806 if (mark_bit_from_hdr(hhdr, bit_no)) {
807 ((struct enumerate_reachable_s *)ped)->proc(p, sz,
808 ((struct enumerate_reachable_s *)ped)->client_data);
813 GC_API void GC_CALL GC_enumerate_reachable_objects_inner(
814 GC_reachable_object_proc proc,
817 struct enumerate_reachable_s ed;
819 GC_ASSERT(I_HOLD_LOCK());
821 ed.client_data = client_data;
822 GC_apply_to_all_blocks(GC_do_enumerate_reachable_objects, (word)&ed);