develooper Front page | perl.perl5.porters | Postings from September 2010

Re: [PATCH] Support B::Generate and B::C

Thread Previous | Thread Next
From:
Jim Cromie
Date:
September 3, 2010 18:43
Subject:
Re: [PATCH] Support B::Generate and B::C
Message ID:
AANLkTikO3aQ64u=HDPR7604Q1yFWgtMecSt0GfFGbwmC@mail.gmail.com
On Fri, Sep 3, 2010 at 5:26 PM, Ben Morrow <ben@morrow.me.uk> wrote:

> Quoth jim.cromie@gmail.com (Jim Cromie):
> >
> > As yet, I dont know whether/how synthesized targets are rendered
> > distinctly from targets that are already there, further elucidation
> >  on the exact meaning of [t3] in the following would be welcome.
> >
> >            % perl -MO=Concise,-exec -e '$a = $b + 42'
> >            1  <0> enter
> >            2  <;> nextstate(main 1 -e:1) v
> >            3  <#> gvsv[*b] s
> >            4  <$> const[IV 42] s
> >         *  5  <2> add[t3] sK/2
>
> It means the add op has a target, which is at index 3 in the pad, which
> is SVs_PADTMP. pp_add uses it to store the result it is going to return.
>
> ok, more specifically though, we have this code in fold-constants:

    if (PL_opargs[type] & OA_TARGET && !o->op_targ)
o->op_targ = pad_alloc(type, SVs_PADTMP);
    }

when is o->op_targ not already set ?
by the time B::Concise renders the tree, null targets are pad_alloc'd.
Is there any evidence in the rendering that this branch was taken ?
Is it a normal case that the pad is alloc'd ?

 1006  perl -MO=Concise -e '@a; print $a[0] +$a[1]'
 1007  perl -MO=Concise -e 'my @a; print $a[0] +$a[1]'
 1008  perl -MO=Concise -e 'my ($a,$b); print $a +$b'
 1009  perl -MO=Concise -e 'my ($a,$b); print $a+$b+1'

I just gdb'd 1006 w/o the -MO=Concise, hit the pad-alloc.
So, inverting the question above, when is the target preallocated ?




 > Can we find agreement on what should/must be there for X functions ?
>
> IMHO there should be no such functions, except in exceptional
> circumstances where nothing else will work. They should *never* be
> (directly) called by random CPAN extensions, except as part of a
> backcompat hack that is only invoked on versions of perl known to have
> exported the function with the desired semantics. Noone gets to complain
> if they have been linking against X functions and they suddenly
> disappear, or suddenly start doing something quite else (nasal demons 'n
> all that).
>
> your take on X is rather draconian; there is 'M' which specifically
addresses
changes, so X without M could be seen as a specific promise
(perhaps with fingers crossed)

What about functions previously marked with 'p' in embed.fnc ?
fold_constants is 'p' in maint-5.8, no X or x, though both were defined
then.
embed.pl says only that 'p' has a Perl_ prefix, which correlates,
as distinct from causal, with A




> Ben
>
>


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