summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cop.h20
-rw-r--r--embed.fnc4
-rw-r--r--embed.h4
-rw-r--r--inline.h48
-rw-r--r--pp_ctl.c12
-rw-r--r--proto.h12
6 files changed, 74 insertions, 26 deletions
diff --git a/cop.h b/cop.h
index d346d87fc7..b62e84c136 100644
--- a/cop.h
+++ b/cop.h
@@ -707,26 +707,6 @@ struct block_givwhen {
SV *defsv_save; /* the original $_ */
};
-#define CX_PUSHWHEN(cx) \
- cx->blk_givwhen.leave_op = cLOGOP->op_other;
-
-#define CX_PUSHGIVEN(cx, orig_var) \
- CX_PUSHWHEN(cx); \
- cx->blk_givwhen.defsv_save = orig_var;
-
-#define CX_POPWHEN(cx) \
- assert(CxTYPE(cx) == CXt_WHEN); \
- NOOP;
-
-#define CX_POPGIVEN(cx) \
- STMT_START { \
- SV *sv = GvSV(PL_defgv); \
- assert(CxTYPE(cx) == CXt_GIVEN); \
- GvSV(PL_defgv) = cx->blk_givwhen.defsv_save; \
- cx->blk_givwhen.defsv_save = NULL; \
- SvREFCNT_dec(sv); \
- } STMT_END
-
/* context common to subroutines, evals and loops */
diff --git a/embed.fnc b/embed.fnc
index 61a4bad47a..0398075d60 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -2899,6 +2899,10 @@ AiM |void |cx_pushloop_plain|NN PERL_CONTEXT *cx
AiM |void |cx_pushloop_for |NN PERL_CONTEXT *cx \
|NN void *itervarp|NULLOK SV *itersave
AiM |void |cx_poploop |NN PERL_CONTEXT *cx
+AiM |void |cx_pushwhen |NN PERL_CONTEXT *cx
+AiM |void |cx_popwhen |NN PERL_CONTEXT *cx
+AiM |void |cx_pushgiven |NN PERL_CONTEXT *cx|NULLOK SV *orig_defsv
+AiM |void |cx_popgiven |NN PERL_CONTEXT *cx
#endif
: ex: set ts=8 sts=4 sw=4 noet:
diff --git a/embed.h b/embed.h
index a3943332f6..24b61bff4d 100644
--- a/embed.h
+++ b/embed.h
@@ -781,16 +781,20 @@
#define cx_popblock(a) S_cx_popblock(aTHX_ a)
#define cx_popeval(a) S_cx_popeval(aTHX_ a)
#define cx_popformat(a) S_cx_popformat(aTHX_ a)
+#define cx_popgiven(a) S_cx_popgiven(aTHX_ a)
#define cx_poploop(a) S_cx_poploop(aTHX_ a)
#define cx_popsub(a) S_cx_popsub(aTHX_ a)
#define cx_popsub_args(a) S_cx_popsub_args(aTHX_ a)
#define cx_popsub_common(a) S_cx_popsub_common(aTHX_ a)
+#define cx_popwhen(a) S_cx_popwhen(aTHX_ a)
#define cx_pushblock(a,b,c,d) S_cx_pushblock(aTHX_ a,b,c,d)
#define cx_pusheval(a,b,c) S_cx_pusheval(aTHX_ a,b,c)
#define cx_pushformat(a,b,c,d) S_cx_pushformat(aTHX_ a,b,c,d)
+#define cx_pushgiven(a,b) S_cx_pushgiven(aTHX_ a,b)
#define cx_pushloop_for(a,b,c) S_cx_pushloop_for(aTHX_ a,b,c)
#define cx_pushloop_plain(a) S_cx_pushloop_plain(aTHX_ a)
#define cx_pushsub(a,b,c,d) S_cx_pushsub(aTHX_ a,b,c,d)
+#define cx_pushwhen(a) S_cx_pushwhen(aTHX_ a)
#define cx_topblock(a) S_cx_topblock(aTHX_ a)
#define is_safe_syscall(a,b,c,d) S_is_safe_syscall(aTHX_ a,b,c,d)
#endif
diff --git a/inline.h b/inline.h
index 99fe4adb32..87b3d13500 100644
--- a/inline.h
+++ b/inline.h
@@ -708,6 +708,54 @@ S_cx_poploop(pTHX_ PERL_CONTEXT *cx)
}
}
+
+PERL_STATIC_INLINE void
+S_cx_pushwhen(pTHX_ PERL_CONTEXT *cx)
+{
+ PERL_ARGS_ASSERT_CX_PUSHWHEN;
+
+ cx->blk_givwhen.leave_op = cLOGOP->op_other;
+}
+
+
+PERL_STATIC_INLINE void
+S_cx_popwhen(pTHX_ PERL_CONTEXT *cx)
+{
+ PERL_ARGS_ASSERT_CX_POPWHEN;
+ assert(CxTYPE(cx) == CXt_WHEN);
+
+ PERL_UNUSED_ARG(cx);
+ /* currently NOOP */
+}
+
+
+PERL_STATIC_INLINE void
+S_cx_pushgiven(pTHX_ PERL_CONTEXT *cx, SV *orig_defsv)
+{
+ PERL_ARGS_ASSERT_CX_PUSHGIVEN;
+
+ cx->blk_givwhen.leave_op = cLOGOP->op_other;
+ cx->blk_givwhen.defsv_save = orig_defsv;
+}
+
+
+PERL_STATIC_INLINE void
+S_cx_popgiven(pTHX_ PERL_CONTEXT *cx)
+{
+ SV *sv;
+
+ PERL_ARGS_ASSERT_CX_POPGIVEN;
+ assert(CxTYPE(cx) == CXt_GIVEN);
+
+ sv = GvSV(PL_defgv);
+ GvSV(PL_defgv) = cx->blk_givwhen.defsv_save;
+ cx->blk_givwhen.defsv_save = NULL;
+ SvREFCNT_dec(sv);
+}
+
+
+
+
/*
* ex: set ts=8 sts=4 sw=4 et:
*/
diff --git a/pp_ctl.c b/pp_ctl.c
index 113c2c434b..454a66f28a 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1544,10 +1544,10 @@ Perl_dounwind(pTHX_ I32 cxix)
cx_poploop(cx);
break;
case CXt_WHEN:
- CX_POPWHEN(cx);
+ cx_popwhen(cx);
break;
case CXt_GIVEN:
- CX_POPGIVEN(cx);
+ cx_popgiven(cx);
break;
case CXt_BLOCK:
case CXt_NULL:
@@ -4349,7 +4349,7 @@ PP(pp_entergiven)
GvSV(PL_defgv) = SvREFCNT_inc(newsv);
cx = cx_pushblock(CXt_GIVEN, gimme, SP, PL_savestack_ix);
- CX_PUSHGIVEN(cx, origsv);
+ cx_pushgiven(cx, origsv);
RETURN;
}
@@ -4372,7 +4372,7 @@ PP(pp_leavegiven)
leave_adjust_stacks(oldsp, oldsp, gimme, 1);
CX_LEAVE_SCOPE(cx);
- CX_POPGIVEN(cx);
+ cx_popgiven(cx);
cx_popblock(cx);
CX_POP(cx);
@@ -4929,7 +4929,7 @@ PP(pp_enterwhen)
RETURNOP(cLOGOP->op_other->op_next);
cx = cx_pushblock(CXt_WHEN, gimme, SP, PL_savestack_ix);
- CX_PUSHWHEN(cx);
+ cx_pushwhen(cx);
RETURN;
}
@@ -4995,7 +4995,7 @@ PP(pp_continue)
assert(CxTYPE(cx) == CXt_WHEN);
PL_stack_sp = PL_stack_base + cx->blk_oldsp;
CX_LEAVE_SCOPE(cx);
- CX_POPWHEN(cx);
+ cx_popwhen(cx);
cx_popblock(cx);
nextop = cx->blk_givwhen.leave_op->op_next;
CX_POP(cx);
diff --git a/proto.h b/proto.h
index ebbd4e7bbe..b0419594ce 100644
--- a/proto.h
+++ b/proto.h
@@ -3727,6 +3727,9 @@ PERL_STATIC_INLINE void S_cx_popeval(pTHX_ PERL_CONTEXT *cx);
PERL_STATIC_INLINE void S_cx_popformat(pTHX_ PERL_CONTEXT *cx);
#define PERL_ARGS_ASSERT_CX_POPFORMAT \
assert(cx)
+PERL_STATIC_INLINE void S_cx_popgiven(pTHX_ PERL_CONTEXT *cx);
+#define PERL_ARGS_ASSERT_CX_POPGIVEN \
+ assert(cx)
PERL_STATIC_INLINE void S_cx_poploop(pTHX_ PERL_CONTEXT *cx);
#define PERL_ARGS_ASSERT_CX_POPLOOP \
assert(cx)
@@ -3739,6 +3742,9 @@ PERL_STATIC_INLINE void S_cx_popsub_args(pTHX_ PERL_CONTEXT *cx);
PERL_STATIC_INLINE void S_cx_popsub_common(pTHX_ PERL_CONTEXT *cx);
#define PERL_ARGS_ASSERT_CX_POPSUB_COMMON \
assert(cx)
+PERL_STATIC_INLINE void S_cx_popwhen(pTHX_ PERL_CONTEXT *cx);
+#define PERL_ARGS_ASSERT_CX_POPWHEN \
+ assert(cx)
PERL_STATIC_INLINE PERL_CONTEXT * S_cx_pushblock(pTHX_ U8 type, U8 gimme, SV** sp, I32 saveix);
#define PERL_ARGS_ASSERT_CX_PUSHBLOCK \
assert(sp)
@@ -3748,6 +3754,9 @@ PERL_STATIC_INLINE void S_cx_pusheval(pTHX_ PERL_CONTEXT *cx, OP *retop, SV *nam
PERL_STATIC_INLINE void S_cx_pushformat(pTHX_ PERL_CONTEXT *cx, CV *cv, OP *retop, GV *gv);
#define PERL_ARGS_ASSERT_CX_PUSHFORMAT \
assert(cx); assert(cv)
+PERL_STATIC_INLINE void S_cx_pushgiven(pTHX_ PERL_CONTEXT *cx, SV *orig_defsv);
+#define PERL_ARGS_ASSERT_CX_PUSHGIVEN \
+ assert(cx)
PERL_STATIC_INLINE void S_cx_pushloop_for(pTHX_ PERL_CONTEXT *cx, void *itervarp, SV *itersave);
#define PERL_ARGS_ASSERT_CX_PUSHLOOP_FOR \
assert(cx); assert(itervarp)
@@ -3757,6 +3766,9 @@ PERL_STATIC_INLINE void S_cx_pushloop_plain(pTHX_ PERL_CONTEXT *cx);
PERL_STATIC_INLINE void S_cx_pushsub(pTHX_ PERL_CONTEXT *cx, CV *cv, OP *retop, bool hasargs);
#define PERL_ARGS_ASSERT_CX_PUSHSUB \
assert(cx); assert(cv)
+PERL_STATIC_INLINE void S_cx_pushwhen(pTHX_ PERL_CONTEXT *cx);
+#define PERL_ARGS_ASSERT_CX_PUSHWHEN \
+ assert(cx)
PERL_STATIC_INLINE void S_cx_topblock(pTHX_ PERL_CONTEXT *cx);
#define PERL_ARGS_ASSERT_CX_TOPBLOCK \
assert(cx)