This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_entersub: unroll some CvFLAGS(cv) tests
authorDavid Mitchell <davem@iabyn.com>
Mon, 13 Jul 2015 15:25:36 +0000 (16:25 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:37 +0000 (08:59 +0000)
Do a single bit comparison rather than two conditionals. Slightly faster.

pp_hot.c

index d54b882..b9562ee 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3489,7 +3489,8 @@ PP(pp_entersub)
         }
     }
 
-    if (UNLIKELY(CvCLONE(cv) && ! CvCLONED(cv)))
+    /* unrolled "CvCLONE(cv) && ! CvCLONED(cv)" */
+    if (UNLIKELY((CvFLAGS(cv) & (CVf_CLONE|CVf_CLONED)) == CVf_CLONE))
        DIE(aTHX_ "Closure prototype called");
 
     if (UNLIKELY((PL_op->op_private & OPpENTERSUB_DB) && GvCV(PL_DBsub)