> I'm not familiar with it. Is there a summary online?

I followed mostly the implementation here :
https://github.com/v8/v8/tree/4b9b23521e6fd42373ebbcb20ebe03bf445494f9/src/compiler

> started playing with moving the CFG optimizations from the peepholer

My doubts have been on whether it was too radical to completely replace the
peephole optimizer with this CFG optimization pass.
If replacing the peephole optimizer is not a problem, how are we going to
ensure compatibility for the related peephole optimizer C-API?
Just have a stub?

> I'd be happy to offer advice and review any PRs.

My schedule may lighten this summer so I will try to look more but I wanted
to know if we think its worth investigating first.

If anyone wanted to make contributions to this, is such an implementation
trivial enough to be just a PR?
I guess what am trying to say; I hope if I one tried to open a PR, he/she
wont be told, first write a PEP.

Best,
Joannah

On Fri, Apr 3, 2020 at 1:15 PM Mark Shannon <m...@hotpy.org> wrote:

> Hi Joannah,
>
> On 03/04/2020 4:13 pm, joannah nanjekye wrote:
> > Hey all,
> >
> >  From my CS theory, a control flow graph models a program flow and one
> > of its main characteristics is it has one entry and exit point. IIRC,
>
> CPython's CFG has multiple exit points, but that shouldn't matter.
>
> > CPython’s compilation process involves generation of a control flow
> graph.
> I started playing with moving the CFG optimizations from the peepholer
> to their own pass back at the core sprints in London.
> I've worked on it a bit since, but not for a while.
> My branch is here:
>
> https://github.com/python/cpython/compare/master...markshannon:cfg-optimizer
>
> One thing that is blocking progress is the line-number table format.
> There is no way to say that an instruction does not have a line number
> attached to it. That makes handling and transforming of compiler
> generated code (implicit `return None`s, for example) harder.
>
> See https://bugs.python.org/issue39537
> It's not an insurmountable obstacle, but it is something to be aware of.
>
> >
> > Contrary to peephole optimizations, optimizations on the  control flow
> > graph are more global allowing us to have complex and global
> > optimizations like branch and checkpoint eliminations etc.
>
> Checkpoints for tracing or concurrent GC are not something we need to
> worry about.
>
> Because Python is so dynamic, there is little we can do in the way of
> further optimizations in the bytecode compiler apart from control flow
> improvements.
> However, Python does have some fairly complex control flow, so there is
> room for improvement.
>
> >
> >
> > I have seen several implementations of control flow optimizations. The
> > one I am familiar with is the V8 control flow optimizer.
>
> I'm not familiar with it. Is there a summary online?
>
> >
> >
> > I tried to investigate this for one of my directed courses last fall but
> > I want to know if there are people who have been thinking about this for
> > CPython and what their thoughts are.
>
> There won't be much of a speed up, maybe 2 or 3%, but adding an explicit
> CFG optimisation pass will improve maintainability as we won't need to
> regenerate the CFG after bytecode layout.
>
> I'd be happy to offer advice and review any PRs.
>
> Cheers,
> Mark.
>
> >
> > --
> > //Best,
> > Joannah Nanjekye
> > /"You think you know when you learn, are more sure when you can write,
> > even more when you can teach, but certain when you can program."
> > Alan J. Perlis/
> >
> > _______________________________________________
> > Python-Dev mailing list -- python-dev@python.org
> > To unsubscribe send an email to python-dev-le...@python.org
> > https://mail.python.org/mailman3/lists/python-dev.python.org/
> > Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/I376QAAWUHVLO5WGFFNOBTZAUPAVZKCB/
> > Code of Conduct: http://python.org/psf/codeofconduct/
> >
>


-- 
Best,
Joannah Nanjekye

*"You think you know when you learn, are more sure when you can write, even
more when you can teach, but certain when you can program." Alan J. Perlis*
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/7HPSFVHR64ELVRE2OXVNOAQED3WIHAYX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to