This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Make sure optimizer handles node; Note for 3018b823
authorKarl Williamson <public@khwilliamson.com>
Fri, 28 Dec 2012 16:44:47 +0000 (09:44 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 28 Dec 2012 17:38:57 +0000 (10:38 -0700)
The check that there isn't a simple regnode unknown to the optimizer
has been commented out since at least
653099ff2c52a6af02b3894d684593dfe31dcc17 in 1999.  This caused us some
slow down for a while in the 5.17 release, as I added a regnode and
didn't think about it needing to be added to the optimizer.  This commit
uncomments out the check, but only for debugging builds, so that a
production environment will run with missing optimization, but
developers will be notified of their error.

Also, in commit 3018b823898645e44b8c37c70ac5c6302b031381, I made an
error in the commit message; I'm adding it here so people digging will
find out the relevant information.  The message said that the new regex
ops were unknown to the optimizer.  I had forgotten that I had included
them in that commit, so that statement was wrong.

regcomp.c

index 35fd196..bee52b0 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4140,8 +4140,10 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
 
                case SANY:
                default:
-                 do_default:
-                   /* Perl_croak(aTHX_ "panic: unexpected simple REx opcode %d", OP(scan)); */
+#ifdef DEBUGGING
+                   Perl_croak(aTHX_ "panic: unexpected simple REx opcode %d", OP(scan));
+#endif
+                 do_default:
                    if (flags & SCF_DO_STCLASS_OR) /* Allow everything */
                        cl_anything(pRExC_state, data->start_class);
                    break;