]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Handle VG_USERREQ__PTHREAD_GET_THREADID and VG_USERREQ__RUNNING_ON_VALGRIND
authorJulian Seward <jseward@acm.org>
Tue, 16 Apr 2002 03:44:31 +0000 (03:44 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 16 Apr 2002 03:44:31 +0000 (03:44 +0000)
cheaply, with the trivial-client-request mechanism.  The latter is called
once per pthread call, even simple ones like pthread_mutex_[un]lock.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@88

coregrind/vg_scheduler.c
vg_clientperms.c
vg_scheduler.c

index 9dd556284908edfcc15472fe7774912acb08c87b..33cb15766e14bd6b86c278912ff15f95481b8db6 100644 (file)
@@ -549,6 +549,13 @@ Bool maybe_do_trivial_clientreq ( ThreadId tid )
          SIMPLE_RETURN(
             (UInt)VG_(client_memalign) ( tst, arg[1], arg[2] )
          );
+
+      /* These are heavily used. */
+      case VG_USERREQ__PTHREAD_GET_THREADID:
+         SIMPLE_RETURN(tid);
+      case VG_USERREQ__RUNNING_ON_VALGRIND:
+         SIMPLE_RETURN(1);
+
       default:
          /* Too hard; wimp out. */
          return False;
@@ -1743,13 +1750,6 @@ void do_nontrivial_clientreq ( ThreadId tid )
          do_pthread_join( tid, arg[1], (void**)(arg[2]) );
          break;
 
-      /* Sigh ... this probably will cause huge numbers of major
-         (expensive) scheduling events, for no real reason.
-         Perhaps should be classified as a trivial-request. */
-      case VG_USERREQ__PTHREAD_GET_THREADID:
-         vg_threads[tid].m_edx = tid;
-        break;
-
       case VG_USERREQ__PTHREAD_MUTEX_INIT:
          do_pthread_mutex_init( tid, 
                                 (pthread_mutex_t *)(arg[1]),
index 081b7c65d52cec18d29f89569d34dfe2cd7792bc..02d0b7bf89bda2ac63bb9e232e9dc6cc183d1d09 100644 (file)
@@ -372,8 +372,12 @@ UInt VG_(handle_client_request) ( ThreadState* tst, UInt* arg_block )
          vg_add_client_stack_block ( tst, arg[1], arg[2] );
          return 0;
 
+      /* Is handled by the scheduler as a trivial request, for
+         performance reasons. */
+      /*
       case VG_USERREQ__RUNNING_ON_VALGRIND:
          return 1;
+      */
 
       case VG_USERREQ__DO_LEAK_CHECK:
          if (!VG_(clo_instrument))
index 9dd556284908edfcc15472fe7774912acb08c87b..33cb15766e14bd6b86c278912ff15f95481b8db6 100644 (file)
@@ -549,6 +549,13 @@ Bool maybe_do_trivial_clientreq ( ThreadId tid )
          SIMPLE_RETURN(
             (UInt)VG_(client_memalign) ( tst, arg[1], arg[2] )
          );
+
+      /* These are heavily used. */
+      case VG_USERREQ__PTHREAD_GET_THREADID:
+         SIMPLE_RETURN(tid);
+      case VG_USERREQ__RUNNING_ON_VALGRIND:
+         SIMPLE_RETURN(1);
+
       default:
          /* Too hard; wimp out. */
          return False;
@@ -1743,13 +1750,6 @@ void do_nontrivial_clientreq ( ThreadId tid )
          do_pthread_join( tid, arg[1], (void**)(arg[2]) );
          break;
 
-      /* Sigh ... this probably will cause huge numbers of major
-         (expensive) scheduling events, for no real reason.
-         Perhaps should be classified as a trivial-request. */
-      case VG_USERREQ__PTHREAD_GET_THREADID:
-         vg_threads[tid].m_edx = tid;
-        break;
-
       case VG_USERREQ__PTHREAD_MUTEX_INIT:
          do_pthread_mutex_init( tid, 
                                 (pthread_mutex_t *)(arg[1]),