develooper Front page | perl.perl5.porters | Postings from August 2001

Re: [PATCH List::Util] fix stack/scoping problems

Thread Previous
From:
Graham Barr
Date:
August 21, 2001 12:17
Subject:
Re: [PATCH List::Util] fix stack/scoping problems
Message ID:
20010821201603.N7667@pobox.com
I was thinking along these line too, but had not had the time to
investigate it, IMO we should only need to call PUSHBLOCK
once

Graham.

On Tue, Aug 21, 2001 at 12:09:23PM -0700, Wilson, Doug wrote:
> 
> Cool, I tried to do the same thing with (PUSH|POP)BLOCK, but
> I just didn't get the magic right :)
> 
> I know I'm probably living dangerously, but does anyone think
> there'd be problems or significant benefit with only calling
> (PUSH|POP)BLOCK once, rather than for each list element?
> This seems to work also (from List::Util::first after applying
> Robin's patch):
> 
> PUSHBLOCK(cx, CXt_BLOCK, SP);  # Added
> for(index = 1 ; index < items ; index++) {
>     GvSV(PL_defgv) = ST(index);
>     PL_op = reducecop;
>     #PUSHBLOCK(cx, CXt_BLOCK, SP); #Deleted
>     CALLRUNOPS(aTHX);
>     #POPBLOCK(cx,PL_curpm);     #Deleted
>     SP = newsp;
>     if (SvTRUE(*PL_stack_sp)) {
>       POPBLOCK(cx,PL_curpm);  # Added
>       ST(0) = ST(index);
>       XSRETURN(1);
>     }
> }
> POPBLOCK(cx,PL_curpm); # Added
> XSRETURN_UNDEF;

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About