Skip to content

Commit 7c1bc8f

Browse files
committed
peep.c: Add some UNLIKELY()
It's also unlikely that the op_type will be any given value, but I expect the compiler and libc know that. This stresses that it is unlikely some module will customize the handling of these checkers.
1 parent 30b299b commit 7c1bc8f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

peep.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,17 +2206,17 @@ S_maybe_multideref(pTHX_ OP *start, OP *orig_o, UV orig_action, U8 hints)
22062206
* abandon optimisation attempt. Check two different ways because
22072207
* of z/OS (see comments in opcode.h) */
22082208
if ( (o->op_type == OP_AELEM || o->op_type == OP_HELEM)
2209-
&& PL_check[o->op_type] != Perl_ck_null
2210-
&& PL_check[o->op_type] != PL_check[PERL_CK_NULL])
2209+
&& UNLIKELY(PL_check[o->op_type] != Perl_ck_null)
2210+
&& UNLIKELY(PL_check[o->op_type] != PL_check[PERL_CK_NULL]))
22112211
return;
22122212
/* similarly for customised exists and delete */
22132213
if ( (o->op_type == OP_EXISTS)
2214-
&& PL_check[OP_EXISTS] != Perl_ck_exists
2215-
&& PL_check[OP_EXISTS] != PL_check[PERL_CK_EXISTS])
2214+
&& UNLIKELY(PL_check[OP_EXISTS] != Perl_ck_exists)
2215+
&& UNLIKELY(PL_check[OP_EXISTS] != PL_check[PERL_CK_EXISTS]))
22162216
return;
22172217
if ( (o->op_type == OP_DELETE)
2218-
&& PL_check[OP_DELETE] != Perl_ck_delete
2219-
&& PL_check[OP_DELETE] != PL_check[PERL_CK_DELETE])
2218+
&& UNLIKELY(PL_check[OP_DELETE] != Perl_ck_delete)
2219+
&& UNLIKELY(PL_check[OP_DELETE] != PL_check[PERL_CK_DELETE]))
22202220
return;
22212221

22222222
if ( o->op_type != OP_AELEM

0 commit comments

Comments
 (0)