Front page | perl.perl5.porters |
Postings from February 2013
Re: OP_PADSV_NOLV
Thread Previous
From:
Rafael Garcia-Suarez
Date:
February 27, 2013 08:21
Subject:
Re: OP_PADSV_NOLV
Message ID:
CAMoYMM93X5YAtWffiOOSRm4Q2ZZ2y7XGpod4Q3cWt9o56=4oiQ@mail.gmail.com
On 27 February 2013 08:00, Steffen Mueller <smueller@cpan.org> wrote:
> Would it be feasible to split OP_PADSV in two, such that:
So you'd want a padsv_ro op, right?
Sure, it should be possible, by adding a ck function for padsv
(currently it has none), that would change the op type to padsv_ro if
there is no modification flag.
I'm curious what would you expect as improvements from that change?
> 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
Thread Previous