Perl

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Change 28489: Implement handling of state variables in list assignment

    0 answers - 3316 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Change 28489 by rgs@marais on 2006/07/05 21:00:31
    Implement handling of state variables in list assignment
    Affected files
    //depot/perl/ext/B/B/Concise.pm#63 edit
    //depot/perl/op.c#831 edit
    //depot/perl/pp_hot.c#470 edit
    //depot/perl/t/op/state.t#8 edit
    Differences
    //depot/perl/ext/B/B/Concise.pm#63 (text)
    Index: perl/ext/B/B/Concise.pm
    perl/ext/B/B/Concise.pm#62~28353~2006-06-05 14:38:38.000000000 -0700
    perl/ext/B/B/Concise.pm2006-07-05 14:00:31.000000000 -0700
    @@ -562,7 +562,7 @@
    "padav", "padhv", "enteriter");
    $priv{$_}{64} = "REFC" for ("leave", "leavesub", "leavesublv", "leavewrite");
    $priv{"aassign"}{64} = "CMMN";
    -$priv{"aassign"}{32} = "PHASH" if $] < 5.009;
    +$priv{"aassign"}{32} = $] < 5.009 ? "PHASH" : "STATE";
    $priv{"sassign"}{32} = "STATE";
    $priv{"sassign"}{64} = "BKWARD";
    $priv{$_}{64} = "RTIME" for ("match", "subst", "substcont", "qr");
    //depot/perl/op.c#831 (text)
    Index: perl/op.c
    perl/op.c#830~28488~2006-07-05 13:00:10.000000000 -0700
    perl/op.c2006-07-05 14:00:31.000000000 -0700
    @@ -3783,6 +3783,7 @@
    * to store these values, evil chicanery is done with SvCUR().
    */
    +{
    P *lastop = o;
    PL_generation++;
    for (curop = LINKLIST(o); curop != o; curop = LINKLIST(curop)) {
    @@ -3799,6 +3800,11 @@
    curop->op_type == P_PADHV ||
    curop->op_type == P_PADANY)
    {
    +if ((left->op_private & PpLVAL_INTR) && (curop->op_private & PpPAD_STATE)) {
    + o->op_private |= PpASSIGN_STATE;
    + /* hijacking PADSTALE for uninitialized state variables */
    + SvPADSTALE_on(PAD_SVl(curop->op_targ));
    +}
    if (PAD_CMPNAME_GEN(curop->op_targ)
    == (STRLEN)PL_generation)
    break;
    @@ -3836,6 +3842,7 @@
    }
    if (curop != o)
    o->op_private |= PpASSIGN_CMMN;
    +}
    if (right && right->op_type == P_SPLIT) {
    P* tmpop = ((LISTP*)right)->op_first;
    if (tmpop && (tmpop->op_type == P_PUSHRE)) {
    //depot/perl/pp_hot.c#470 (text)
    Index: perl/pp_hot.c
    perl/pp_hot.c#469~28254~2006-05-20 07:30:50.000000000 -0700
    perl/pp_hot.c2006-07-05 14:00:31.000000000 -0700
    @@ -1080,6 +1080,12 @@
    }
    }
    }
    + if (PL_op->op_private & PpASSIGN_STATE) {
    +if (SvPADSTALE(*firstlelem))
    + SvPADSTALE_off(*firstlelem);
    +else
    + RETURN; /* ignore assignment */
    + }
    relem = firstrelem;
    lelem = firstlelem;
    //depot/perl/t/op/state.t#8 (text)
    Index: perl/t/op/state.t
    perl/t/op/state.t#7~28484~2006-07-05 07:10:18.000000000 -0700
    perl/t/op/state.t2006-07-05 14:00:31.000000000 -0700
    @@ -105,7 +105,7 @@
    # stateless assignment to a state variable
    sub stateless {
    - (state $reinitme) = 42;
    + (state $reinitme, my $foo) = (42, 'bar');
    ++$reinitme;
    }
    is( stateless(), 43, 'stateless function, first time' );
    @@ -151,7 +151,4 @@
    my $ls = statelist();
    is($ls, "12/23", 'list assignment to state scalars');
    $ls = statelist();
    -{
    - local our $TD = 'make aassign handle state vars';
    - is($ls, "13/24", 'list assignment to state scalars');
    -}
    +is($ls, "13/24", 'list assignment to state scalars');
    End of Patch.

Re: Change 28489: Implement handling of state variables in list assignment


max 4000 letters.
Your nickname that display:
In order to stop the spam: 2 + 1 =
QUESTION ON "Perl"

EMSDN.COM