Change 30066 by [EMAIL PROTECTED] on 2007/01/29 19:07:36

        Integrate:
        [ 29033]
        Subject: [perl #40557] regexec.c saves context stack position 
improperly 
        From: Dave Bailey (via RT) <[EMAIL PROTECTED]>
        Date: Tue, 17 Oct 2006 09:37:28 -0700
        Message-ID: <[EMAIL PROTECTED]>
        
        [ 29059]
        zero length $1 took too long to detect utf8-ness
        
        [ 29063]
        only do \C hackery if \C is seen
        
        From: demerphq <[EMAIL PROTECTED]>
        Date: Fri, 20 Oct 2006 12:38:13 +0200
        Subject: Re: utf8 regexp performance problem
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/maint-5.8/perl/mg.c#142 integrate
... //depot/maint-5.8/perl/regexec.c#84 integrate
... //depot/maint-5.8/perl/scope.c#64 integrate
... //depot/maint-5.8/perl/scope.h#25 integrate

Differences ...

==== //depot/maint-5.8/perl/mg.c#142 (text) ====
Index: perl/mg.c
--- perl/mg.c#141~30033~        2007-01-27 08:40:35.000000000 -0800
+++ perl/mg.c   2007-01-29 11:07:36.000000000 -0800
@@ -857,8 +857,13 @@
                    TAINT_NOT;
                    sv_setpvn(sv, s, i);
                    PL_tainted = oldtainted;
-                   if (RX_MATCH_UTF8(rx) && is_utf8_string((U8*)s, i))
+                   if ( (rx->reganch & ROPT_CANY_SEEN)
+                       ? (RX_MATCH_UTF8(rx)
+                                   && (!i || is_utf8_string((U8*)s, i)))
+                       : (RX_MATCH_UTF8(rx)) )
+                   {
                        SvUTF8_on(sv);
+                   }
                    else
                        SvUTF8_off(sv);
                    if (PL_tainting) {

==== //depot/maint-5.8/perl/regexec.c#84 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#83~30033~    2007-01-27 08:40:35.000000000 -0800
+++ perl/regexec.c      2007-01-29 11:07:36.000000000 -0800
@@ -1824,7 +1824,7 @@
            PerlIO_printf(Perl_debug_log, "  setting stack tmpbase at 
%"IVdf"\n",
                          (IV)(PL_stack_sp - PL_stack_base));
            ));
-       SAVEI32(cxstack[cxstack_ix].blk_oldsp);
+       SAVESTACK_CXPOS();
        cxstack[cxstack_ix].blk_oldsp = PL_stack_sp - PL_stack_base;
        /* Otherwise OP_NEXTSTATE will free whatever on stack now.  */
        SAVETMPS;

==== //depot/maint-5.8/perl/scope.c#64 (text) ====
Index: perl/scope.c
--- perl/scope.c#63~30033~      2007-01-27 08:40:35.000000000 -0800
+++ perl/scope.c        2007-01-29 11:07:36.000000000 -0800
@@ -844,6 +844,10 @@
            i = SSPOPINT;
            PL_stack_sp = PL_stack_base + i;
            break;
+       case SAVEt_STACK_CXPOS:         /* blk_oldsp on context stack */
+           i = SSPOPINT;
+           cxstack[i].blk_oldsp = SSPOPINT;
+           break;
        case SAVEt_AELEM:               /* array element */
            value = (SV*)SSPOPPTR;
            i = SSPOPINT;

==== //depot/maint-5.8/perl/scope.h#25 (text) ====
Index: perl/scope.h
--- perl/scope.h#24~29964~      2007-01-24 15:53:28.000000000 -0800
+++ perl/scope.h        2007-01-29 11:07:36.000000000 -0800
@@ -56,6 +56,7 @@
 /* There may just be something out there hand building save stacks.  */
 #  define SAVEt_GP     SAVEt_GP_OLD
 #endif
+#define SAVEt_STACK_CXPOS      44
 
 #ifndef SCOPE_SAVES_SIGNAL_MASK
 #define SCOPE_SAVES_SIGNAL_MASK 0
@@ -191,6 +192,14 @@
     } STMT_END
 
 
+#define SAVESTACK_CXPOS() \
+    STMT_START {                                  \
+        SSCHECK(3);                               \
+        SSPUSHINT(cxstack[cxstack_ix].blk_oldsp); \
+        SSPUSHINT(cxstack_ix);                    \
+        SSPUSHINT(SAVEt_STACK_CXPOS);             \
+    } STMT_END
+
 #ifdef USE_ITHREADS
 #  define SAVECOPSTASH(c)      SAVEPPTR(CopSTASHPV(c))
 #  define SAVECOPSTASH_FREE(c) SAVESHAREDPV(CopSTASHPV(c))
End of Patch.

Reply via email to