[Gc] I_DONT_HOLD_LOCK removal in GC_print_obj and friends

Ivan Maidanski ivmai at mail.ru
Mon Oct 27 07:49:06 PST 2008


Hi!

I_DONT_HOLD_LOCK() assertion is violated in GC_debug_print_heap_obj_proc() (called indirectly from GC_maybe_gc()) when test.c and gclib are compiled for Win32 with -DALL_INTERIOR_POINTERS -DGC_THREADS -DGC_ASSERTIONS -DPRINT_BLACK_LIST -DDBG_HDRS_ALL.

This assertion can't be replaced wih I_HOLD_LOCK() because it is violated too (called indirectly from GC_help_marker()) when test.c and gclib are compiled for Win32 with -DALL_INTERIOR_POINTERS -DGC_THREADS -DGC_ASSERTIONS -DPRINT_BLACK_LIST -DDBG_HDRS_ALL -DPARALLEL_MARK -DAO_ASSUME_WINDOWS98.

I don't know the purpose of this assertion.
Since it works ok without this assertion (and in GC_print_obj(), and GC_print_smashed_obj()), the attached patch removes these assertions.

PS. The same assertion in GC_print_all_smashed_() is ok.

Bye.

-------------- next part --------------
diff -ru bdwgc/dbg_mlc.c updated/bdwgc/dbg_mlc.c
--- bdwgc/dbg_mlc.c	2008-10-25 14:57:00.000000000 +0400
+++ updated/bdwgc/dbg_mlc.c	2008-10-27 14:19:56.000000000 +0300
@@ -380,7 +380,6 @@
 {
     register oh * ohdr = (oh *)GC_base(p);
     
-    GC_ASSERT(I_DONT_HOLD_LOCK());
     GC_err_printf("%p (", ((ptr_t)ohdr + sizeof(oh)));
     GC_err_puts(ohdr -> oh_string);
 #   ifdef SHORT_DBG_HDRS
@@ -396,7 +395,6 @@
 
 STATIC void GC_debug_print_heap_obj_proc(ptr_t p)
 {
-    GC_ASSERT(I_DONT_HOLD_LOCK());
     if (GC_HAS_DEBUG_INFO(p)) {
 	GC_print_obj(p);
     } else {
@@ -412,7 +410,6 @@
 {
     register oh * ohdr = (oh *)GC_base(p);
     
-    GC_ASSERT(I_DONT_HOLD_LOCK());
     GC_err_printf("%p in or near object at %p(", clobbered_addr, p);
     if (clobbered_addr <= (ptr_t)(&(ohdr -> oh_sz))
         || ohdr -> oh_string == 0) {


More information about the Gc mailing list