From: simonmar Date: Fri, 17 Mar 2000 13:30:24 +0000 (+0000) Subject: [project @ 2000-03-17 13:30:23 by simonmar] X-Git-Tag: Approximately_9120_patches~4956 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d37986fe8eef5554e6dbd6dbe83db0cce9f62280;p=ghc-hetmet.git [project @ 2000-03-17 13:30:23 by simonmar] Random cleanup: rename the TSO->whatNext field to what_next, to be a bit more consistent. --- diff --git a/ghc/includes/StgMacros.h b/ghc/includes/StgMacros.h index 3c4b451..fb074e8 100644 --- a/ghc/includes/StgMacros.h +++ b/ghc/includes/StgMacros.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: StgMacros.h,v 1.23 2000/03/16 12:40:40 simonmar Exp $ + * $Id: StgMacros.h,v 1.24 2000/03/17 13:30:23 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -365,7 +365,7 @@ EF_(stg_gen_block); #define THREAD_RETURN(ptrs) \ ASSERT(ptrs==1); \ - CurrentTSO->whatNext = ThreadEnterGHC; \ + CurrentTSO->what_next = ThreadEnterGHC; \ R1.i = ThreadBlocked; \ JMP_(StgReturn); #endif diff --git a/ghc/includes/TSO.h b/ghc/includes/TSO.h index e97875f..d3a76ae 100644 --- a/ghc/includes/TSO.h +++ b/ghc/includes/TSO.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: TSO.h,v 1.12 2000/03/17 09:53:19 simonmar Exp $ + * $Id: TSO.h,v 1.13 2000/03/17 13:30:23 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -72,7 +72,7 @@ typedef enum { } StgTSOState; /* - * The whatNext field of a TSO indicates how the thread is to be run. + * The what_next field of a TSO indicates how the thread is to be run. */ typedef enum { ThreadEnterGHC, /* enter top thunk on stack */ @@ -149,7 +149,7 @@ typedef struct StgTSO_ { StgMutClosure * mut_link; /* TSO's are mutable of course! */ struct StgTSO_* global_link; /* Links all threads together */ - StgTSOWhatNext whatNext; + StgTSOWhatNext what_next; StgTSOBlockReason why_blocked; StgTSOBlockInfo block_info; struct StgTSO_* blocked_exceptions; @@ -203,12 +203,12 @@ typedef struct StgTSO_ { A zombie thread has the following properties: - tso->whatNext == ThreadComplete or ThreadKilled + tso->what_next == ThreadComplete or ThreadKilled tso->link == (could be on some queue somewhere) tso->su == tso->stack + tso->stack_size tso->sp == tso->stack + tso->stack_size - 1 (i.e. top stack word) - tso->sp[0] == return value of thread, if whatNext == ThreadComplete, - exception , if whatNext == ThreadKilled + tso->sp[0] == return value of thread, if what_next == ThreadComplete, + exception , if what_next == ThreadKilled (tso->sp is left pointing at the top word on the stack so that the return value or exception will be retained by a GC). diff --git a/ghc/rts/Evaluator.c b/ghc/rts/Evaluator.c index 825d38f..0624184 100644 --- a/ghc/rts/Evaluator.c +++ b/ghc/rts/Evaluator.c @@ -5,8 +5,8 @@ * Copyright (c) 1994-1998. * * $RCSfile: Evaluator.c,v $ - * $Revision: 1.40 $ - * $Date: 2000/03/14 14:34:47 $ + * $Revision: 1.41 $ + * $Date: 2000/03/17 13:30:23 $ * ---------------------------------------------------------------------------*/ #include "Rts.h" @@ -1343,7 +1343,7 @@ StgThreadReturnCode enter( Capability* cap, StgClosure* obj0 ) case SE_CAF_BLACKHOLE: { /* Let the scheduler figure out what to do :-) */ - cap->rCurrentTSO->whatNext = ThreadEnterGHC; + cap->rCurrentTSO->what_next = ThreadEnterGHC; xPushCPtr(obj); RETURN(ThreadYielding); } @@ -1454,7 +1454,7 @@ StgThreadReturnCode enter( Capability* cap, StgClosure* obj0 ) case RET_VEC_SMALL: case RET_BIG: case RET_VEC_BIG: - cap->rCurrentTSO->whatNext = ThreadEnterGHC; + cap->rCurrentTSO->what_next = ThreadEnterGHC; xPushCPtr(obj); RETURN(ThreadYielding); default: @@ -1475,7 +1475,7 @@ StgThreadReturnCode enter( Capability* cap, StgClosure* obj0 ) //fprintf(stderr, "entering unknown closure -- yielding to sched\n"); //printObj(obj); //LLL; - cap->rCurrentTSO->whatNext = ThreadEnterGHC; + cap->rCurrentTSO->what_next = ThreadEnterGHC; xPushCPtr(obj); /* code to restart with */ RETURN(ThreadYielding); } diff --git a/ghc/rts/Exception.hc b/ghc/rts/Exception.hc index 6930071..a9c1c9a 100644 --- a/ghc/rts/Exception.hc +++ b/ghc/rts/Exception.hc @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Exception.hc,v 1.9 2000/03/17 10:24:44 simonmar Exp $ + * $Id: Exception.hc,v 1.10 2000/03/17 13:30:23 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -152,7 +152,7 @@ FN_(killThreadzh_fast) /* This thread may have been relocated. * (see Schedule.c:threadStackOverflow) */ - while (R1.t->whatNext == ThreadRelocated) { + while (R1.t->what_next == ThreadRelocated) { R1.t = R1.t->link; } @@ -188,12 +188,12 @@ FN_(killThreadzh_fast) if (R1.t == CurrentTSO) { SaveThreadState(); /* inline! */ STGCALL2(raiseAsync, R1.t, R2.cl); - if (CurrentTSO->whatNext == ThreadKilled) { + if (CurrentTSO->what_next == ThreadKilled) { R1.w = ThreadYielding; JMP_(StgReturn); } LoadThreadState(); - if (CurrentTSO->whatNext == ThreadEnterGHC) { + if (CurrentTSO->what_next == ThreadEnterGHC) { R1.w = Sp[0]; Sp++; JMP_(GET_ENTRY(R1.cl)); diff --git a/ghc/rts/GC.c b/ghc/rts/GC.c index fa22b4e..cba1dbf 100644 --- a/ghc/rts/GC.c +++ b/ghc/rts/GC.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: GC.c,v 1.73 2000/03/16 17:27:12 simonmar Exp $ + * $Id: GC.c,v 1.74 2000/03/17 13:30:24 simonmar Exp $ * * (c) The GHC Team 1998-1999 * @@ -856,7 +856,7 @@ traverse_weak_ptr_list(void) /* Threads which have finished or died get dropped from * the list. */ - switch (t->whatNext) { + switch (t->what_next) { case ThreadKilled: case ThreadComplete: next = t->global_link; @@ -1005,7 +1005,7 @@ isAlive(StgClosure *p) goto large; case TSO: - if (((StgTSO *)p)->whatNext == ThreadRelocated) { + if (((StgTSO *)p)->what_next == ThreadRelocated) { p = (StgClosure *)((StgTSO *)p)->link; continue; } @@ -1591,7 +1591,7 @@ loop: /* Deal with redirected TSOs (a TSO that's had its stack enlarged). */ - if (tso->whatNext == ThreadRelocated) { + if (tso->what_next == ThreadRelocated) { q = (StgClosure *)tso->link; goto loop; } diff --git a/ghc/rts/HeapStackCheck.hc b/ghc/rts/HeapStackCheck.hc index 2d3abca..1b3ba29 100644 --- a/ghc/rts/HeapStackCheck.hc +++ b/ghc/rts/HeapStackCheck.hc @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: HeapStackCheck.hc,v 1.12 2000/03/02 10:11:50 sewardj Exp $ + * $Id: HeapStackCheck.hc,v 1.13 2000/03/17 13:30:24 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -64,7 +64,7 @@ R1.i = StackOverflow; \ } \ SaveThreadState(); \ - CurrentTSO->whatNext = ThreadRunGHC; \ + CurrentTSO->what_next = ThreadRunGHC; \ JMP_(StgReturn); #define GC_ENTER \ @@ -84,42 +84,42 @@ R1.i = StackOverflow; \ } \ SaveThreadState(); \ - CurrentTSO->whatNext = ThreadEnterGHC; \ + CurrentTSO->what_next = ThreadEnterGHC; \ JMP_(StgReturn); #define HP_GENERIC \ SaveThreadState(); \ - CurrentTSO->whatNext = ThreadRunGHC; \ + CurrentTSO->what_next = ThreadRunGHC; \ R1.i = HeapOverflow; \ JMP_(StgReturn); #define STK_GENERIC \ SaveThreadState(); \ - CurrentTSO->whatNext = ThreadRunGHC; \ + CurrentTSO->what_next = ThreadRunGHC; \ R1.i = StackOverflow; \ JMP_(StgReturn); #define YIELD_GENERIC \ SaveThreadState(); \ - CurrentTSO->whatNext = ThreadRunGHC; \ + CurrentTSO->what_next = ThreadRunGHC; \ R1.i = ThreadYielding; \ JMP_(StgReturn); #define YIELD_TO_HUGS \ SaveThreadState(); \ - CurrentTSO->whatNext = ThreadEnterHugs; \ + CurrentTSO->what_next = ThreadEnterHugs; \ R1.i = ThreadYielding; \ JMP_(StgReturn); #define BLOCK_GENERIC \ SaveThreadState(); \ - CurrentTSO->whatNext = ThreadRunGHC; \ + CurrentTSO->what_next = ThreadRunGHC; \ R1.i = ThreadBlocked; \ JMP_(StgReturn); #define BLOCK_ENTER \ SaveThreadState(); \ - CurrentTSO->whatNext = ThreadEnterGHC;\ + CurrentTSO->what_next = ThreadEnterGHC;\ R1.i = ThreadBlocked; \ JMP_(StgReturn); @@ -166,7 +166,7 @@ EXTFUN(stg_gc_enter_1_hponly) Sp[0] = R1.w; R1.i = HeapOverflow; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; JMP_(StgReturn); FE_ } @@ -289,7 +289,7 @@ EXTFUN(gran_yield_0) { FB_ SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadYielding; JMP_(StgReturn); FE_ @@ -301,7 +301,7 @@ EXTFUN(gran_yield_1) Sp -= 1; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadYielding; JMP_(StgReturn); FE_ @@ -316,7 +316,7 @@ EXTFUN(gran_yield_2) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadYielding; JMP_(StgReturn); FE_ @@ -332,7 +332,7 @@ EXTFUN(gran_yield_3) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadYielding; JMP_(StgReturn); FE_ @@ -349,7 +349,7 @@ EXTFUN(gran_yield_4) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadYielding; JMP_(StgReturn); FE_ @@ -367,7 +367,7 @@ EXTFUN(gran_yield_5) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadYielding; JMP_(StgReturn); FE_ @@ -386,7 +386,7 @@ EXTFUN(gran_yield_6) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadYielding; JMP_(StgReturn); FE_ @@ -406,7 +406,7 @@ EXTFUN(gran_yield_7) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadYielding; JMP_(StgReturn); FE_ @@ -427,7 +427,7 @@ EXTFUN(gran_yield_8) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadYielding; JMP_(StgReturn); FE_ @@ -441,7 +441,7 @@ EXTFUN(gran_block_1) Sp -= 1; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadBlocked; JMP_(StgReturn); FE_ @@ -456,7 +456,7 @@ EXTFUN(gran_block_2) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadBlocked; JMP_(StgReturn); FE_ @@ -472,7 +472,7 @@ EXTFUN(gran_block_3) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadBlocked; JMP_(StgReturn); FE_ @@ -489,7 +489,7 @@ EXTFUN(gran_block_4) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadBlocked; JMP_(StgReturn); FE_ @@ -507,7 +507,7 @@ EXTFUN(gran_block_5) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadBlocked; JMP_(StgReturn); FE_ @@ -526,7 +526,7 @@ EXTFUN(gran_block_6) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadBlocked; JMP_(StgReturn); FE_ @@ -546,7 +546,7 @@ EXTFUN(gran_block_7) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadBlocked; JMP_(StgReturn); FE_ @@ -567,7 +567,7 @@ EXTFUN(gran_block_8) Sp[1] = R2.w; Sp[0] = R1.w; SaveThreadState(); - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadBlocked; JMP_(StgReturn); FE_ @@ -596,7 +596,7 @@ EXTFUN(par_block_1_no_jump) EXTFUN(par_jump) { FB_ - CurrentTSO->whatNext = ThreadEnterGHC; + CurrentTSO->what_next = ThreadEnterGHC; R1.i = ThreadBlocked; JMP_(StgReturn); FE_ diff --git a/ghc/rts/Sanity.c b/ghc/rts/Sanity.c index a5d6126..e5a1f50 100644 --- a/ghc/rts/Sanity.c +++ b/ghc/rts/Sanity.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Sanity.c,v 1.16 2000/01/30 10:16:09 simonmar Exp $ + * $Id: Sanity.c,v 1.17 2000/03/17 13:30:24 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -471,12 +471,12 @@ checkTSO(StgTSO *tso) StgOffset stack_size = tso->stack_size; StgPtr stack_end = stack + stack_size; - if (tso->whatNext == ThreadRelocated) { + if (tso->what_next == ThreadRelocated) { checkTSO(tso->link); return; } - if (tso->whatNext == ThreadComplete || tso->whatNext == ThreadKilled) { + if (tso->what_next == ThreadComplete || tso->what_next == ThreadKilled) { /* The garbage collector doesn't bother following any pointers * from dead threads, so don't check sanity here. */ diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index 443c7d5..16295f9 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -1,5 +1,5 @@ /* --------------------------------------------------------------------------- - * $Id: Schedule.c,v 1.54 2000/03/16 17:33:04 simonmar Exp $ + * $Id: Schedule.c,v 1.55 2000/03/17 13:30:24 simonmar Exp $ * * (c) The GHC Team, 1998-2000 * @@ -342,7 +342,7 @@ schedule( void ) StgMainThread *m, **prev; prev = &main_threads; for (m = main_threads; m != NULL; m = m->link) { - switch (m->tso->whatNext) { + switch (m->tso->what_next) { case ThreadComplete: if (m->ret) { *(m->ret) = (StgClosure *)m->tso->sp[0]; @@ -370,10 +370,10 @@ schedule( void ) */ { StgMainThread *m = main_threads; - if (m->tso->whatNext == ThreadComplete - || m->tso->whatNext == ThreadKilled) { + if (m->tso->what_next == ThreadComplete + || m->tso->what_next == ThreadKilled) { main_threads = main_threads->link; - if (m->tso->whatNext == ThreadComplete) { + if (m->tso->what_next == ThreadComplete) { /* we finished successfully, fill in the return value */ if (m->ret) { *(m->ret) = (StgClosure *)m->tso->sp[0]; }; m->stat = Success; @@ -641,7 +641,7 @@ schedule( void ) /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ /* Run the current thread */ - switch (cap->rCurrentTSO->whatNext) { + switch (cap->rCurrentTSO->what_next) { case ThreadKilled: case ThreadComplete: /* Thread already finished, return to scheduler. */ @@ -667,7 +667,7 @@ schedule( void ) barf("Panic: entered a BCO but no bytecode interpreter in this build"); #endif default: - barf("schedule: invalid whatNext field"); + barf("schedule: invalid what_next field"); } /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ @@ -739,7 +739,7 @@ schedule( void ) * GC is finished. */ IF_DEBUG(scheduler, - if (t->whatNext == ThreadEnterHugs) { + if (t->what_next == ThreadEnterHugs) { /* ToDo: or maybe a timer expired when we were in Hugs? * or maybe someone hit ctrl-C */ @@ -779,7 +779,7 @@ schedule( void ) * we get a new one. */ IF_DEBUG(scheduler,belch("thread %ld finished", t->id)); - t->whatNext = ThreadComplete; + t->what_next = ThreadComplete; #if defined(GRAN) // ToDo: endThread(t, CurrentProc); // clean-up the thread #elif defined(PAR) @@ -1033,7 +1033,7 @@ createThread_(nat size, rtsBool have_lock) #if defined(GRAN) SET_GRAN_HDR(tso, ThisPE); #endif - tso->whatNext = ThreadEnterGHC; + tso->what_next = ThreadEnterGHC; /* tso->id needs to be unique. For now we use a heavyweight mutex to * protect the increment operation on next_thread_id. @@ -1675,7 +1675,7 @@ threadStackOverflow(StgTSO *tso) * of the stack, so we don't attempt to scavenge any part of the * dead TSO's stack. */ - tso->whatNext = ThreadRelocated; + tso->what_next = ThreadRelocated; tso->link = dest; tso->sp = (P_)&(tso->stack[tso->stack_size]); tso->su = (StgUpdateFrame *)tso->sp; @@ -2149,7 +2149,7 @@ raiseAsync(StgTSO *tso, StgClosure *exception) StgPtr sp = tso->sp; /* Thread already dead? */ - if (tso->whatNext == ThreadComplete || tso->whatNext == ThreadKilled) { + if (tso->what_next == ThreadComplete || tso->what_next == ThreadKilled) { return; } @@ -2218,7 +2218,7 @@ raiseAsync(StgTSO *tso, StgClosure *exception) */ sp[0] = (W_)ap; tso->sp = sp; - tso->whatNext = ThreadEnterGHC; + tso->what_next = ThreadEnterGHC; return; } @@ -2322,7 +2322,7 @@ raiseAsync(StgTSO *tso, StgClosure *exception) /* We've stripped the entire stack, the thread is now dead. */ sp += sizeofW(StgStopFrame) - 1; sp[0] = (W_)exception; /* save the exception */ - tso->whatNext = ThreadKilled; + tso->what_next = ThreadKilled; tso->su = (StgUpdateFrame *)(sp+1); tso->sp = sp; return; @@ -2419,7 +2419,7 @@ printThreadBlockage(StgTSO *tso) void printThreadStatus(StgTSO *tso) { - switch (tso->whatNext) { + switch (tso->what_next) { case ThreadKilled: fprintf(stderr,"has been killed"); break;