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

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

        at  82848c10865918ee3d8db12bee74a88a54d8aa7f (commit)

- Log -----------------------------------------------------------------
commit 82848c10865918ee3d8db12bee74a88a54d8aa7f
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Sat Oct 11 00:00:55 2014 -0700

    Document lvalue references

M       lib/feature.pm
M       pod/perlexperiment.pod
M       pod/perlop.pod
M       pod/perlref.pod
M       pod/perlsyn.pod
M       regen/feature.pl

commit c96cf1c0e26c1d10561709cb663973772f4cb044
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Oct 10 22:16:38 2014 -0700

    Make Deparse.t more tolerant of our @F vs our(@F)
    
    Currently B::Deparse deparses ‘our @F;’ as ‘our @F;’, but ‘our 
@F =...’
    as ‘our(@F) = ...’, adding parentheses.  For split-to-array, it just
    happens to omit the parentheses, because there is no list op for it
    to process, and it is when processing a list op that it decides to put
    them there.  While it could be changed to omit the parentheses for the
    list or add them for split-to-array, for now just make the test more
    tolerant, as this is just a cosmetic difference.

M       lib/B/Deparse.t

commit 6bd144e0f53d840d496d057738446fe34872490b
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Oct 10 21:52:37 2014 -0700

    Extend lex alias detection to foreach, too
    
    Now that I have added a mechanism for detecting lexical aliases in
    list assignments, we can extend that to foreach, too, to fix another
    instance of the list-assignment-after-aliasing bug.

M       op.c
M       t/op/for.t

commit 6f5dab3ccdaf1b436dab450fe7216b81ea0269b7
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Oct 10 21:48:48 2014 -0700

    Skip no-common-vars optimisation for lex aliases

M       op.c
M       t/op/lvref.t

commit be9de18a741211563e9ada66dedd24a42bf2fe81
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Oct 10 16:44:58 2014 -0700

    op.c: Move common vars check into the peephole optimiser
    
    Putting it this late in the compilation phase will facilitate checking
    for lexical aliases, too.

M       op.c

commit 7cd2579d8fb125bdcb4c992544790e2f8da497b2
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Oct 10 16:37:00 2014 -0700

    Update B-Debug’s tests for split optimisation
    
    This will have to be submitted upstream after this branch is merged.

M       cpan/B-Debug/t/debug.t

commit 4ecee209f85984e2bab6cc57c1bf8429c45778c0
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Oct 10 08:45:29 2014 -0700

    op.c: Distangle split and common-vars
    
    The split-to-array optimisation was being skipped if the assignment
    referenced the same variable on both sides, or if it referenced @_
    (since @_ aliases other vars).  This was to prevent split from freeing
    its own argument when writing to the array.
    
    As the previous commit shows, that didn’t actually work properly, and
    so that commit used a different means to work around that problem.
    
    So now there is no reason to skip the optimisation in such cases.
    
        @_ = split;
        @a = split //, $a[0];
    
    now optimise away the assignment.
    
    (This also allows me to move the common-vars check into the peep-
    hole optimiser, where it needs to be to work correctly with lexi-
    cal aliases.)

M       op.c

commit 821956c5ad64b435bbafd981742317802470912d
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Oct 10 08:39:49 2014 -0700

    Make split temporarily refcnt its argument
    
    In this example, the @a=split... is optimised so that split writes to
    @a directly:
    
    *a = *b;
    $a[1] = "foobarbaz";
    @a = split //, $b[1];
    print "@a\n";
    
    But since @a and @b are the same, $b[1] gets freed even before the
    split occurs.  This just happens to work, because copy-on-write saves
    the day, since the buffer is still valid, the "foobarbaz" constant
    still holding on to it.
    
    This modified example gives me junk:
    
    *a = *b;
    $a[1] = "foobarbaz";
    $a[1] .= "";
    @a = split //, $b[1];
    print "@a\n";
    
    The easiest solution is to make pp_split hold a temporary reference
    count on the SV.
    
    This will also allow the split optimisation to be disentangled from
    the common-vars pessimisation (which fails here anyway).  And *that*
    will allow the common-vars pessimisation to take lexical aliases
    into account.

M       pp.c
M       t/op/split.t

commit 3f36a1c3df7980cdf732766684c17dd6f9ebbb19
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Thu Oct 9 22:05:15 2014 -0700

    op.c:newASSIGNOP: Rmv LINKLIST call
    
    Originally, aassign_common_vars used LINKLIST itself because it
    was following op_next pointers.  That changed in 3023b5f30, so the
    LINKLIST was moved outside that function.
    
    The LINKLIST call could not simply have been deleted, because the
    split optimisation that follows assumes that it has been called and
    fixes up an op_next pointer.
    
    If we remove the LINKLIST call *and* the op_next fix-up, then every-
    thing works.  The op_next fix-up was only happening to begin with
    because of LINKLIST.

M       op.c

