Remove runlevel. It was used to count how many runops() calls
Gurusamy Sarathy [Mon, 10 Nov 1997 22:41:31 +0000 (22:41 +0000)]
we were in the process of executing, and longjmp() to the topmost
one (if not already there).  We use a null top_env->je_prev
to distinguish that now.

p4raw-id: //depot/win32/perl@223

embed.h
interp.sym
perl.h
pp_ctl.c
run.c
thread.h
util.c

diff --git a/embed.h b/embed.h
index 46709be..2c5bf1b 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define restartop              (curinterp->Irestartop)
 #define rightgv                        (curinterp->Irightgv)
 #define rs                     (curinterp->Irs)
-#define runlevel               (curinterp->Irunlevel)
 #define sawampersand           (curinterp->Isawampersand)
 #define sawstudy               (curinterp->Isawstudy)
 #define sawvec                 (curinterp->Isawvec)
 #define Irestartop             restartop
 #define Irightgv               rightgv
 #define Irs                    rs
-#define Irunlevel              runlevel
 #define Isawampersand          sawampersand
 #define Isawstudy              sawstudy
 #define Isawvec                        sawvec
 #define restartop              Perl_restartop
 #define rightgv                        Perl_rightgv
 #define rs                     Perl_rs
-#define runlevel               Perl_runlevel
 #define sawampersand           Perl_sawampersand
 #define sawstudy               Perl_sawstudy
 #define sawvec                 Perl_sawvec
index ae064a8..a12ea99 100644 (file)
@@ -111,7 +111,6 @@ preprocess
 restartop
 rightgv
 rs
-runlevel
 sawampersand
 sawstudy
 sawvec
diff --git a/perl.h b/perl.h
index 8e82d2d..0523187 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1943,7 +1943,6 @@ IEXT I32  Icxstack_ix IINIT(-1);
 IEXT I32       Icxstack_max IINIT(128);
 IEXT JMPENV    Istart_env;     /* empty startup sigjmp() environment */
 IEXT JMPENV *  Itop_env;       /* ptr. to current sigjmp() environment */
-IEXT I32       Irunlevel;
 
 /* stack stuff */
 IEXT AV *      Icurstack;              /* THE STACK */
index 915ee6c..f8cff58 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2079,20 +2079,18 @@ OP *o;
 {
     dTHR;
     int ret;
-    I32 oldrunlevel = runlevel;
     OP *oldop = op;
     dJMPENV;
 
     op = o;
 #ifdef DEBUGGING
     assert(CATCH_GET == TRUE);
-    DEBUG_l(deb("(Setting up local jumplevel, runlevel = %ld)\n", (long)runlevel+1));
+    DEBUG_l(deb("Setting up local jumplevel %p, was %p\n", &cur_env, top_env));
 #endif
     JMPENV_PUSH(ret);
     switch (ret) {
     default:                           /* topmost level handles it */
        JMPENV_POP;
-       runlevel = oldrunlevel;
        op = oldop;
        JMPENV_JUMP(ret);
        /* NOTREACHED */
@@ -2109,7 +2107,6 @@ OP *o;
        break;
     }
     JMPENV_POP;
-    runlevel = oldrunlevel;
     op = oldop;
     return Nullop;
 }
diff --git a/run.c b/run.c
index 1e1001d..87633d1 100644 (file)
--- a/run.c
+++ b/run.c
@@ -22,8 +22,6 @@ dEXT char *watchok;
 int
 runops_standard() {
     dTHR;
-    SAVEI32(runlevel);
-    runlevel++;
 
     while ( op = (*op->op_ppaddr)(ARGS) ) ;
 
@@ -42,9 +40,6 @@ runops_debug() {
        return 0;
     }
 
-    SAVEI32(runlevel);
-    runlevel++;
-
     do {
        if (debug) {
            if (watchaddr != 0 && *watchaddr != watchok)
index f18b38b..4f32247 100644 (file)
--- a/thread.h
+++ b/thread.h
@@ -211,7 +211,6 @@ struct thread {
     AV *       Tcurstack;
     AV *       Tmainstack;
     JMPENV *   Ttop_env;
-    I32                Trunlevel;
 
     /* XXX Sort stuff, firstgv, secongv and so on? */
 
@@ -310,7 +309,6 @@ typedef struct condpair {
 #undef  start_env
 #undef toptarget
 #undef top_env
-#undef runlevel
 #undef in_eval
 #undef restartop
 #undef delaymagic
@@ -382,7 +380,6 @@ typedef struct condpair {
 #define localizing     (thr->Tlocalizing)
 
 #define        top_env         (thr->Ttop_env)
-#define        runlevel        (thr->Trunlevel)
 #define start_env       (thr->Tstart_env)
 
 #else
diff --git a/util.c b/util.c
index f11c665..9da5b7b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1170,7 +1170,6 @@ die(pat, va_alist)
     dTHR;
     va_list args;
     char *message;
-    I32 oldrunlevel = runlevel;
     int was_in_eval = in_eval;
     HV *stash;
     GV *gv;
@@ -1231,10 +1230,10 @@ die(pat, va_alist)
     restartop = die_where(message);
 #ifdef USE_THREADS
     DEBUG_L(PerlIO_printf(PerlIO_stderr(),
-         "%p: die: restartop = %p, was_in_eval = %d, oldrunlevel = %d\n",
-         thr, restartop, was_in_eval, oldrunlevel));
+         "%p: die: restartop = %p, was_in_eval = %d, top_env = %p\n",
+         thr, restartop, was_in_eval, top_env));
 #endif /* USE_THREADS */
-    if ((!restartop && was_in_eval) || oldrunlevel > 1)
+    if ((!restartop && was_in_eval) || top_env->je_prev)
        JMPENV_JUMP(3);
     return restartop;
 }
@@ -2549,8 +2548,6 @@ struct thread *t;
     start_env.je_mustcatch = TRUE;
     top_env  = &start_env;
 
-    runlevel = 0;              /* Let entering sub do increment */
-
     in_eval = FALSE;
     restartop = 0;