fixing eval in the compiler
Vishal Bhatia [Thu, 27 May 1999 07:56:54 +0000 (00:56 -0700)]
To: perl5-porters@perl.org
Message-ID: <JDIKFDKKLGHHBAAA@my-deja.com>

p4raw-id: //depot/cfgperl@3491

cc_runtime.h
scope.h

index 5b6d2c7..bb9b7dc 100644 (file)
        SPAGAIN;                                \
     } while (0)
 
-#define B_JMPENV_PUSH(cur_env,v) \
-    STMT_START {                                        \
-        cur_env.je_prev = PL_top_env;                   \
-        OP_REG_TO_MEM;                                  \
-        cur_env.je_ret = PerlProc_setjmp(cur_env.je_buf, 1);    \
-        OP_MEM_TO_REG;                                  \
-        PL_top_env = &cur_env;                          \
-        cur_env.je_mustcatch = FALSE;                   \
-        (v) = cur_env.je_ret;                           \
-    } STMT_END
-#define B_JMPENV_POP(cur_env) \
-    STMT_START { PL_top_env = cur_env.je_prev; } STMT_END
 
-#define B_JMPENV_JUMP(cur_env,v) \
-    STMT_START {                                                \
-        OP_REG_TO_MEM;                                          \
-        if (PL_top_env->je_prev)                                        \
-            PerlProc_longjmp(PL_top_env->je_buf, (v));                  \
-        if ((v) == 2)                                           \
-            PerlProc_exit(STATUS_NATIVE_EXPORT);                                \
-        PerlIO_printf(PerlIO_stderr(), "panic: top_env\n");     \
-        PerlProc_exit(1);                                               \
-    } STMT_END    
-
-
-#define PP_ENTERTRY(jmpbuf,label)  {           \
-       int ret;                                \
-       B_JMPENV_PUSH(jmpbuf,ret);                      \
-       switch (ret) {                          \
-       case 1: B_JMPENV_POP(jmpbuf); B_JMPENV_JUMP(jmpbuf,1);  \
-       case 2: B_JMPENV_POP(jmpbuf); B_JMPENV_JUMP(jmpbuf,2);  \
-       case 3: B_JMPENV_POP(jmpbuf); SPAGAIN; goto label;\
-       }                                       \
-    } while (0)
-
-#define PP_LEAVETRY PL_top_env=PL_top_env->je_prev
+#define PP_ENTERTRY(jmpbuf,label)  \
+       STMT_START {                    \
+               int ret;                \
+               JMPENV_PUSH_ENV(jmpbuf,ret);                    \
+               switch (ret) {                          \
+                       case 1: JMPENV_POP_ENV(jmpbuf); JMPENV_JUMP(1);\
+                       case 2: JMPENV_POP_ENV(jmpbuf); JMPENV_JUMP(2);\
+                       case 3: JMPENV_POP_ENV(jmpbuf); SPAGAIN; goto label;\
+               }                                       \
+       } STMT_END
+#define PP_LEAVETRY \
+       STMT_START{ PL_top_env=PL_top_env->je_prev; }STMT_END
diff --git a/scope.h b/scope.h
index b217fea..8358c54 100644 (file)
--- a/scope.h
+++ b/scope.h
@@ -221,7 +221,7 @@ typedef void *(CPERLscope(*protect_proc_t)) _((int *, protect_body_t, ...));
 
 #define dJMPENV                JMPENV cur_env
 
-#define JMPENV_PUSH_INIT(THROWFUNC) \
+#define JMPENV_PUSH_INIT_ENV(cur_env,THROWFUNC) \
     STMT_START {                                       \
        cur_env.je_throw = (THROWFUNC);                 \
        cur_env.je_ret = -1;                            \
@@ -230,23 +230,33 @@ typedef void *(CPERLscope(*protect_proc_t)) _((int *, protect_body_t, ...));
        PL_top_env = &cur_env;                          \
        OP_REG_TO_MEM;                                  \
     } STMT_END
-#define JMPENV_POST_CATCH \
+
+#define JMPENV_PUSH_INIT(THROWFUNC) JMPENV_PUSH_INIT_ENV(cur_env,THROWFUNC) 
+
+#define JMPENV_POST_CATCH_ENV(cur_env) \
     STMT_START {                                       \
        OP_MEM_TO_REG;                                  \
        PL_top_env = &cur_env;                          \
     } STMT_END
 
-#define JMPENV_PUSH(v) \
+#define JMPENV_POST_CATCH JMPENV_POST_CATCH_ENV(cur_env)
+
+
+#define JMPENV_PUSH_ENV(cur_env,v) \
     STMT_START {                                       \
-       JMPENV_PUSH_INIT(NULL);                         \
-       EXCEPT_SET(PerlProc_setjmp(cur_env.je_buf, 1)); \
-       JMPENV_POST_CATCH;                              \
-       (v) = EXCEPT_GET;                               \
+       JMPENV_PUSH_INIT_ENV(cur_env,NULL);                             \
+       EXCEPT_SET_ENV(cur_env,PerlProc_setjmp(cur_env.je_buf, 1));     \
+       JMPENV_POST_CATCH_ENV(cur_env);                         \
+       (v) = EXCEPT_GET_ENV(cur_env);                          \
     } STMT_END
 
-#define JMPENV_POP \
+#define JMPENV_PUSH(v) JMPENV_PUSH_ENV(cur_env,v) 
+
+#define JMPENV_POP_ENV(cur_env) \
     STMT_START { PL_top_env = cur_env.je_prev; } STMT_END
 
+#define JMPENV_POP  JMPENV_POP_ENV(cur_env) 
+
 #define JMPENV_JUMP(v) \
     STMT_START {                                               \
        OP_REG_TO_MEM;                                          \
@@ -262,8 +272,10 @@ typedef void *(CPERLscope(*protect_proc_t)) _((int *, protect_body_t, ...));
        PerlProc_exit(1);                                       \
     } STMT_END
 
-#define EXCEPT_GET     (cur_env.je_ret)
-#define EXCEPT_SET(v)  (cur_env.je_ret = (v))
+#define EXCEPT_GET_ENV(cur_env)        (cur_env.je_ret)
+#define EXCEPT_GET EXCEPT_GET_ENV(cur_env)
+#define EXCEPT_SET_ENV(cur_env,v)      (cur_env.je_ret = (v))
+#define EXCEPT_SET(v) EXCEPT_SET_ENV(cur_env,v)
 
 #define CATCH_GET      (PL_top_env->je_mustcatch)
 #define CATCH_SET(v)   (PL_top_env->je_mustcatch = (v))