]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Reinstate use of VG_(do_sanity_checks), although at a lower frequency
authorJulian Seward <jseward@acm.org>
Wed, 1 May 2002 01:58:35 +0000 (01:58 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 1 May 2002 01:58:35 +0000 (01:58 +0000)
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

coregrind/vg_include.h
coregrind/vg_main.c
coregrind/vg_memory.c
coregrind/vg_scheduler.c
vg_include.h
vg_main.c
vg_memory.c
vg_scheduler.c

index 08a1ab20de92eff6f4614880be94cfeedfc252af..1249d1148e17b6d5464e03eb6bfe7c58a5ba04c7 100644 (file)
@@ -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 );
 
index 3fbaca8706d017cbd1dffe772aa428803dd9058d..b98459f34d54ed0e2e653b6b160e9e1bbf4f7c5e 100644 (file)
@@ -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();
index 9d3cf86e7c02a180b6759bf77ae52ea501aaab0e..c72465baadc6c0728528e6356776af4e710a7a62 100644 (file)
@@ -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]
index 536f721f843da91c7f5a5ec70d21e3c5b6c21c05..61ae9ce8e8a64a2f7c8085d1a7ba9b95408d3323 100644 (file)
@@ -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;
index 08a1ab20de92eff6f4614880be94cfeedfc252af..1249d1148e17b6d5464e03eb6bfe7c58a5ba04c7 100644 (file)
@@ -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 );
 
index 3fbaca8706d017cbd1dffe772aa428803dd9058d..b98459f34d54ed0e2e653b6b160e9e1bbf4f7c5e 100644 (file)
--- 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();
index 9d3cf86e7c02a180b6759bf77ae52ea501aaab0e..c72465baadc6c0728528e6356776af4e710a7a62 100644 (file)
@@ -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]
index 536f721f843da91c7f5a5ec70d21e3c5b6c21c05..61ae9ce8e8a64a2f7c8085d1a7ba9b95408d3323 100644 (file)
@@ -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;