184
184
GC_print_heap_obj(GC_base(current));
185
GC_err_printf0("\n");
186
186
for (i = 0; ; ++i) {
187
187
source = GC_get_back_ptr_info(current, &base, &offset);
188
188
if (GC_UNREFERENCED == source) {
189
GC_err_printf0("Reference could not be found\n");
189
GC_err_printf("Reference could not be found\n");
192
192
if (GC_NO_SPACE == source) {
193
GC_err_printf0("No debug info in object: Can't find reference\n");
193
GC_err_printf("No debug info in object: Can't find reference\n");
196
GC_err_printf1("Reachable via %d levels of pointers from ",
196
GC_err_printf("Reachable via %d levels of pointers from ",
197
197
(unsigned long)i);
199
199
case GC_REFD_FROM_ROOT:
200
GC_err_printf1("root at 0x%lx\n\n", (unsigned long)base);
200
GC_err_printf("root at %p\n\n", base);
202
202
case GC_REFD_FROM_REG:
203
GC_err_printf0("root in register\n\n");
203
GC_err_printf("root in register\n\n");
205
205
case GC_FINALIZER_REFD:
206
GC_err_printf0("list of finalizable objects\n\n");
206
GC_err_printf("list of finalizable objects\n\n");
208
208
case GC_REFD_FROM_HEAP:
209
GC_err_printf1("offset %ld in object:\n", (unsigned long)offset);
209
GC_err_printf("offset %ld in object:\n", (unsigned long)offset);
210
210
/* Take GC_base(base) to get real base, i.e. header. */
211
211
GC_print_heap_obj(GC_base(base));
212
GC_err_printf0("\n");
377
365
GC_err_puts("STUBBORN");
380
GC_err_printf2("kind %ld, descr 0x%lx", kind, hhdr -> hb_descr);
368
GC_err_printf("kind %d, descr 0x%lx", kind,
369
(unsigned long)(hhdr -> hb_descr));
376
void GC_print_obj(ptr_t p)
390
378
register oh * ohdr = (oh *)GC_base(p);
392
GC_ASSERT(!I_HOLD_LOCK());
393
GC_err_printf1("0x%lx (", ((unsigned long)ohdr + sizeof(oh)));
380
GC_ASSERT(I_DONT_HOLD_LOCK());
381
GC_err_printf("%p (", ((ptr_t)ohdr + sizeof(oh)));
394
382
GC_err_puts(ohdr -> oh_string);
395
383
# ifdef SHORT_DBG_HDRS
396
GC_err_printf1(":%ld, ", (unsigned long)(ohdr -> oh_int));
384
GC_err_printf(":%ld, ", (unsigned long)(ohdr -> oh_int));
398
GC_err_printf2(":%ld, sz=%ld, ", (unsigned long)(ohdr -> oh_int),
386
GC_err_printf(":%ld, sz=%ld, ", (unsigned long)(ohdr -> oh_int),
399
387
(unsigned long)(ohdr -> oh_sz));
401
389
GC_print_type((ptr_t)(ohdr + 1));
421
404
#ifndef SHORT_DBG_HDRS
422
void GC_print_smashed_obj(p, clobbered_addr)
423
ptr_t p, clobbered_addr;
405
/* Use GC_err_printf and friends to print a description of the object */
406
/* whose client-visible address is p, and which was smashed at */
407
/* clobbered_addr. */
408
void GC_print_smashed_obj(ptr_t p, ptr_t clobbered_addr)
425
410
register oh * ohdr = (oh *)GC_base(p);
427
GC_ASSERT(!I_HOLD_LOCK());
428
GC_err_printf2("0x%lx in object at 0x%lx(", (unsigned long)clobbered_addr,
412
GC_ASSERT(I_DONT_HOLD_LOCK());
413
GC_err_printf("%p in or near object at %p(", clobbered_addr, p);
430
414
if (clobbered_addr <= (ptr_t)(&(ohdr -> oh_sz))
431
415
|| ohdr -> oh_string == 0) {
432
GC_err_printf1("<smashed>, appr. sz = %ld)\n",
416
GC_err_printf("<smashed>, appr. sz = %ld)\n",
433
417
(GC_size((ptr_t)ohdr) - DEBUG_BYTES));
435
419
if (ohdr -> oh_string[0] == '\0') {
438
422
GC_err_puts(ohdr -> oh_string);
440
GC_err_printf2(":%ld, sz=%ld)\n", (unsigned long)(ohdr -> oh_int),
424
GC_err_printf(":%ld, sz=%ld)\n", (unsigned long)(ohdr -> oh_int),
441
425
(unsigned long)(ohdr -> oh_sz));
442
426
PRINT_CALL_CHAIN(ohdr);
447
void GC_check_heap_proc GC_PROTO((void));
449
void GC_print_all_smashed_proc GC_PROTO((void));
451
void GC_do_nothing() {}
453
void GC_start_debugging()
431
void GC_check_heap_proc (void);
433
void GC_print_all_smashed_proc (void);
435
void GC_do_nothing(void) {}
437
void GC_start_debugging(void)
455
439
# ifndef SHORT_DBG_HDRS
456
440
GC_check_heap = GC_check_heap_proc;
467
451
size_t GC_debug_header_size = sizeof(oh);
469
# if defined(__STDC__) || defined(__cplusplus)
470
void GC_debug_register_displacement(GC_word offset)
472
void GC_debug_register_displacement(offset)
453
void GC_debug_register_displacement(size_t offset)
476
455
GC_register_displacement(offset);
477
456
GC_register_displacement((word)sizeof(oh) + offset);
481
GC_PTR GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
483
GC_PTR GC_debug_malloc(lb, s, i)
487
# ifdef GC_ADD_CALLER
488
--> GC_ADD_CALLER not implemented for K&R C
492
GC_PTR result = GC_malloc(lb + DEBUG_BYTES);
495
GC_err_printf1("GC_debug_malloc(%ld) returning NIL (",
498
GC_err_printf1(":%ld)\n", (unsigned long)i);
501
if (!GC_debugging_started) {
502
GC_start_debugging();
504
ADD_CALL_CHAIN(result, ra);
505
return (GC_store_debug_info(result, (word)lb, s, (word)i));
509
GC_PTR GC_debug_malloc_ignore_off_page(size_t lb, GC_EXTRA_PARAMS)
511
GC_PTR GC_debug_malloc_ignore_off_page(lb, s, i)
515
# ifdef GC_ADD_CALLER
516
--> GC_ADD_CALLER not implemented for K&R C
520
GC_PTR result = GC_malloc_ignore_off_page(lb + DEBUG_BYTES);
523
GC_err_printf1("GC_debug_malloc_ignore_off_page(%ld) returning NIL (",
526
GC_err_printf1(":%ld)\n", (unsigned long)i);
529
if (!GC_debugging_started) {
530
GC_start_debugging();
532
ADD_CALL_CHAIN(result, ra);
533
return (GC_store_debug_info(result, (word)lb, s, (word)i));
537
GC_PTR GC_debug_malloc_atomic_ignore_off_page(size_t lb, GC_EXTRA_PARAMS)
539
GC_PTR GC_debug_malloc_atomic_ignore_off_page(lb, s, i)
543
# ifdef GC_ADD_CALLER
544
--> GC_ADD_CALLER not implemented for K&R C
548
GC_PTR result = GC_malloc_atomic_ignore_off_page(lb + DEBUG_BYTES);
551
GC_err_printf1("GC_debug_malloc_atomic_ignore_off_page(%ld)"
459
void * GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
461
void * result = GC_malloc(lb + DEBUG_BYTES);
464
GC_err_printf("GC_debug_malloc(%lu) returning NIL (",
467
GC_err_printf(":%ld)\n", (unsigned long)i);
470
if (!GC_debugging_started) {
471
GC_start_debugging();
473
ADD_CALL_CHAIN(result, ra);
474
return (GC_store_debug_info(result, (word)lb, s, (word)i));
477
void * GC_debug_malloc_ignore_off_page(size_t lb, GC_EXTRA_PARAMS)
479
void * result = GC_malloc_ignore_off_page(lb + DEBUG_BYTES);
482
GC_err_printf("GC_debug_malloc_ignore_off_page(%lu) returning NIL (",
485
GC_err_printf(":%lu)\n", (unsigned long)i);
488
if (!GC_debugging_started) {
489
GC_start_debugging();
491
ADD_CALL_CHAIN(result, ra);
492
return (GC_store_debug_info(result, (word)lb, s, (word)i));
495
void * GC_debug_malloc_atomic_ignore_off_page(size_t lb, GC_EXTRA_PARAMS)
497
void * result = GC_malloc_atomic_ignore_off_page(lb + DEBUG_BYTES);
500
GC_err_printf("GC_debug_malloc_atomic_ignore_off_page(%lu)"
552
501
" returning NIL (", (unsigned long) lb);
554
GC_err_printf1(":%ld)\n", (unsigned long)i);
503
GC_err_printf(":%lu)\n", (unsigned long)i);
557
506
if (!GC_debugging_started) {
570
519
* We assume debugging was started in collector initialization,
571
520
* and we already hold the GC lock.
573
GC_PTR GC_debug_generic_malloc_inner(size_t lb, int k)
522
void * GC_debug_generic_malloc_inner(size_t lb, int k)
575
GC_PTR result = GC_generic_malloc_inner(lb + DEBUG_BYTES, k);
524
void * result = GC_generic_malloc_inner(lb + DEBUG_BYTES, k);
577
526
if (result == 0) {
578
GC_err_printf1("GC internal allocation (%ld bytes) returning NIL\n",
527
GC_err_printf("GC internal allocation (%lu bytes) returning NIL\n",
579
528
(unsigned long) lb);
583
532
return (GC_store_debug_info_inner(result, (word)lb, "INTERNAL", (word)0));
586
GC_PTR GC_debug_generic_malloc_inner_ignore_off_page(size_t lb, int k)
535
void * GC_debug_generic_malloc_inner_ignore_off_page(size_t lb, int k)
588
GC_PTR result = GC_generic_malloc_inner_ignore_off_page(
537
void * result = GC_generic_malloc_inner_ignore_off_page(
589
538
lb + DEBUG_BYTES, k);
591
540
if (result == 0) {
592
GC_err_printf1("GC internal allocation (%ld bytes) returning NIL\n",
541
GC_err_printf("GC internal allocation (%lu bytes) returning NIL\n",
593
542
(unsigned long) lb);
601
550
#ifdef STUBBORN_ALLOC
603
GC_PTR GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
605
GC_PTR GC_debug_malloc_stubborn(lb, s, i)
551
void * GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
611
GC_PTR result = GC_malloc_stubborn(lb + DEBUG_BYTES);
553
void * result = GC_malloc_stubborn(lb + DEBUG_BYTES);
613
555
if (result == 0) {
614
GC_err_printf1("GC_debug_malloc(%ld) returning NIL (",
556
GC_err_printf("GC_debug_malloc(%lu) returning NIL (",
617
GC_err_printf1(":%ld)\n", (unsigned long)i);
559
GC_err_printf(":%lu)\n", (unsigned long)i);
620
562
if (!GC_debugging_started) {
624
566
return (GC_store_debug_info(result, (word)lb, s, (word)i));
627
void GC_debug_change_stubborn(p)
569
void GC_debug_change_stubborn(void *p)
630
register GC_PTR q = GC_base(p);
571
void * q = GC_base(p);
634
GC_err_printf1("Bad argument: 0x%lx to GC_debug_change_stubborn\n",
575
GC_err_printf("Bad argument: %p to GC_debug_change_stubborn\n", p);
636
576
ABORT("GC_debug_change_stubborn: bad arg");
639
579
if (hhdr -> hb_obj_kind != STUBBORN) {
640
GC_err_printf1("GC_debug_change_stubborn arg not stubborn: 0x%lx\n",
580
GC_err_printf("GC_debug_change_stubborn arg not stubborn: %p\n", p);
642
581
ABORT("GC_debug_change_stubborn: arg not stubborn");
644
583
GC_change_stubborn(q);
647
void GC_debug_end_stubborn_change(p)
586
void GC_debug_end_stubborn_change(void *p)
650
register GC_PTR q = GC_base(p);
588
register void * q = GC_base(p);
651
589
register hdr * hhdr;
654
GC_err_printf1("Bad argument: 0x%lx to GC_debug_end_stubborn_change\n",
592
GC_err_printf("Bad argument: %p to GC_debug_end_stubborn_change\n", p);
656
593
ABORT("GC_debug_end_stubborn_change: bad arg");
659
596
if (hhdr -> hb_obj_kind != STUBBORN) {
660
GC_err_printf1("debug_end_stubborn_change arg not stubborn: 0x%lx\n",
597
GC_err_printf("debug_end_stubborn_change arg not stubborn: %p\n", p);
662
598
ABORT("GC_debug_end_stubborn_change: arg not stubborn");
664
600
GC_end_stubborn_change(q);
667
603
#else /* !STUBBORN_ALLOC */
670
GC_PTR GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
672
GC_PTR GC_debug_malloc_stubborn(lb, s, i)
605
void * GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
678
607
return GC_debug_malloc(lb, OPT_RA s, i);
681
void GC_debug_change_stubborn(p)
610
void GC_debug_change_stubborn(void *p)
686
void GC_debug_end_stubborn_change(p)
614
void GC_debug_end_stubborn_change(void *p)
691
618
#endif /* !STUBBORN_ALLOC */
694
GC_PTR GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS)
696
GC_PTR GC_debug_malloc_atomic(lb, s, i)
620
void * GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS)
702
GC_PTR result = GC_malloc_atomic(lb + DEBUG_BYTES);
622
void * result = GC_malloc_atomic(lb + DEBUG_BYTES);
704
624
if (result == 0) {
705
GC_err_printf1("GC_debug_malloc_atomic(%ld) returning NIL (",
625
GC_err_printf("GC_debug_malloc_atomic(%lu) returning NIL (",
706
626
(unsigned long) lb);
708
GC_err_printf1(":%ld)\n", (unsigned long)i);
628
GC_err_printf(":%lu)\n", (unsigned long)i);
711
631
if (!GC_debugging_started) {
739
GC_PTR GC_debug_malloc_uncollectable(size_t lb, GC_EXTRA_PARAMS)
741
GC_PTR GC_debug_malloc_uncollectable(lb, s, i)
651
void * GC_debug_malloc_uncollectable(size_t lb, GC_EXTRA_PARAMS)
747
GC_PTR result = GC_malloc_uncollectable(lb + UNCOLLECTABLE_DEBUG_BYTES);
653
void * result = GC_malloc_uncollectable(lb + UNCOLLECTABLE_DEBUG_BYTES);
749
655
if (result == 0) {
750
GC_err_printf1("GC_debug_malloc_uncollectable(%ld) returning NIL (",
656
GC_err_printf("GC_debug_malloc_uncollectable(%lu) returning NIL (",
751
657
(unsigned long) lb);
753
GC_err_printf1(":%ld)\n", (unsigned long)i);
659
GC_err_printf(":%lu)\n", (unsigned long)i);
756
662
if (!GC_debugging_started) {
763
669
#ifdef ATOMIC_UNCOLLECTABLE
765
GC_PTR GC_debug_malloc_atomic_uncollectable(size_t lb, GC_EXTRA_PARAMS)
767
GC_PTR GC_debug_malloc_atomic_uncollectable(lb, s, i)
670
void * GC_debug_malloc_atomic_uncollectable(size_t lb, GC_EXTRA_PARAMS)
774
673
GC_malloc_atomic_uncollectable(lb + UNCOLLECTABLE_DEBUG_BYTES);
776
675
if (result == 0) {
778
"GC_debug_malloc_atomic_uncollectable(%ld) returning NIL (",
677
"GC_debug_malloc_atomic_uncollectable(%lu) returning NIL (",
779
678
(unsigned long) lb);
781
GC_err_printf1(":%ld)\n", (unsigned long)i);
680
GC_err_printf(":%lu)\n", (unsigned long)i);
784
683
if (!GC_debugging_started) {
790
689
#endif /* ATOMIC_UNCOLLECTABLE */
793
void GC_debug_free(GC_PTR p)
795
void GC_debug_free(p)
691
void GC_debug_free(void * p)
799
register GC_PTR base;
800
register ptr_t clobbered;
802
696
if (0 == p) return;
803
697
base = GC_base(p);
805
GC_err_printf1("Attempt to free invalid pointer %lx\n",
699
GC_err_printf("Attempt to free invalid pointer %p\n", p);
807
700
ABORT("free(invalid pointer)");
809
702
if ((ptr_t)p - (ptr_t)base != sizeof(oh)) {
811
"GC_debug_free called on pointer %lx wo debugging info\n",
704
"GC_debug_free called on pointer %p wo debugging info\n", p);
814
706
# ifndef SHORT_DBG_HDRS
815
707
clobbered = GC_check_annotated_obj((oh *)base);
816
708
if (clobbered != 0) {
817
709
if (((oh *)base) -> oh_sz == GC_size(base)) {
819
711
"GC_debug_free: found previously deallocated (?) object at ");
821
GC_err_printf0("GC_debug_free: found smashed location at ");
713
GC_err_printf("GC_debug_free: found smashed location at ");
823
715
GC_print_smashed_obj(p, clobbered);
847
size_t obj_sz = hhdr -> hb_sz - BYTES_TO_WORDS(sizeof(oh));
739
size_t obj_sz = BYTES_TO_WORDS(hhdr -> hb_sz - sizeof(oh));
849
741
for (i = 0; i < obj_sz; ++i) ((word *)p)[i] = 0xdeadbeef;
850
GC_ASSERT((word *)p + i == (word *)base + hhdr -> hb_sz);
742
GC_ASSERT((word *)p + i == (word *)(base + hhdr -> hb_sz));
852
744
} /* !GC_find_leak */
857
extern void GC_free_inner(GC_PTR p);
749
extern void GC_free_inner(void * p);
859
751
/* Used internally; we assume it's called correctly. */
860
void GC_debug_free_inner(GC_PTR p)
752
void GC_debug_free_inner(void * p)
862
754
GC_free_inner(GC_base(p));
867
GC_PTR GC_debug_realloc(GC_PTR p, size_t lb, GC_EXTRA_PARAMS)
869
GC_PTR GC_debug_realloc(p, lb, s, i)
758
void * GC_debug_realloc(void * p, size_t lb, GC_EXTRA_PARAMS)
876
register GC_PTR base = GC_base(p);
877
register ptr_t clobbered;
878
register GC_PTR result;
879
register size_t copy_sz = lb;
880
register size_t old_sz;
760
void * base = GC_base(p);
883
767
if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i));
886
"Attempt to reallocate invalid pointer %lx\n", (unsigned long)p);
769
GC_err_printf("Attempt to reallocate invalid pointer %p\n", p);
887
770
ABORT("realloc(invalid pointer)");
889
772
if ((ptr_t)p - (ptr_t)base != sizeof(oh)) {
891
"GC_debug_realloc called on pointer %lx wo debugging info\n",
774
"GC_debug_realloc called on pointer %p wo debugging info\n", p);
893
775
return(GC_realloc(p, lb));
895
777
hhdr = HDR(base);
962
839
/* Print all objects on the list. Clear the list. */
963
void GC_print_all_smashed_proc ()
840
void GC_print_all_smashed_proc(void)
967
GC_ASSERT(!I_HOLD_LOCK());
844
GC_ASSERT(I_DONT_HOLD_LOCK());
968
845
if (GC_n_smashed == 0) return;
969
GC_err_printf0("GC_check_heap_block: found smashed heap objects:\n");
846
GC_err_printf("GC_check_heap_block: found smashed heap objects:\n");
970
847
for (i = 0; i < GC_n_smashed; ++i) {
971
GC_print_smashed_obj(GC_base(GC_smashed[i]), GC_smashed[i]);
848
GC_print_smashed_obj((ptr_t)GC_base(GC_smashed[i]) + sizeof(oh),
972
850
GC_smashed[i] = 0;
974
852
GC_n_smashed = 0;
977
/* Check all marked objects in the given block for validity */
855
/* Check all marked objects in the given block for validity */
856
/* Avoid GC_apply_to_each_object for performance reasons. */
979
# if defined(__STDC__) || defined(__cplusplus)
980
void GC_check_heap_block(register struct hblk *hbp, word dummy)
982
void GC_check_heap_block(hbp, dummy)
983
register struct hblk *hbp; /* ptr to current heap block */
858
void GC_check_heap_block(struct hblk *hbp, word dummy)
987
register struct hblkhdr * hhdr = HDR(hbp);
988
register word sz = hhdr -> hb_sz;
989
register int word_no;
990
register word *p, *plim;
860
struct hblkhdr * hhdr = HDR(hbp);
861
size_t sz = hhdr -> hb_sz;
992
p = (word *)(hbp->hb_body);
867
if (sz > MAXOBJBYTES) {
997
plim = (word *)((((word)hbp) + HBLKSIZE) - WORDS_TO_BYTES(sz));
870
plim = hbp->hb_body + HBLKSIZE - sz;
999
872
/* go through all words in block */
1000
873
while( p <= plim ) {
1001
if( mark_bit_from_hdr(hhdr, word_no)
874
if( mark_bit_from_hdr(hhdr, bit_no)
1002
875
&& GC_HAS_DEBUG_INFO((ptr_t)p)) {
1003
876
ptr_t clobbered = GC_check_annotated_obj((oh *)p);
1005
878
if (clobbered != 0) GC_add_smashed(clobbered);
880
bit_no += MARK_BIT_OFFSET(sz);
1013
886
/* This assumes that all accessible objects are marked, and that */
1014
887
/* I hold the allocation lock. Normally called by collector. */
1015
void GC_check_heap_proc()
888
void GC_check_heap_proc(void)
1017
890
# ifndef SMALL_CONFIG
1018
# ifdef ALIGN_DOUBLE
1019
GC_STATIC_ASSERT((sizeof(oh) & (2 * sizeof(word) - 1)) == 0);
1021
GC_STATIC_ASSERT((sizeof(oh) & (sizeof(word) - 1)) == 0);
891
/* Ignore gcc no effect warning on the following. */
892
GC_STATIC_ASSERT((sizeof(oh) & (GRANULE_BYTES - 1)) == 0);
893
/* FIXME: Should we check for twice that alignment? */
1024
895
GC_apply_to_all_blocks(GC_check_heap_block, (word)0);
1050
915
result -> cl_fn = fn;
1051
916
result -> cl_data = data;
1052
return((GC_PTR)result);
917
return((void *)result);
1056
void GC_debug_invoke_finalizer(void * obj, void * data)
1058
void GC_debug_invoke_finalizer(obj, data)
920
void GC_debug_invoke_finalizer(void * obj, void * data)
1063
922
register struct closure * cl = (struct closure *) data;
1065
(*(cl -> cl_fn))((GC_PTR)((char *)obj + sizeof(oh)), cl -> cl_data);
924
(*(cl -> cl_fn))((void *)((char *)obj + sizeof(oh)), cl -> cl_data);
1068
927
/* Set ofn and ocd to reflect the values we got back. */
1069
static void store_old (obj, my_old_fn, my_old_cd, ofn, ocd)
1071
GC_finalization_proc my_old_fn;
1072
struct closure * my_old_cd;
1073
GC_finalization_proc *ofn;
928
static void store_old (void *obj, GC_finalization_proc my_old_fn,
929
struct closure *my_old_cd, GC_finalization_proc *ofn,
1076
932
if (0 != my_old_fn) {
1077
933
if (my_old_fn != GC_debug_invoke_finalizer) {
1078
GC_err_printf1("Debuggable object at 0x%lx had non-debug finalizer.\n",
934
GC_err_printf("Debuggable object at %p had non-debug finalizer.\n",
1080
936
/* This should probably be fatal. */
1082
938
if (ofn) *ofn = my_old_cd -> cl_fn;
1092
void GC_debug_register_finalizer(GC_PTR obj, GC_finalization_proc fn,
1093
GC_PTR cd, GC_finalization_proc *ofn,
1096
void GC_debug_register_finalizer(obj, fn, cd, ofn, ocd)
1098
GC_finalization_proc fn;
1100
GC_finalization_proc *ofn;
947
void GC_debug_register_finalizer(void * obj, GC_finalization_proc fn,
948
void * cd, GC_finalization_proc *ofn,
1104
951
GC_finalization_proc my_old_fn;
1106
953
ptr_t base = GC_base(obj);
1107
954
if (0 == base) return;
1108
955
if ((ptr_t)obj - base != sizeof(oh)) {
1110
"GC_debug_register_finalizer called with non-base-pointer 0x%lx\n",
957
"GC_debug_register_finalizer called with non-base-pointer %p\n",
1119
966
store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd);
1123
void GC_debug_register_finalizer_no_order
1124
(GC_PTR obj, GC_finalization_proc fn,
1125
GC_PTR cd, GC_finalization_proc *ofn,
1128
void GC_debug_register_finalizer_no_order
1129
(obj, fn, cd, ofn, ocd)
1131
GC_finalization_proc fn;
1133
GC_finalization_proc *ofn;
969
void GC_debug_register_finalizer_no_order
970
(void * obj, GC_finalization_proc fn,
971
void * cd, GC_finalization_proc *ofn,
1137
974
GC_finalization_proc my_old_fn;
1139
976
ptr_t base = GC_base(obj);
1140
977
if (0 == base) return;
1141
978
if ((ptr_t)obj - base != sizeof(oh)) {
1143
"GC_debug_register_finalizer_no_order called with non-base-pointer 0x%lx\n",
980
"GC_debug_register_finalizer_no_order called with "
981
"non-base-pointer %p\n",
1153
991
store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd);
1157
void GC_debug_register_finalizer_ignore_self
1158
(GC_PTR obj, GC_finalization_proc fn,
1159
GC_PTR cd, GC_finalization_proc *ofn,
1162
void GC_debug_register_finalizer_ignore_self
1163
(obj, fn, cd, ofn, ocd)
1165
GC_finalization_proc fn;
1167
GC_finalization_proc *ofn;
994
void GC_debug_register_finalizer_unreachable
995
(void * obj, GC_finalization_proc fn,
996
void * cd, GC_finalization_proc *ofn,
1171
999
GC_finalization_proc my_old_fn;
1173
1001
ptr_t base = GC_base(obj);
1174
1002
if (0 == base) return;
1175
1003
if ((ptr_t)obj - base != sizeof(oh)) {
1177
"GC_debug_register_finalizer_ignore_self called with non-base-pointer 0x%lx\n",
1005
"GC_debug_register_finalizer_unreachable called with "
1006
"non-base-pointer %p\n",
1010
GC_register_finalizer_unreachable(base, 0, 0, &my_old_fn, &my_old_cd);
1012
GC_register_finalizer_unreachable(base, GC_debug_invoke_finalizer,
1013
GC_make_closure(fn,cd), &my_old_fn,
1016
store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd);
1019
void GC_debug_register_finalizer_ignore_self
1020
(void * obj, GC_finalization_proc fn,
1021
void * cd, GC_finalization_proc *ofn,
1024
GC_finalization_proc my_old_fn;
1026
ptr_t base = GC_base(obj);
1027
if (0 == base) return;
1028
if ((ptr_t)obj - base != sizeof(oh)) {
1030
"GC_debug_register_finalizer_ignore_self called with "
1031
"non-base-pointer %p\n", obj);
1181
1034
GC_register_finalizer_ignore_self(base, 0, 0, &my_old_fn, &my_old_cd);
1183
1036
GC_register_finalizer_ignore_self(base, GC_debug_invoke_finalizer,