From: Julian Seward Date: Wed, 1 May 2002 01:58:35 +0000 (+0000) Subject: Reinstate use of VG_(do_sanity_checks), although at a lower frequency X-Git-Tag: svn/VALGRIND_1_0_3~270 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd4b1c10a2155669180f3fb7f0bfeac86f5970e1;p=thirdparty%2Fvalgrind.git Reinstate use of VG_(do_sanity_checks), although at a lower frequency than before. Turns out they were wasting 25-50% of total execution time in valgrinds of the 200203XX vintage. Apologies, KDE hackers! git-svn-id: svn://svn.valgrind.org/valgrind/trunk@182 --- diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h index 08a1ab20de..1249d1148e 100644 --- a/coregrind/vg_include.h +++ b/coregrind/vg_include.h @@ -1406,9 +1406,9 @@ extern Bool VGM_(check_writable) ( Addr a, UInt len, Addr* bad_addr ); extern Bool VGM_(check_readable) ( Addr a, UInt len, Addr* bad_addr ); extern Bool VGM_(check_readable_asciiz) ( Addr a, Addr* bad_addr ); -/* Sanity checks which may be done at any time. Doing them at - signal-delivery time turns out to be convenient. */ -extern void VG_(do_sanity_checks) ( ThreadId tid, Bool force_expensive ); +/* Sanity checks which may be done at any time. The scheduler decides + when. */ +extern void VG_(do_sanity_checks) ( Bool force_expensive ); /* Very cheap ... */ extern Bool VG_(first_and_last_secondaries_look_plausible) ( void ); diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 3fbaca8706..b98459f34d 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -1071,8 +1071,7 @@ void VG_(main) ( void ) if (VG_(clo_cachesim)) VG_(show_cachesim_results)(VG_(client_argc), VG_(client_argv)); - VG_(do_sanity_checks)( 1 /* root thread */, - True /*include expensive checks*/ ); + VG_(do_sanity_checks)( True /*include expensive checks*/ ); if (VG_(clo_verbosity) > 1) vg_show_counts(); diff --git a/coregrind/vg_memory.c b/coregrind/vg_memory.c index 9d3cf86e7c..c72465baad 100644 --- a/coregrind/vg_memory.c +++ b/coregrind/vg_memory.c @@ -2122,7 +2122,7 @@ Bool VG_(first_and_last_secondaries_look_plausible) ( void ) /* A fast sanity check -- suitable for calling circa once per millisecond. */ -void VG_(do_sanity_checks) ( ThreadId tid, Bool force_expensive ) +void VG_(do_sanity_checks) ( Bool force_expensive ) { Int i; Bool do_expensive_checks; @@ -2134,9 +2134,6 @@ void VG_(do_sanity_checks) ( ThreadId tid, Bool force_expensive ) VG_(sanity_fast_count)++; - tst = VG_(get_thread_state)(tid); - vg_assert(tst != NULL && tst->status != VgTs_Empty); - /* Check that we haven't overrun our private stack. */ for (i = 0; i < 10; i++) { vg_assert(VG_(stack)[i] diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index 536f721f84..61ae9ce8e8 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -1150,6 +1150,7 @@ VgSchedReturnCode VG_(scheduler) ( void ) Be paranoid. Always a good idea. */ stage1: scheduler_sanity(); + VG_(do_sanity_checks)( False ); /* ======================= Phase 1 of 3 ======================= Handle I/O completions and signals. This may change the @@ -1196,7 +1197,7 @@ VgSchedReturnCode VG_(scheduler) ( void ) POSIX standard appears to require this behaviour. */ sigs_delivered = VG_(deliver_signals)( 1 /*HACK*/ ); if (sigs_delivered) - VG_(do_sanity_checks)( 1 /*HACK*/, False ); + VG_(do_sanity_checks)( False ); /* Try and find a thread (tid) to run. */ tid_next = tid; diff --git a/vg_include.h b/vg_include.h index 08a1ab20de..1249d1148e 100644 --- a/vg_include.h +++ b/vg_include.h @@ -1406,9 +1406,9 @@ extern Bool VGM_(check_writable) ( Addr a, UInt len, Addr* bad_addr ); extern Bool VGM_(check_readable) ( Addr a, UInt len, Addr* bad_addr ); extern Bool VGM_(check_readable_asciiz) ( Addr a, Addr* bad_addr ); -/* Sanity checks which may be done at any time. Doing them at - signal-delivery time turns out to be convenient. */ -extern void VG_(do_sanity_checks) ( ThreadId tid, Bool force_expensive ); +/* Sanity checks which may be done at any time. The scheduler decides + when. */ +extern void VG_(do_sanity_checks) ( Bool force_expensive ); /* Very cheap ... */ extern Bool VG_(first_and_last_secondaries_look_plausible) ( void ); diff --git a/vg_main.c b/vg_main.c index 3fbaca8706..b98459f34d 100644 --- a/vg_main.c +++ b/vg_main.c @@ -1071,8 +1071,7 @@ void VG_(main) ( void ) if (VG_(clo_cachesim)) VG_(show_cachesim_results)(VG_(client_argc), VG_(client_argv)); - VG_(do_sanity_checks)( 1 /* root thread */, - True /*include expensive checks*/ ); + VG_(do_sanity_checks)( True /*include expensive checks*/ ); if (VG_(clo_verbosity) > 1) vg_show_counts(); diff --git a/vg_memory.c b/vg_memory.c index 9d3cf86e7c..c72465baad 100644 --- a/vg_memory.c +++ b/vg_memory.c @@ -2122,7 +2122,7 @@ Bool VG_(first_and_last_secondaries_look_plausible) ( void ) /* A fast sanity check -- suitable for calling circa once per millisecond. */ -void VG_(do_sanity_checks) ( ThreadId tid, Bool force_expensive ) +void VG_(do_sanity_checks) ( Bool force_expensive ) { Int i; Bool do_expensive_checks; @@ -2134,9 +2134,6 @@ void VG_(do_sanity_checks) ( ThreadId tid, Bool force_expensive ) VG_(sanity_fast_count)++; - tst = VG_(get_thread_state)(tid); - vg_assert(tst != NULL && tst->status != VgTs_Empty); - /* Check that we haven't overrun our private stack. */ for (i = 0; i < 10; i++) { vg_assert(VG_(stack)[i] diff --git a/vg_scheduler.c b/vg_scheduler.c index 536f721f84..61ae9ce8e8 100644 --- a/vg_scheduler.c +++ b/vg_scheduler.c @@ -1150,6 +1150,7 @@ VgSchedReturnCode VG_(scheduler) ( void ) Be paranoid. Always a good idea. */ stage1: scheduler_sanity(); + VG_(do_sanity_checks)( False ); /* ======================= Phase 1 of 3 ======================= Handle I/O completions and signals. This may change the @@ -1196,7 +1197,7 @@ VgSchedReturnCode VG_(scheduler) ( void ) POSIX standard appears to require this behaviour. */ sigs_delivered = VG_(deliver_signals)( 1 /*HACK*/ ); if (sigs_delivered) - VG_(do_sanity_checks)( 1 /*HACK*/, False ); + VG_(do_sanity_checks)( False ); /* Try and find a thread (tid) to run. */ tid_next = tid;