|
From: <sv...@va...> - 2006-04-05 23:06:37
|
Author: sewardj
Date: 2006-04-06 00:06:31 +0100 (Thu, 06 Apr 2006)
New Revision: 5827
Log:
Minor scheduler tidyings:
- rename os_thread_t to ThreadOSstate
- remove unused ThreadState.syscall_result_set field
- fix some comments
- add an assertion in VG_(scheduler_init)
Modified:
trunk/coregrind/m_scheduler/scheduler.c
trunk/coregrind/pub_core_threadstate.h
Modified: trunk/coregrind/m_scheduler/scheduler.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_scheduler/scheduler.c 2006-04-04 17:35:48 UTC (rev =
5826)
+++ trunk/coregrind/m_scheduler/scheduler.c 2006-04-05 23:06:31 UTC (rev =
5827)
@@ -448,6 +448,7 @@
}
=20
tid_main =3D VG_(alloc_ThreadState)();
+ vg_assert(tid_main =3D=3D 1);
=20
VG_(threads)[tid_main].client_stack_highest_word=20
=3D clstack_end + 1 - sizeof(UWord);
Modified: trunk/coregrind/pub_core_threadstate.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_threadstate.h 2006-04-04 17:35:48 UTC (rev 5=
826)
+++ trunk/coregrind/pub_core_threadstate.h 2006-04-05 23:06:31 UTC (rev 5=
827)
@@ -88,6 +88,7 @@
#endif
=20
=20
+/* Architecture-specific thread state */
typedef=20
struct {
/* --- BEGIN vex-mandated guest state --- */
@@ -105,24 +106,28 @@
}=20
ThreadArchState;
=20
+
/* OS-specific thread state */
-typedef struct {
- /* who we are */
- Int lwpid; // PID of kernel task
- Int threadgroup; // thread group id
+typedef
+ struct {
+ /* who we are */
+ Int lwpid; // PID of kernel task
+ Int threadgroup; // thread group id
=20
- ThreadId parent; // parent tid (if any)
+ ThreadId parent; // parent tid (if any)
=20
- /* runtime details */
- Addr valgrind_stack_base; // Valgrind's stack (VgStack*)
- Addr valgrind_stack_init_SP; // starting value for SP
+ /* runtime details */
+ Addr valgrind_stack_base; // Valgrind's stack (VgStack*)
+ Addr valgrind_stack_init_SP; // starting value for SP
=20
- /* exit details */
- Int exitcode; // in the case of exitgroup, set by someone else
- Int fatalsig; // fatal signal
-} os_thread_t;
+ /* exit details */
+ Int exitcode; // in the case of exitgroup, set by someone else
+ Int fatalsig; // fatal signal
+ }
+ ThreadOSstate;
=20
=20
+/* Overall thread state */
typedef struct {
/* ThreadId =3D=3D 0 (and hence vg_threads[0]) is NEVER USED.
The thread identity is simply the index in vg_threads[].
@@ -171,31 +176,26 @@
only then is the old one deallocated and a new one
allocated.=20
=20
- For the main thread (threadid =3D=3D 0), this mechanism doesn't
+ For the main thread (threadid =3D=3D 1), this mechanism doesn't
apply. We don't know the size of the stack since we didn't
allocate it, and furthermore we never reallocate it. */
=20
/* The allocated size of this thread's stack (permanently zero
- if this is ThreadId =3D=3D 0, since we didn't allocate its stack) =
*/
+ if this is ThreadId =3D=3D 1, since we didn't allocate its stack) =
*/
SizeT client_stack_szB;
=20
/* Address of the highest legitimate word in this stack. This is
used for error messages only -- not critical for execution
correctness. Is is set for all stacks, specifically including
- ThreadId =3D=3D 0 (the main thread). */
+ ThreadId =3D=3D 1 (the main thread). */
Addr client_stack_highest_word;
=20
/* Alternate signal stack */
vki_stack_t altstack;
=20
/* OS-specific thread state */
- os_thread_t os_state;
+ ThreadOSstate os_state;
=20
- /* Used in the syscall handlers. Set to True to indicate that the
- PRE routine for a syscall has set the syscall result already and
- so the syscall does not need to be handed to the kernel. */
- Bool syscall_result_set;
- =20
/* Per-thread jmp_buf to resume scheduler after a signal */
Bool sched_jmpbuf_valid;
jmp_buf sched_jmpbuf;
|