This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Correct several Stratus VOS build issues
[perl5.git] / scope.h
diff --git a/scope.h b/scope.h
index e6a4209..f0abb72 100644 (file)
--- a/scope.h
+++ b/scope.h
 #define SAVEt_I8               32
 #define SAVEt_COMPPAD          33
 #define SAVEt_GENERIC_PVREF    34
+#define SAVEt_PADSV            35
+#define SAVEt_MORTALIZESV      36
+
+#ifndef SCOPE_SAVES_SIGNAL_MASK
+#define SCOPE_SAVES_SIGNAL_MASK 0
+#endif
 
 #define SSCHECK(need) if (PL_savestack_ix + need > PL_savestack_max) savestack_grow()
 #define SSPUSHINT(i) (PL_savestack[PL_savestack_ix++].any_i32 = (I32)(i))
@@ -49,6 +55,8 @@
 #define SSPOPDXPTR (PL_savestack[--PL_savestack_ix].any_dxptr)
 
 /*
+=head1 Callback Functions
+
 =for apidoc Ams||SAVETMPS
 Opening bracket for temporaries on a callback.  See C<FREETMPS> and
 L<perlcall>.
@@ -101,7 +109,9 @@ Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
 #define SAVESPTR(s)    save_sptr((SV**)&(s))
 #define SAVEPPTR(s)    save_pptr(SOFT_CAST(char**)&(s))
 #define SAVEVPTR(s)    save_vptr((void*)&(s))
+#define SAVEPADSV(s)   save_padsv(s)
 #define SAVEFREESV(s)  save_freesv((SV*)(s))
+#define SAVEMORTALIZESV(s)     save_mortalizesv((SV*)(s))
 #define SAVEFREEOP(o)  save_freeop(SOFT_CAST(OP*)(o))
 #define SAVEFREEPV(p)  save_freepv(SOFT_CAST(char*)(p))
 #define SAVECLEARSV(sv)        save_clearsv(SOFT_CAST(SV**)&(sv))
@@ -173,11 +183,14 @@ Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
  * SSPTR() converts the index returned by SSNEW/SSNEWa() into a pointer.
  */
 
-#define SSNEW(size)             save_alloc(size, 0)
-#define SSNEWa(size,align)     save_alloc(size, \
+#define SSNEW(size)             Perl_save_alloc(aTHX_ (size), 0)
+#define SSNEWt(n,t)             SSNEW((n)*sizeof(t))
+#define SSNEWa(size,align)     Perl_save_alloc(aTHX_ (size), \
     (align - ((int)((caddr_t)&PL_savestack[PL_savestack_ix]) % align)) % align)
+#define SSNEWat(n,t,align)     SSNEWa((n)*sizeof(t), align)
 
-#define SSPTR(off,type)         ((type) ((char*)PL_savestack + off))
+#define SSPTR(off,type)         ((type)  ((char*)PL_savestack + off))
+#define SSPTRt(off,type)        ((type*) ((char*)PL_savestack + off))
 
 /* A jmpenv packages the state required to perform a proper non-local jump.
  * Note that there is a start_env initialized when perl starts, and top_env
@@ -286,7 +299,7 @@ typedef void *(CPERLscope(*protect_proc_t)) (pTHX_ volatile JMPENV *pcur_env,
        OP_REG_TO_MEM;                                  \
     } STMT_END
 
-#define JMPENV_PUSH_INIT(THROWFUNC) JMPENV_PUSH_INIT_ENV(*(JMPENV*)pcur_env,THROWFUNC) 
+#define JMPENV_PUSH_INIT(THROWFUNC) JMPENV_PUSH_INIT_ENV(*(JMPENV*)pcur_env,THROWFUNC)
 
 #define JMPENV_POST_CATCH_ENV(ce) \
     STMT_START {                                       \
@@ -302,7 +315,7 @@ typedef void *(CPERLscope(*protect_proc_t)) (pTHX_ volatile JMPENV *pcur_env,
            DEBUG_l(Perl_deb(aTHX_ "Setting up jumplevel %p, was %p\n", \
                             ce, PL_top_env));                  \
            JMPENV_PUSH_INIT_ENV(ce,NULL);                      \
-           EXCEPT_SET_ENV(ce,PerlProc_setjmp((ce).je_buf, 1));\
+           EXCEPT_SET_ENV(ce,PerlProc_setjmp((ce).je_buf, SCOPE_SAVES_SIGNAL_MASK));\
            (ce).je_noset = 1;                                  \
        }                                                       \
        else                                                    \
@@ -311,7 +324,7 @@ typedef void *(CPERLscope(*protect_proc_t)) (pTHX_ volatile JMPENV *pcur_env,
        (v) = EXCEPT_GET_ENV(ce);                               \
     } STMT_END
 
-#define JMPENV_PUSH(v) JMPENV_PUSH_ENV(*(JMPENV*)pcur_env,v) 
+#define JMPENV_PUSH(v) JMPENV_PUSH_ENV(*(JMPENV*)pcur_env,v)
 
 #define JMPENV_POP_ENV(ce) \
     STMT_START {                                               \
@@ -319,7 +332,7 @@ typedef void *(CPERLscope(*protect_proc_t)) (pTHX_ volatile JMPENV *pcur_env,
            PL_top_env = (ce).je_prev;                          \
     } STMT_END
 
-#define JMPENV_POP  JMPENV_POP_ENV(*(JMPENV*)pcur_env) 
+#define JMPENV_POP  JMPENV_POP_ENV(*(JMPENV*)pcur_env)
 
 #define JMPENV_JUMP(v) \
     STMT_START {                                               \
@@ -351,7 +364,7 @@ typedef void *(CPERLscope(*protect_proc_t)) (pTHX_ volatile JMPENV *pcur_env,
                         &cur_env, PL_top_env));                        \
        cur_env.je_prev = PL_top_env;                                   \
        OP_REG_TO_MEM;                                                  \
-       cur_env.je_ret = PerlProc_setjmp(cur_env.je_buf, 1);            \
+       cur_env.je_ret = PerlProc_setjmp(cur_env.je_buf, SCOPE_SAVES_SIGNAL_MASK);              \
        OP_MEM_TO_REG;                                                  \
        PL_top_env = &cur_env;                                          \
        cur_env.je_mustcatch = FALSE;                                   \