[issue33318] Move folding tuples of constants into compiler.c from peephole.c

2018-04-29 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: -6338 ___ Python tracker ___ ___

[issue33318] Move folding tuples of constants into compiler.c from peephole.c

2018-04-29 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +6338 ___ Python tracker ___ ___ Python-bugs-list

[issue33318] Move folding tuples of constants into compiler.c from peephole.c

2018-04-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: For clarifying, this issue doesn't have any relations to the AST optimizer. Tuples of constants are already optimized at the AST level, but there are other tuples created in code, which don't correspond any AST node. They are

[issue33318] Move folding tuples of constants into compiler.c from peephole.c

2018-04-20 Thread Nick Coghlan
Nick Coghlan added the comment: If I recall Eugene Toder's previous AST-level compilation patches correctly, they handle this problem by putting the AST optimisation step *after* the output of the Py_CF_ONLY_AST step. This meant that if you're running the source->AST step

[issue33318] Move folding tuples of constants into compiler.c from peephole.c

2018-04-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm not convinced by this. One of the points of separating the optimizer from the compiler is that people wanting to study/extend the compiler don't have to filter through optimization-related routines. Separating initial code generation

[issue33318] Move folding tuples of constants into compiler.c from peephole.c

2018-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: +0 It looks like there is a small net win. Conceptually, constant folding is better done upstream where more semantic information is available (rather than downstream when the meaning has to be deduced from the opcodes). The

[issue33318] Move folding tuples of constants into compiler.c from peephole.c

2018-04-20 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +6241 stage: -> patch review ___ Python tracker ___

[issue33318] Move folding tuples of constants into compiler.c from peephole.c

2018-04-20 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Explicit tuples of constants are folded in the AST optimizer since 3.7. But peephole.c still contains the code for folding tuples of constants, because there are tuples created by the compiler. For example "[1, 2, *a]", "f(1,