[pypy-dev] More on optimization

holger krekel hpk at trillke.net
Wed Nov 3 15:28:42 CET 2004

Hi Armin, 

[Armin Rigo Wed, Nov 03, 2004 at 02:10:21PM +0000]
> On Tue, Nov 02, 2004 at 07:36:53PM +0100, holger krekel wrote:
> > >    if type(a) is int and type(b) is int:
> > >        x = make_int_object(add_long(a.ob_ival, b.ob_ival))
> > >    else:
> > >        ...
> > 
> > Does this relate to a previous idea of generating two flow branches for
> > the above if/else that would not get merged at the next point 
> > after the if/else?  IIRC, we currently merge the "framestates" right
> > after the if/else.
> No, it's not about merging or not the two flow branches (or the results of the
> analysis) after the if/else: in both cases, flow-sensitive or
> flow-insensitive, they are merged.  The difference between flow-sensitive and
> flow-insensitive is that in the former case, if we discover that we know the
> types of a and b statically, then we only explore the first branch (so there
> is no merging to be done, because the 2nd branch is never analysed).  This is
> what we do currently in our annotations.

So we do already keep possibly different function versions for
differently typed sets of input parameters to this function? I
guess i am mixing up flow analysis and annotation somewhat
here. Or even have a deeper misunderstanding :-) 

> By contrast, flow-insensitive algorithms like the one in the
> paper Samuele pointed out (or the one done by Starkiller)
> don't work like that: they just look at all instructions in
> the function and accumulate their possible effects, without
> worrying about the control flow.

right. They have to do that because they look at the static 
source code and not at a representation obtained from abstract 
execution like we do in objspace/flow. 



More information about the Pypy-dev mailing list