commit bd2688c4c50527e5796ba4bc132c379f11e57112
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Thu Oct 9 21:54:12 2014 -0700

    op.c: Don’t keep looping when we see potential common vars
    
    When we loop through the list in LIST=..., once we have decided that
    we need to do the more thorough check for common vars we don’t reverse
    that decision based on subsequent ops, so there is no point in con-
    tinuing to loop through them.

M       op.c

commit 88cc83cba4d034f70cc14d42c3516b44a52a5002
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Thu Oct 9 15:53:53 2014 -0700

    lvref.t: Remove special TODO code
    
    We no longer have a plethora of to-do tests, so this specialised code
    no longer gains us anything.

M       t/op/lvref.t

commit ce1610c9e4c62374035c3bdf01ba1cfcc1b094c7
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Thu Oct 9 15:51:18 2014 -0700

    Store internal state of state vars separately
    
    Use a separate pad entry to record whether a state variable has been
    initialised, instead of using a flag on the value.
    
    This prevents \$state_var = \$some_other_var from interfering with
    that internal state.  It probably also fixes some cases with foreach
    as well, but I have not confirmed.

M       op.c
M       t/op/lvref.t

commit f52983f25808db29d3aec58c35c6578bc5efb8e9
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Thu Oct 9 14:07:35 2014 -0700

    lvref.t: More list and cond tests

M       t/op/lvref.t

commit 9187b6e4099587c2d80ba27befd977a38989b202
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Mon Oct 6 22:12:27 2014 -0700

    Deparse lvalue references

M       ext/B/t/concise-xs.t
M       lib/B/Deparse.pm
M       lib/B/Deparse.t

commit 3813a8f3579252f8cb0306f476c68a1371e07199
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Sat Oct 4 06:35:29 2014 -0700

    lvref.t: Remove temporary eval & skip

M       t/op/lvref.t

commit 901f0970a4823fdc2f5f716238395ea1a765c12f
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Sat Oct 4 06:31:11 2014 -0700

    lvref.t: Fix hash elem tests
    
    I was testing against a package hash for the ‘lexical’ tests.

M       t/op/lvref.t

commit 3ad7d3042169c5402b34cdc33048c5488be19f2c
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Oct 3 19:50:45 2014 -0700

    Handle state vars correctly in ref assignment
    
    Only \state(@_) was handling this correctly, as pp_lvavref
    calls pp_padav.

M       lib/B/Op_private.pm
M       op.c
M       opcode.h
M       pp.c
M       regen/op_private
M       t/op/lvref.t

commit 30bccb25bef4aaad4b320bff7a818e513dd280f5
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Oct 3 16:33:55 2014 -0700

    lvref.t: Tests for \my assignment and scope exit

M       t/op/lvref.t

commit 362e758e511f89d460f083210680cff7744c09e8
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Oct 3 12:40:23 2014 -0700

    Rework lvref.t foreach tests
    
    Remove the to-do marker.
    
    Add tests for package vars, too.
    
    Redo the \my &a test.  I’ve decided not to bother with the ‘my &a’
    syntax for now (if at all).  It is problematic and needs discussion.
    (If ‘my &a’ is allowed in foreach, then it should be allowed else-
    where, but ‘my &a;’ would call a stub.)

M       t/op/lvref.t

commit 19abb1eacc7e9cf1067062e2bf447ba3c08031ec
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Oct 3 12:29:35 2014 -0700

    Get foreach \&foo working
    
    Previously these would crash.  Usually, &foo is wrapped in an entersub
    op which gets converted to rv2cv when refgen applies lvalue context.
    In foreach \&foo, there is no need for us to go the entersub route;
    rather we pass the original rv2cv op directly to refgen without the
    entersub wrapping.  So the resulting op tree is different.  S_lvref
    was not expecting this alternate op tree.

M       op.c

commit d39c26a657753cddffc8cb3dbd2aaa929b2c78fe
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Thu Oct 2 22:38:27 2014 -0700

    foreach \$var
    
    Some passing tests are still marked to-do.  We need more tests still.

M       cop.h
M       mg.c
M       mg.h
M       op.c
M       perly.act
M       perly.h
M       perly.tab
M       perly.y
M       pp.c
M       pp_ctl.c
M       pp_hot.c

commit 5a36b2c090849e18b86c1759887c5bcebd598113
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Thu Oct 2 21:49:28 2014 -0700

    Add OPpLVREF_ITER flag
    
    An lvalue reference used as an iterator variable will be implemented
    using an lvref op with this flag set.

M       lib/B/Op_private.pm
M       opcode.h
M       regen/op_private

commit 63702de8ecadcbe5560b2c7c53440a93e87809d0
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Wed Oct 1 20:18:06 2014 -0700

    Fix err message for $cond ? \bad : ... = ...
    
    The error message code in S_lvref was assuming that it only handled
    list assignment (which was originally the case), but
    
        $condition ? \pos : whatever = ...
    
    goes through that same code path, and that is a scalar assignment.
    
    So pass the assignment type through to S_lvref.

