diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-01-28 19:02:21 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-01-28 19:02:21 +0000 |
commit | f627f77f23d1497c9e1f4269b5c8812d12b42f18 (patch) | |
tree | 708772d83a8355e25155cf233d5a9e38f8ad4d96 /src/runtime/interp.r | |
parent | 6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1 (diff) | |
download | icon-f627f77f23d1497c9e1f4269b5c8812d12b42f18.tar.gz |
Imported Upstream version 9.5.0upstream/9.5.0upstream
Diffstat (limited to 'src/runtime/interp.r')
-rw-r--r-- | src/runtime/interp.r | 585 |
1 files changed, 3 insertions, 582 deletions
diff --git a/src/runtime/interp.r b/src/runtime/interp.r index c5fd713..6955b8f 100644 --- a/src/runtime/interp.r +++ b/src/runtime/interp.r @@ -1,4 +1,3 @@ -#if !COMPILER /* * File: interp.r * The interpreter proper. @@ -8,20 +7,7 @@ extern fptr fncentry[]; - -/* - * Prototypes for static functions. - */ -#ifdef EventMon -static struct ef_marker *vanq_bound (struct ef_marker *efp_v, - struct gf_marker *gfp_v); -static void vanq_proc (struct ef_marker *efp_v, - struct gf_marker *gfp_v); -#endif /* EventMon */ - -#ifndef MultiThread word lastop; /* Last operator evaluated */ -#endif /* MultiThread */ /* * Istate variables. @@ -37,32 +23,17 @@ struct descrip eret_tmp; /* eret value during unwinding */ int coexp_act; /* last co-expression action */ -#ifndef MultiThread dptr xargp; word xnargs; -#endif /* MultiThread */ /* * Macros for use inside the main loop of the interpreter. */ -#ifdef EventMon -#define E_Misc -1 -#define E_Operator 0 -#define E_Function 1 -#endif /* EventMon */ - /* * Setup_Op sets things up for a call to the C function for an operator. - * InterpEVValD expands to nothing if EventMon is not defined. */ #begdef Setup_Op(nargs) -#ifdef EventMon - lastev = E_Operator; - value_tmp.dword = D_Proc; - value_tmp.vword.bptr = (union block *)&op_tbl[lastop - 1]; - InterpEVValD(&value_tmp, E_Ocall); -#endif /* EventMon */ rargp = (dptr)(rsp - 1) - nargs; xargp = rargp; ExInterp; @@ -74,9 +45,6 @@ word xnargs; * operators. */ #begdef Setup_Arg(nargs) -#ifdef EventMon - lastev = E_Misc; -#endif /* EventMon */ rargp = (dptr)(rsp - 1) - nargs; xargp = rargp; ExInterp; @@ -84,17 +52,10 @@ word xnargs; #begdef Call_Cond if ((*(optab[lastop]))(rargp) == A_Resume) { -#ifdef EventMon - InterpEVVal((word)-1, E_Ofail); -#endif /* EventMon */ goto efail_noev; } rsp = (word *) rargp + 1; -#ifdef EventMon - goto return_term; -#else /* EventMon */ break; -#endif /* EventMon */ #enddef /* Call_Cond */ /* @@ -169,20 +130,7 @@ dptr cargp; extern int (*optab[])(); extern int (*keytab[])(); struct b_proc *bproc; -#ifdef EventMon - int lastev = E_Misc; -#endif /* EventMon */ - -#ifdef TallyOpt - extern word tallybin[]; -#endif /* TallyOpt */ - -#ifdef EventMon - EVVal(fsig, E_Intcall); - EVVal(DiffPtrs(sp, stack), E_Stack); -#endif /* EventMon */ -#ifndef MultiThread /* * Make a stab at catching interpreter stack overflow. This does * nothing for invocation in a co-expression other than &main. @@ -190,7 +138,6 @@ dptr cargp; if (BlkLoc(k_current) == BlkLoc(k_main) && ((char *)sp + PerilDelta) > (char *)stackend) fatalerr(301, NULL); -#endif /* MultiThread */ #ifdef Polling if (!pollctr--) { @@ -203,18 +150,7 @@ dptr cargp; EntInterp; -#ifdef EventMon - switch (fsig) { - case G_Csusp: - case G_Fsusp: - case G_Osusp: - value_tmp = *(dptr)(rsp - 1); /* argument */ - Deref(value_tmp); - InterpEVValD(&value_tmp, - (fsig == G_Fsusp)?E_Fsusp:(fsig == G_Osusp?E_Osusp:E_Bsusp)); -#else /* EventMon */ if (fsig == G_Csusp) { -#endif /* EventMon */ oldsp = rsp; @@ -256,96 +192,7 @@ dptr cargp; */ for (;;) { - -#ifdef EventMon - - /* - * Location change events are generated by checking to see if the opcode - * has changed indices in the "line number" (now line + column) table; - * "straight line" forward code does not require a binary search to find - * the new location; instead, a pointer is simply incremented. - * Further optimization here is planned. - */ - if (!is:null(curpstate->eventmask) && ( - Testb((word)E_Loc, curpstate->eventmask) || - Testb((word)E_Line, curpstate->eventmask) - )) { - - if (InRange(code, ipc.opnd, ecode)) { - uword ipc_offset = DiffPtrs((char *)ipc.opnd, (char *)code); - uword size; - word temp_no; - if (!current_line_ptr || - current_line_ptr->ipc > ipc_offset || - current_line_ptr[1].ipc <= ipc_offset) { -#ifdef LineCodes -#ifdef Polling - if (!pollctr--) { - ExInterp; - pollctr = pollevent(); - EntInterp; - if (pollctr == -1) fatalerr(141, NULL); - } -#endif /* Polling */ -#endif /* LineCodes */ - - - if(current_line_ptr && - current_line_ptr + 2 < elines && - current_line_ptr[1].ipc < ipc_offset && - ipc_offset < current_line_ptr[2].ipc) { - current_line_ptr ++; - } - else { - current_line_ptr = ilines; - size = DiffPtrs((char *)elines, (char *)ilines) / - sizeof(struct ipc_line *); - while (size > 1) { - if (ipc_offset >= current_line_ptr[size>>1].ipc) { - current_line_ptr = ¤t_line_ptr[size>>1]; - size -= (size >> 1); - } - else { - size >>= 1; - } - } - } - linenum = current_line_ptr->line; - temp_no = linenum & 65535; - if ((lastline & 65535) != temp_no) { - if (Testb((word)E_Line, curpstate->eventmask)) - if (temp_no) - InterpEVVal(temp_no, E_Line); - } - if (lastline != linenum) { - lastline = linenum; - if (Testb((word)E_Loc, curpstate->eventmask) && - current_line_ptr->line >> 16) - InterpEVVal(current_line_ptr->line, E_Loc); - } - } - } - } -#endif /* EventMon */ - lastop = GetOp; /* Instruction fetch */ - -#ifdef EventMon - /* - * If we've asked for ALL opcode events, or specifically for this one - * generate an MT-style event. - */ - if ((!is:null(curpstate->eventmask) && - Testb((word)E_Opcode, curpstate->eventmask)) && - (is:null(curpstate->opcodemask) || - Testb((word)lastop, curpstate->opcodemask))) { - ExInterp; - MakeInt(lastop, &(curpstate->parent->eventval)); - actparent(E_Opcode); - EntInterp - } -#endif /* EventMon */ - switch ((int)lastop) { /* * Switch on opcode. The cases are * organized roughly by functionality @@ -564,23 +411,12 @@ dptr cargp; if (pollctr == -1) fatalerr(141, NULL); } #endif /* Polling */ - - #endif /* LineCodes */ break; - case Op_Colm: /* source column number */ { -#ifdef EventMon - word loc; - column = GetWord; - loc = column; - loc <<= (WordBits >> 1); /* column in high-order part */ - loc += linenum; - InterpEVVal(loc, E_Loc); -#endif /* EventMon */ break; } @@ -595,15 +431,7 @@ dptr cargp; if (pollctr == -1) fatalerr(141, NULL); } #endif /* Polling */ - - #endif /* LineCodes */ - -#ifdef EventMon - linenum = GetWord; - lastline = linenum; -#endif /* EventMon */ - break; /* ---String Scanning--- */ @@ -639,7 +467,6 @@ dptr cargp; bp = BlkLoc(value_tmp); args = (int)bp->list.size; -#ifndef MultiThread /* * Make a stab at catching interpreter stack overflow. * This does nothing for invocation in a co-expression other @@ -649,14 +476,9 @@ dptr cargp; ((char *)sp + args * sizeof(struct descrip) > (char *)stackend)) fatalerr(301, NULL); -#endif /* MultiThread */ for (bp = bp->list.listhead; -#ifdef ListFix - BlkType(bp) == T_Lelem; -#else /* ListFix */ - bp != NULL; -#endif /* ListFix */ + bp != NULL; bp = bp->lelem.listnext) { for (i = 0; i < bp->lelem.nused; i++) { j = bp->lelem.first + i; @@ -719,52 +541,20 @@ invokej: } #endif /* Polling */ -#ifdef EventMon - lastev = E_Function; - InterpEVValD(rargp, E_Fcall); -#endif /* EventMon */ - bproc = (struct b_proc *)BlkLoc(*rargp); -#ifdef FncTrace - typedef int (*bfunc2)(dptr, struct descrip *); -#endif /* FncTrace */ - - /* ExInterp not needed since no change since last EntInterp */ if (type == I_Vararg) { int (*bfunc)(); bfunc = bproc->entryp.ccode; - -#ifdef FncTrace - signal = (*bfunc)(nargs, rargp, &(procs->pname)); -#else /* FncTrace */ signal = (*bfunc)(nargs,rargp); -#endif /* FncTrace */ - } else { int (*bfunc)(); bfunc = bproc->entryp.ccode; - -#ifdef FncTrace - signal = (*(bfunc2)bfunc)(rargp, &(bproc->pname)); -#else /* FncTrace */ signal = (*bfunc)(rargp); -#endif /* FncTrace */ - } - -#ifdef FncTrace - if (k_ftrace) { - k_ftrace--; - if (signal == A_Failure) - failtrace(&(bproc->pname)); - else - rtrace(&(bproc->pname),rargp); } -#endif /* FncTrace */ - goto C_rtn_term; } } @@ -781,19 +571,7 @@ invokej: case Op_Llist: /* construct list */ opnd = GetWord; - -#ifdef EventMon - lastev = E_Operator; - value_tmp.dword = D_Proc; - value_tmp.vword.bptr = (union block *)&mt_llist; - InterpEVValD(&value_tmp, E_Ocall); - rargp = (dptr)(rsp - 1) - opnd; - xargp = rargp; - ExInterp; -#else /* EventMon */ Setup_Arg(opnd); -#endif /* EventMon */ - { int i; for (i=1;i<=opnd;i++) @@ -840,13 +618,6 @@ mark0: break; case Op_Unmark: /* remove expression frame */ - -#ifdef EventMon - ExInterp; - vanq_bound(efp, gfp); - EntInterp; -#endif /* EventMon */ - gfp = efp->ef_gfp; rsp = (word *)efp - 1; @@ -858,12 +629,6 @@ Unmark_uw: --ilevel; ExInterp; - -#ifdef EventMon - EVVal(A_Unmark_uw, E_Intret); - EVVal(DiffPtrs(sp, stack), E_Stack); -#endif /* EventMon */ - return A_Unmark_uw; } @@ -972,13 +737,6 @@ Unmark_uw: * limit not been reached). */ *lval = *(dptr)(rsp - 1); - -#ifdef EventMon - ExInterp; - vanq_bound(efp, gfp); - EntInterp; -#endif /* EventMon */ - gfp = efp->ef_gfp; /* @@ -989,12 +747,6 @@ Lsusp_uw: if (efp->ef_ilevel < ilevel) { --ilevel; ExInterp; - -#ifdef EventMon - EVVal(A_Lsusp_uw, E_Intret); - EVVal(DiffPtrs(sp, stack), E_Stack); -#endif /* EventMon */ - return A_Lsusp_uw; } rsp = (word *)efp - 1; @@ -1016,13 +768,6 @@ Lsusp_uw: struct descrip tmp; dptr svalp; struct b_proc *sproc; - -#ifdef EventMon - value_tmp = *(dptr)(rsp - 1); /* argument */ - Deref(value_tmp); - InterpEVValD(&value_tmp, E_Psusp); -#endif /* EventMon */ - svalp = (dptr)(rsp - 1); if (Var(*svalp)) { ExInterp; @@ -1082,11 +827,6 @@ Lsusp_uw: * a saved state, switch environments. */ if (pfp->pf_scan != NULL) { - -#ifdef EventMon - InterpEVValD(&k_subject, E_Ssusp); -#endif /* EventMon */ - tmp = k_subject; k_subject = *pfp->pf_scan; *pfp->pf_scan = tmp; @@ -1096,14 +836,6 @@ Lsusp_uw: k_pos = IntVal(tmp); } -#ifdef MultiThread - /* - * If the program state changed for this procedure call, - * change back. - */ - ENTERPSTATE(pfp->pf_prog); -#endif /* MultiThread */ - efp = pfp->pf_efp; ipc = pfp->pf_ipc; glbl_argp = pfp->pf_argp; @@ -1132,12 +864,6 @@ Eret_uw: if (efp->ef_ilevel < ilevel) { --ilevel; ExInterp; - -#ifdef EventMon - EVVal(A_Eret_uw, E_Intret); - EVVal(DiffPtrs(sp, stack), E_Stack); -#endif /* EventMon */ - return A_Eret_uw; } rsp = (word *)efp - 1; @@ -1148,11 +874,6 @@ Eret_uw: case Op_Pret: { /* return from procedure */ -#ifdef EventMon - struct descrip oldargp; - static struct descrip unwinder; -#endif /* EventMon */ - /* * An Icon procedure is returning a value. Determine if the * value being returned should be dereferenced and if so, @@ -1163,14 +884,6 @@ Eret_uw: */ struct b_proc *rproc; rproc = (struct b_proc *)BlkLoc(*glbl_argp); -#ifdef EventMon - oldargp = *glbl_argp; - ExInterp; - vanq_proc(efp, gfp); - EntInterp; - /* used to InterpEVValD(argp,E_Pret); here */ -#endif /* EventMon */ - *glbl_argp = *(dptr)(rsp - 1); if (Var(*glbl_argp)) { ExInterp; @@ -1187,20 +900,9 @@ Pret_uw: if (pfp->pf_ilevel < ilevel) { --ilevel; ExInterp; - -#ifdef EventMon - EVVal(A_Pret_uw, E_Intret); - EVVal(DiffPtrs(sp, stack), E_Stack); - unwinder = oldargp; -#endif /* EventMon */ - return A_Pret_uw; } -#ifdef EventMon - if (!is:proc(oldargp) && is:proc(unwinder)) - oldargp = unwinder; -#endif /* EventMon */ rsp = (word *)glbl_argp + 1; efp = pfp->pf_efp; gfp = pfp->pf_gfp; @@ -1208,15 +910,6 @@ Pret_uw: glbl_argp = pfp->pf_argp; pfp = pfp->pf_pfp; -#ifdef MultiThread - if (pfp) - ENTERPSTATE(pfp->pf_prog); -#ifdef EventMon - value_tmp = *(dptr)(rsp - 1); /* argument */ - Deref(value_tmp); - InterpEVValD(&value_tmp, E_Pret); -#endif /* EventMon */ -#endif /* MultiThread */ break; } @@ -1224,9 +917,6 @@ Pret_uw: case Op_Efail: efail: -#ifdef EventMon - InterpEVVal((word)-1, E_Efail); -#endif /* EventMon */ efail_noev: /* * Failure has occurred in the current expression frame. @@ -1243,12 +933,6 @@ efail_noev: * structures that fail when complete. */ -#ifdef MultiThread - if (efp == 0) { - break; - } -#endif /* MultiThread */ - ipc = efp->ef_failure; gfp = efp->ef_gfp; rsp = (word *)efp - 1; @@ -1298,58 +982,22 @@ efail_noev: tmp = *(pfp->pf_scan + 1); IntVal(*(pfp->pf_scan + 1)) = k_pos; k_pos = IntVal(tmp); - -#ifdef EventMon - InterpEVValD(&k_subject, E_Sresum); -#endif /* EventMon */ } -#ifdef MultiThread - /* - * Enter the program state of the resumed frame - */ - ENTERPSTATE(pfp->pf_prog); -#endif /* MultiThread */ - ++k_level; /* adjust procedure level */ } switch (type) { -#ifdef EventMon - case G_Fsusp: - InterpEVVal((word)0, E_Fresum); - --ilevel; - ExInterp; - EVVal(A_Resume, E_Intret); - EVVal(DiffPtrs(sp, stack), E_Stack); - return A_Resume; - - case G_Osusp: - InterpEVVal((word)0, E_Oresum); - --ilevel; - ExInterp; - EVVal(A_Resume, E_Intret); - EVVal(DiffPtrs(sp, stack), E_Stack); - return A_Resume; -#endif /* EventMon */ - case G_Csusp: - InterpEVVal((word)0, E_Eresum); --ilevel; ExInterp; -#ifdef EventMon - EVVal(A_Resume, E_Intret); - EVVal(DiffPtrs(sp, stack), E_Stack); -#endif /* EventMon */ return A_Resume; case G_Esusp: - InterpEVVal((word)0, E_Eresum); goto efail_noev; case G_Psusp: /* resuming a procedure */ - InterpEVValD(glbl_argp, E_Presum); break; } @@ -1357,14 +1005,6 @@ efail_noev: } case Op_Pfail: { /* fail from procedure */ - -#ifdef EventMon - ExInterp; - vanq_proc(efp, gfp); - EVValD(glbl_argp, E_Pfail); - EntInterp; -#endif /* EventMon */ - /* * An Icon procedure is failing. Generate tracing message if * tracing is on. Deactivate inactive C generators created @@ -1382,10 +1022,6 @@ Pfail_uw: if (pfp->pf_ilevel < ilevel) { --ilevel; ExInterp; -#ifdef EventMon - EVVal(A_Pfail_uw, E_Intret); - EVVal(DiffPtrs(sp, stack), E_Stack); -#endif /* EventMon */ return A_Pfail_uw; } efp = pfp->pf_efp; @@ -1393,17 +1029,6 @@ Pfail_uw: ipc = pfp->pf_ipc; glbl_argp = pfp->pf_argp; pfp = pfp->pf_pfp; - -#ifdef MultiThread - /* - * Enter the program state of the procedure being reentered. - * A NULL pfp indicates the program is complete. - */ - if (pfp) { - ENTERPSTATE(pfp->pf_prog); - } -#endif /* MultiThread */ - goto efail_noev; } /* ---Odds and Ends--- */ @@ -1478,12 +1103,6 @@ Pfail_uw: } goto mark0; -#ifdef TallyOpt - case Op_Tally: /* tally */ - tallybin[GetWord]++; - break; -#endif /* TallyOpt */ - case Op_Pnull: /* push null descriptor */ PushNull; break; @@ -1511,27 +1130,14 @@ Pfail_uw: /* ---Co-expressions--- */ case Op_Create: /* create */ - -#ifdef Coexpr PushNull; Setup_Arg(0); opnd = GetWord; opnd += (word)ipc.opnd; - signal = Ocreate((word *)opnd, rargp); - goto C_rtn_term; -#else /* Coexpr */ - err_msg(401, NULL); - goto efail; -#endif /* Coexpr */ case Op_Coact: { /* @e */ - -#ifndef Coexpr - err_msg(401, NULL); - goto efail; -#else /* Coexpr */ struct b_coexpr *ncp; dptr dp; @@ -1553,15 +1159,10 @@ Pfail_uw: goto efail_noev; else rsp -= 2; -#endif /* Coexpr */ break; } case Op_Coret: { /* return from co-expression */ - -#ifndef Coexpr - syserr("co-expression return, but co-expressions not implemented"); -#else /* Coexpr */ struct b_coexpr *ncp; ExInterp; @@ -1570,16 +1171,11 @@ Pfail_uw: ++BlkLoc(k_current)->coexpr.size; co_chng(ncp, (dptr)&sp[-1], NULL, A_Coret, 1); EntInterp; -#endif /* Coexpr */ break; } case Op_Cofail: { /* fail from co-expression */ - -#ifndef Coexpr - syserr("co-expression failure, but co-expressions not implemented"); -#else /* Coexpr */ struct b_coexpr *ncp; ExInterp; @@ -1587,7 +1183,6 @@ Pfail_uw: co_chng(ncp, NULL, NULL, A_Cofail, 1); EntInterp; -#endif /* Coexpr */ break; } @@ -1600,8 +1195,8 @@ Pfail_uw: default: { char buf[50]; - sprintf(buf, "unimplemented opcode: %ld (0x%08x)\n", - (long)lastop, lastop); + sprintf(buf, "unimplemented opcode: %ld (0x%08lx)\n", + (long)lastop, (long)lastop); syserr(buf); } } @@ -1613,73 +1208,25 @@ C_rtn_term: switch (signal) { case A_Resume: -#ifdef EventMon - if ((lastev == E_Function) || (lastev == E_Operator)) { - InterpEVVal((word)-1, - ((lastev == E_Function)? E_Ffail : E_Ofail)); - lastev = E_Misc; - } -#endif /* EventMon */ goto efail_noev; case A_Unmark_uw: /* unwind for unmark */ -#ifdef EventMon - if ((lastev == E_Function) || (lastev == E_Operator)) { - InterpEVVal((word)0, ((lastev==E_Function) ? E_Frem:E_Orem)); - lastev = E_Misc; - } -#endif /* EventMon */ goto Unmark_uw; case A_Lsusp_uw: /* unwind for lsusp */ -#ifdef EventMon - if ((lastev == E_Function) || (lastev == E_Operator)) { - InterpEVVal((word)0, ((lastev==E_Function) ? E_Frem:E_Orem)); - lastev = E_Misc; - } -#endif /* EventMon */ goto Lsusp_uw; case A_Eret_uw: /* unwind for eret */ -#ifdef EventMon - if ((lastev == E_Function) || (lastev == E_Operator)) { - InterpEVVal((word)0, ((lastev==E_Function) ? E_Frem:E_Orem)); - lastev = E_Misc; - } -#endif /* EventMon */ goto Eret_uw; case A_Pret_uw: /* unwind for pret */ -#ifdef EventMon - if ((lastev == E_Function) || (lastev == E_Operator)) { - InterpEVVal((word)0, ((lastev==E_Function) ? E_Frem:E_Orem)); - lastev = E_Misc; - } -#endif /* EventMon */ goto Pret_uw; case A_Pfail_uw: /* unwind for pfail */ -#ifdef EventMon - if ((lastev == E_Function) || (lastev == E_Operator)) { - InterpEVVal((word)0, ((lastev==E_Function) ? E_Frem:E_Orem)); - lastev = E_Misc; - } -#endif /* EventMon */ goto Pfail_uw; } rsp = (word *)rargp + 1; /* set rsp to result */ - -#ifdef EventMon -return_term: - value_tmp = *(dptr)(rsp - 1); /* argument */ - Deref(value_tmp); - if ((lastev == E_Function) || (lastev == E_Operator)) { - InterpEVValD(&value_tmp, ((lastev == E_Function) ? E_Fret:E_Oret)); - lastev = E_Misc; - } -#endif /* EventMon */ - continue; } @@ -1690,129 +1237,3 @@ interp_quit: /*NOTREACHED*/ return 0; /* avoid gcc warning */ } - -#ifdef EventMon -/* - * vanq_proc - monitor the removal of suspended operations from within - * a procedure. - */ -static void vanq_proc(efp_v, gfp_v) -struct ef_marker *efp_v; -struct gf_marker *gfp_v; - { - - if (is:null(curpstate->eventmask)) - return; - - /* - * Go through all the bounded expression of the procedure. - */ - while ((efp_v = vanq_bound(efp_v, gfp_v)) != NULL) { - gfp_v = efp_v->ef_gfp; - efp_v = efp_v->ef_efp; - } - } - -/* - * vanq_bound - monitor the removal of suspended operations from - * the current bounded expression and return the expression frame - * pointer for the bounded expression. - */ -static struct ef_marker *vanq_bound(efp_v, gfp_v) -struct ef_marker *efp_v; -struct gf_marker *gfp_v; - { - - if (is:null(curpstate->eventmask)) - return efp_v; - - while (gfp_v != 0) { /* note removal of suspended operations */ - switch ((int)gfp_v->gf_gentype) { - case G_Psusp: - EVValD(gfp_v->gf_argp, E_Prem); - break; - /* G_Fsusp and G_Osusp handled in-line during unwinding */ - case G_Esusp: - EVVal((word)0, E_Erem); - break; - } - - if (((int)gfp_v->gf_gentype) == G_Psusp) { - vanq_proc(gfp_v->gf_efp, gfp_v->gf_gfp); - efp_v = gfp_v->gf_pfp->pf_efp; /* efp before the call */ - gfp_v = gfp_v->gf_pfp->pf_gfp; /* gfp before the call */ - } - else { - efp_v = gfp_v->gf_efp; - gfp_v = gfp_v->gf_gfp; - } - } - - return efp_v; - } -#endif /* EventMon */ - -#ifdef MultiThread -/* - * activate some other co-expression from an arbitrary point in - * the interpreter. - */ -int mt_activate(tvalp,rslt,ncp) -dptr tvalp, rslt; -register struct b_coexpr *ncp; -{ - register struct b_coexpr *ccp = (struct b_coexpr *)BlkLoc(k_current); - int first, rv; - - dptr savedtvalloc = NULL; - /* - * Set activator in new co-expression. - */ - if (ncp->es_actstk == NULL) { - Protect(ncp->es_actstk = alcactiv(), { err_msg(0, NULL); exit(1); }); - /* - * If no one ever explicitly activates this co-expression, fail to - * the implicit activator. - */ - ncp->es_actstk->arec[0].activator = ccp; - first = 0; - } - else - first = 1; - - if(ccp->tvalloc) { - if (InRange(blkbase,ccp->tvalloc,blkfree)) { - fprintf(stderr, - "Multiprogram garbage collection disaster in mt_activate()!\n"); - fflush(stderr); - exit(1); - } - savedtvalloc = ccp->tvalloc; - } - - rv = co_chng(ncp, tvalp, rslt, A_MTEvent, first); - - if ((savedtvalloc != NULL) && (savedtvalloc != ccp->tvalloc)) { - fprintf(stderr,"averted co-expression disaster in activate\n"); - ccp->tvalloc = savedtvalloc; - } - - return rv; -} - - -/* - * activate the "&parent" co-expression from anywhere, if there is one - */ -void actparent(event) -int event; - { - struct progstate *parent = curpstate->parent; - - StrLen(parent->eventcode) = 1; - StrLoc(parent->eventcode) = (char *)&allchars[event & 0xFF]; - mt_activate(&(parent->eventcode), NULL, - (struct b_coexpr *)curpstate->parent->Mainhead); - } -#endif /* MultiThread */ -#endif /* !COMPILER */ |