Source

pypy / pypy / translator / backendopt / constfold.py

Author Commit Message Labels Comments Date
Armin Rigo
Turn off reporting const-fold errors as WARNINGs. This gives quite a bunch of warnings in any C translation, and I've never had any use of them over the years, so well.
Armin Rigo
Tentative: kill various pieces of code left and right handling keepalives. Now the inliner no longer inserts tons of keepalives for you (which are almost always unneeded).
Armin Rigo
Yet another test and fix for the 'default' case of exitswitches.
Armin Rigo
Test and fix.
Armin Rigo
Another case for constfold: after an exitswitch on a variable, we know in all links the value of that variable. Two tests showing when this can be useful (the second one is a common occurrence in lltypesystem/rdict).
Armin Rigo
In constfold: For the case where link1.target contains only a switch, rewire link1 to go directly to the correct exit based on a constant switch value. This is a situation that occurs typically after inlining.
Armin Rigo
Reintroduce 47798 in a more conservative version. The flags in lloperation are not really consistent. Added a test for what I'm trying to achieve with this.
Maciej Fijalkowski
Revert 47798 as this have broke tests. I don't understand how to fix it properly though.
Armin Rigo
Check tryfold before trying to constant-fold. This avoids constant-folding debug_print...
Samuele Pedroni
oops, wrong logic. it seems there is no test obviously depending on iterating more than once.
Samuele Pedroni
try to have constfold move much more constants from links into blocks and into operations as arguments. This makes the line count of the implement*.c 2.5% smaller for pypy. It may help doing some very specific and late folding in funcgen itself.
Armin Rigo
(pedronis, arigo) Pass an extra test about catching exceptions in JITted code. More and more based on the exceptiontransform, this required some clean-ups and a strange flag to the latter to produce graphs that give more hints to the JIT. Added a sanity-check to llinterp: when returning from exceptiontransformed graphs with an exception set, the return value should really be the special error value.
Armin Rigo
Fix the constfold tests, and fix the bug shown by said fix.
Armin Rigo
constfold has the same bug as propagate fixed long ago: constant-folding getsubstruct might lead to the last ref to the parent GcStruct forgotten. This makes the GcStruct go away, and the back-end cannot compile it any longer. This could be fixed by making the back-ends smarter - after all, the parent GcStruct is not really needed - but that's a mess that we would have to repeat in each back-end. Instead, a quick hack does the job: in this situation, give the substructure a strong reference to its parent to keep the latter alive.
Armin Rigo
Fix for lltypesystem/test/test_rtagged. Someone please kill keepalives.
Armin Rigo
(arigo, bugged by pedronis) Keepalive fix in constfold.py.
Armin Rigo
Remove prints and update comments.
Armin Rigo
Some fixes in constfold.py. Intermediate check-in.
Armin Rigo
* an optimization in rtagged that avoids some tag-checking in cases where we know that the instance cannot be of the special tag class. Fixes a problem with constfold.py. * turn hard folding errors into warnings in constfold.py. * raise RuntimeError instead of TypeError in a cast situation in lltype that is not really a static typing error. * move a test helper, summary(graph) -> {'opname': count}, into objspace/flow/model.py.
Armin Rigo
in constfold: * shift keepalives at the end of blocks * hack hack to turn indirect_calls into direct_calls This allows constfold to pass the test_rtagged optimization check.
Armin Rigo
Fix to avoid crashing on obscure unlisted operations. This seems to produce a working pypy-c now.
Armin Rigo
Experiment with a simple constant-folding backend-opt, based on calling llop.opname().