regcomp.c: Compile inverted character classes with \p{}
authorKarl Williamson <public@khwilliamson.com>
Fri, 6 Jan 2012 22:05:11 +0000 (15:05 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 13 Jan 2012 16:58:40 +0000 (09:58 -0700)
This commit causes character classes of the form [^\p{...}] to have
their code points known at compile time instead of runtime.  This allows
for better optimization and runtime execution speed.

regcomp.c

index 812b40a..6e7bb3e 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -10299,7 +10299,6 @@ parseit:
 
                     /* Look up the property name, and get its swash and
                      * inversion list, if the property is found  */
-                    if (! (ANYOF_FLAGS(ret) & ANYOF_INVERT)) {
                     if (swash) {
                         SvREFCNT_dec(swash);
                     }
@@ -10310,10 +10309,7 @@ parseit:
                                                       undefined properties */
                                              NULL, FALSE /* No inversion list */
                                             );
-                    }
-
-                    if (   ANYOF_FLAGS(ret) & ANYOF_INVERT
-                        || ! swash
+                    if (   ! swash
                         || ! SvROK(swash)
                         || ! SvTYPE(SvRV(swash)) == SVt_PVHV
                         || ! (invlistsvp =