/* -----------------------------------------------------------------------------
- * $Id: Exception.hc,v 1.9 2000/03/17 10:24:44 simonmar Exp $
+ * $Id: Exception.hc,v 1.14 2000/05/25 09:16:56 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
#if defined(PAR)
# include "FetchMe.h"
#endif
+#if defined(PROFILING)
+# include "Profiling.h"
+#endif
/* -----------------------------------------------------------------------------
Exception Primitives
/* 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;
}
if (R1.t == CurrentTSO) {
SaveThreadState(); /* inline! */
STGCALL2(raiseAsync, R1.t, R2.cl);
- if (CurrentTSO->whatNext == ThreadKilled) {
- R1.w = ThreadYielding;
+ if (CurrentTSO->what_next == ThreadKilled) {
+ R1.w = ThreadFinished;
JMP_(StgReturn);
}
LoadThreadState();
- if (CurrentTSO->whatNext == ThreadEnterGHC) {
+ if (CurrentTSO->what_next == ThreadEnterGHC) {
R1.w = Sp[0];
Sp++;
JMP_(GET_ENTRY(R1.cl));
STGFUN(catch_entry)
{
FB_
- R2.cl = payloadCPtr(R1.cl,1); /* h */
- R1.cl = payloadCPtr(R1.cl,0); /* x */
+ R2.cl = R1.cl->payload[1]; /* h */
+ R1.cl = R1.cl->payload[0]; /* x */
JMP_(catchzh_fast);
FE_
}
* It is used in raisezh_fast to update thunks on the update list
* -------------------------------------------------------------------------- */
-INFO_TABLE(raise_info,raise_entry,1,0,FUN,,EF_,0,0);
+INFO_TABLE(raise_info,raise_entry,1,0,THUNK,,EF_,0,0);
STGFUN(raise_entry)
{
FB_
StgUpdateFrame *p;
StgClosure *raise_closure;
FB_
- /* args : R1 = error */
+ /* args : R1 = exception */
#if defined(PROFILING)
break;
case STOP_FRAME:
- barf("raisezh_fast: STOP_FRAME");
-
+ /* We've stripped the entire stack, the thread is now dead. */
+ Sp = CurrentTSO->stack + CurrentTSO->stack_size - 1;
+ Sp[0] = R1.w; /* save the exception */
+ Su = (StgUpdateFrame *)(Sp+1);
+ CurrentTSO->what_next = ThreadKilled;
+ SaveThreadState(); /* inline! */
+ R1.w = ThreadFinished;
+ JMP_(StgReturn);
+
default:
barf("raisezh_fast: weird activation record");
}