This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
podcheck.t: Skip core files
[perl5.git] / cop.h
diff --git a/cop.h b/cop.h
index 37895e6..5c66752 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -721,9 +721,10 @@ struct block_loop {
 
 
 
-/* when context */
-struct block_when {
+/* given/when context */
+struct block_givwhen {
        OP *leave_op;
+        SV *defsv_save; /* the original $_ */
 };
 
 
@@ -747,7 +748,7 @@ struct block {
        struct block_format     blku_format;
        struct block_eval       blku_eval;
        struct block_loop       blku_loop;
-       struct block_when       blku_when;
+       struct block_givwhen    blku_givwhen;
     } blk_u;
 };
 #define blk_oldsp      cx_u.cx_blk.blku_oldsp
@@ -763,7 +764,7 @@ struct block {
 #define blk_format     cx_u.cx_blk.blk_u.blku_format
 #define blk_eval       cx_u.cx_blk.blk_u.blku_eval
 #define blk_loop       cx_u.cx_blk.blk_u.blku_loop
-#define blk_when       cx_u.cx_blk.blk_u.blku_when
+#define blk_givwhen    cx_u.cx_blk.blk_u.blku_givwhen
 
 #define CX_DEBUG(cx, action)                                           \
     DEBUG_l(                                                           \
@@ -858,9 +859,14 @@ struct context {
 #define CXt_NULL       0 /* currently only used for sort BLOCK */
 #define CXt_WHEN       1
 #define CXt_BLOCK      2
-/* be careful of the ordering of these six. Macros like CxTYPE_is_LOOP,
+/* When micro-optimising :-) keep GIVEN next to the LOOPs, as these 5 share a
+   jump table in pp_ctl.c
+   The first 4 don't have a 'case' in at least one switch statement in pp_ctl.c
+*/
+#define CXt_GIVEN      3
+
+/* be careful of the ordering of these five. Macros like CxTYPE_is_LOOP,
  * CxFOREACH compare ranges */
-#define CXt_LOOP_GIVEN 3 /* given (...)    { ...; } */
 #define CXt_LOOP_ARY   4 /* for (@ary)     { ...; } */
 #define CXt_LOOP_LAZYSV        5 /* for ('a'..'z') { ...; } */
 #define CXt_LOOP_LAZYIV        6 /* for (1..9)     { ...; } */
@@ -899,7 +905,7 @@ struct context {
 #define CXp_ONCE       0x10    /* What was sbu_once in struct subst */
 
 #define CxTYPE(c)      ((c)->cx_type & CXTYPEMASK)
-#define CxTYPE_is_LOOP(c) (   CxTYPE(cx) >= CXt_LOOP_GIVEN              \
+#define CxTYPE_is_LOOP(c) (   CxTYPE(cx) >= CXt_LOOP_ARY                \
                            && CxTYPE(cx) <= CXt_LOOP_PLAIN)
 #define CxMULTICALL(c) ((c)->cx_type & CXp_MULTICALL)
 #define CxREALEVAL(c)  (((c)->cx_type & (CXTYPEMASK|CXp_REAL))         \