In perl.git, the branch smoke-me/davem/save_re2 has been created

<http://perl5.git.perl.org/perl.git/commitdiff/d498dd0b51ada5918d254821d6044d2a871b6067?hp=0000000000000000000000000000000000000000>

        at  d498dd0b51ada5918d254821d6044d2a871b6067 (commit)

- Log -----------------------------------------------------------------
commit d498dd0b51ada5918d254821d6044d2a871b6067
Author: David Mitchell <[email protected]>
Date:   Wed Mar 25 17:11:40 2015 +0000

    Perl_save_re_context(): re-indent after last commit
    
    whitespace-only change.

M       regcomp.c

commit 3bb129a63737deeca9a3b72d2bb9e8d9bad4f003
Author: David Mitchell <[email protected]>
Date:   Wed Mar 25 16:59:04 2015 +0000

    save_re_context(): do "local $n" with no PL_curpm
    
    RT #124109.
    
    2c1f00b9036 localised PL_curpm to NULL when calling swash init code
    (i.e. perl-level code that is loaded and executed when something
    like "lc $large_codepoint" is executed).
    
    b4fa55d3f1 followed this up by gutting Perl_save_re_context(), since
    that function did, basically,
    
        if (PL_curpm) {
            for (i = 1; i <= RX_NPARENS(PM_GETRE(PL_curpm))) {
                do the C equivalent of the perl code "local ${i}";
            }
        }
    
    and now that PL_curpm was null, the code wasn't called any more.  However,
    it turns out that the localisation *was* still needed, it's just that
    nothing in the test suite actually tested for it.
    
    In something like the following:
    
        $x = "\x{41c}";
        $x =~ /(.*)/;
        $s = lc $1;
    
    pp_lc() calls get magic on $1, which sets $1's PV value to a copy of the
    substring captured by the current pattern match.
    Then pp_lc() calls a function to convert the string to upper case, which
    triggers a swash load, which calls perl code that does a pattern match
    and, most importantly, uses the value of $1. This triggers get magic on
    $1, which overwrites $1's PV value with a new value. When control returns
    to pp_lc(), $1 now holds the wrong string value.
    
    Hence $1, $2 etc need localising as well as PL_curpm.
    
    The old way that Perl_save_re_context() used to work (localising
    $1..${RX_NPARENS}) won't work directly when PL_curpm is NULL (as in the
    swash case), since we don't know how many vars to localise.
    
    In this case, hard-code it as localising $1,$2,$3 and add a porting
    test file that checks that the utf8.pm code and dependences don't
    use anything outside those 3 vars.

M       MANIFEST
M       regcomp.c
A       t/porting/re_context.t
M       t/re/pat_advanced.t

commit f6f7d58e87c49952c5e5537cdafd9e61d1baa713
Author: David Mitchell <[email protected]>
Date:   Wed Mar 25 16:21:31 2015 +0000

    Revert "Gut Perl_save_re_context"
    
    This reverts commit b4fa55d3f12c6d98b13a8b3db4f8d921c8e56edc.
    
    Turns out we need Perl_save_re_context() after all

M       regcomp.c

commit ed5ab73bd7933db5f90744476451fff2e214321b
Author: David Mitchell <[email protected]>
Date:   Thu Mar 19 20:35:57 2015 +0000

    Revert "Don’t call save_re_context"
    
    This reverts commit d28a9254e445aee7212523d9a7ff62ae0a743fec.
    
    Turns out we need save_re_context() after all

M       mg.c
M       regcomp.c
M       sv.c
M       utf8.c
M       util.c

commit 4236125ee347d2c042dd651e99a5a6e70c3a5dc5
Author: David Mitchell <[email protected]>
Date:   Thu Mar 19 20:30:04 2015 +0000

    Revert "Mathomise save_re_context"
    
    This reverts commit 0ddd4a5b1910c8bfa9b7e55eb0db60a115fe368c.
    
    Turns out we need the save_re_context() function after all.

M       mathoms.c
M       regcomp.c
-----------------------------------------------------------------------

--
Perl5 Master Repository

Reply via email to