M       op.c
M       t/op/lvref.t

commit 408e9044cd5472e7fb56dd6bde4c00dca3db5d10
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Wed Oct 1 20:00:10 2014 -0700

    Subroutine reference assignment

M       op.c
M       t/op/lvref.t

commit bd9bf01b39e0fd9ebc41a7c457ab6b8a8ebc6731
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Wed Oct 1 18:15:16 2014 -0700

    lvref.t: Repeat bad ref tests with list assignment
    
    List assignment goes through a different code path.  The errors come
    from magic_setlvref in that case, not pp_refassign.

M       t/op/lvref.t

commit 69b0bd0766d3c36397346c4d4697c98191c11736
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Tue Sep 30 22:28:48 2014 -0700

    lvref.t: do-block err msg is no longer to-do
    
    The previous commit’s rearrangement of things fixed this, too.

M       t/op/lvref.t

commit 7664512eddd3e297d305684d8075fd977e4ef95c
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Tue Sep 30 22:20:56 2014 -0700

    Make \( ?: ) assignment work
    
    When I first implemented list assignment to lvalue references, I
    thought I could simply modify the kids of the refgen op (\) in one
    spot.  But things like ?: make it necessary to do this recursively.
    So all that code for turning thingies into lvrefs has been moved into
    a separate function patterned after op_lvalue but handling only the
    lvref cases.
    
    (I thought about combining it with op_lvalue’s switch statement, but
    that would require ‘if(type == OP_LVREF) goto nomod;’ too many times,
    which would be harder to maintain.)

M       op.c
M       t/op/lvref.t

commit d1094c5baeb602d75ce196bcd4ed8a021f42e99e
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Tue Sep 30 10:28:32 2014 -0700

    lvref.t: Remove unnecessary evals

M       t/op/lvref.t

commit 9e592f5a622ba084c542708e12e4266c8ebbba7f
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Tue Sep 30 10:27:34 2014 -0700

    Get basic $cond ? \$a : \$b = ... working
    
    When I started working on lvalue references, I envisioned having all
    scalar assignments pass through pp_refassign.  A refassign op repre-
    sents the initial backslash on the lhs *and* the equals sign.  For
    cases like this, there is no single refgen on the lhs.  It turns out
    that the approach I am using for list assignments (where the lhs
    becomes an lvref op that returns a magic scalar that does the aliasing
    when assigned to) is the easiest way to get this working, too.
    
    All this commit has to do is allow ‘sassign’ lvalue context to apply
    to srefgen and fix the completely broken to-do tests.  (I have a ten-
    dency to write broken to-do tests, as I have no way of testing them at
    the time.)

M       op.c
M       t/op/lvref.t

commit bdaf10a52f7152c8c7cb0a106489016892f093cd
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Mon Sep 29 22:21:21 2014 -0700

    Assignment to \(@array)
    
    This is a slurpy lvalue that gobbles up all the rhs elements, which
    are expected to be references.  So \(@a)=\(@b) makes @a share the
    same elements as @b.
    
    We implement this by pushing a null on to the stack as a special
    marker that pp_aassign will recognise.
    
    I decided to change the wording for the \local(@a)=... error
    slightly, from what my to-do tests had.
    
    Some of the other to-do tests were badly written and had to be
    fixed up a bit.

M       op.c
M       pp.c
M       pp_hot.c
M       t/op/lvref.t

commit 4cb217963bb5dd7a847ee100592f6abd696c1f41
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Mon Sep 29 22:23:22 2014 -0700

    lvavref needs OPpLVAL_INTRO and OPpPAD_STATE

M       lib/B/Op_private.pm
M       opcode.h
M       regen/op_private

commit 2882b3ff194c533cea5909d6f11ee4a911ef0f9e
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Mon Sep 29 21:43:53 2014 -0700

    Add lvavref op type
    
    This will be used for slurpy array ref assignments.  \(@a) = \(@b)
    will make @a share the same elements as @b.

M       ext/Opcode/Opcode.pm
M       lib/B/Op_private.pm
M       opcode.h
M       opnames.h
M       pp.c
M       pp_proto.h
M       regen/opcodes

commit 4b6cf48bb4558c51745baf834133575633be736a
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Mon Sep 29 21:40:28 2014 -0700

    lvref is actually a baseop/unop
    
    When used for pad vars, it is childless.

M       opcode.h
M       regen/opcodes

commit 9782ce69d375fa2bd079d76a538664334df0d771
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Mon Sep 29 18:03:57 2014 -0700

    List assignment to array and hash refs
    
    (\@a,\%h)=... works, but \(@a) and \(%h) do not.  \(%h) correctly
    croaks.  (\local @a, \local %h)=... also works.

M       mg.c
M       op.c
M       pp.c
M       t/op/lvref.t
-----------------------------------------------------------------------

--
Perl5 Master Repository

Reply via email to