develooper Front page | perl.perl5.porters | Postings from February 2013

Re: OP_PADSV_NOLV

Thread Previous | Thread Next
From:
bulk88
Date:
February 27, 2013 09:10
Subject:
Re: OP_PADSV_NOLV
Message ID:
BLU0-SMTP17825497EF61CA94DFD8708DFFD0@phx.gbl
Steffen Mueller wrote:
> Would it be feasible to split OP_PADSV in two, such that:
> 
> 
> PP(pp_padsv)
> {
>     dVAR; dSP;
>     EXTEND(SP, 1);
>     {
>     OP * const op = PL_op;
>     /* access PL_curpad once */
>     SV ** const padentry = &(PAD_SVl(op->op_targ));
>     {
>         dTARG;
>         TARG = *padentry;
>         PUSHs(TARG);
>         PUTBACK; /* no pop/push after this, TOPs ok */
>     }
>     if (op->op_flags & OPf_MOD) {
>         if (op->op_private & OPpLVAL_INTRO)
>         if (!(op->op_private & OPpPAD_STATE))
>             save_clearsv(padentry);
>         if (op->op_private & OPpDEREF) {
>         /* TOPs is equivalent to TARG here.  Using TOPs (SP) rather
>            than TARG reduces the scope of TARG, so it does not
>            span the call to save_clearsv, resulting in smaller
>            machine code. */
>         TOPs = vivify_ref(TOPs, op->op_private & OPpDEREF);
>         }
>     }
>     return op->op_next;
>     }
> }
> 
> 
> becomes in most cases just:
> 
> 
> PP(pp_padsv)
> {
>     dVAR; dSP;
>     EXTEND(SP, 1);
>     {
>     OP * const op = PL_op;
>     /* access PL_curpad once */
>     SV ** const padentry = &(PAD_SVl(op->op_targ));
>     {
>         dTARG;
>         TARG = *padentry;
>         PUSHs(TARG);
>         PUTBACK; /* no pop/push after this, TOPs ok */
>     }
> }
> 
> 
> --Steffen

Why? remove a branch and turn it into a separate non branching opcode? 
(not saying I dont like your idea).


Thread Previous | Thread Next


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