Author: Ronan Lamy <[email protected]>
Branch:
Changeset: r82318:6f907027fbb2
Date: 2016-02-17 23:18 +0000
http://bitbucket.org/pypy/pypy/changeset/6f907027fbb2/
Log: kill unused make_constgraphbuilder()
diff --git a/rpython/annotator/specialize.py b/rpython/annotator/specialize.py
--- a/rpython/annotator/specialize.py
+++ b/rpython/annotator/specialize.py
@@ -317,18 +317,6 @@
yield (value,) + tuple_tail
-def make_constgraphbuilder(n, v=None, factory=None, srcmodule=None):
- def constgraphbuilder(translator, ignore):
- args = ','.join(["arg%d" % i for i in range(n)])
- if factory is not None:
- computed_v = factory()
- else:
- computed_v = v
- miniglobals = {'v': computed_v, '__name__': srcmodule}
- exec py.code.Source("constf = lambda %s: v" % args).compile() in
miniglobals
- return translator.buildflowgraph(miniglobals['constf'])
- return constgraphbuilder
-
def maybe_star_args(funcdesc, key, args_s):
args_s, key1, builder = flatten_star_args(funcdesc, args_s)
if key1 is not None:
diff --git a/rpython/rtyper/test/test_rpbc.py b/rpython/rtyper/test/test_rpbc.py
--- a/rpython/rtyper/test/test_rpbc.py
+++ b/rpython/rtyper/test/test_rpbc.py
@@ -1,7 +1,7 @@
import py
from rpython.annotator import model as annmodel
-from rpython.annotator import policy, specialize
+from rpython.annotator import specialize
from rpython.rtyper.lltypesystem.lltype import typeOf
from rpython.rtyper.test.tool import BaseRtypingTest
from rpython.rtyper.llannotation import SomePtr, lltype_to_annotation
@@ -1690,59 +1690,6 @@
# ____________________________________________________________
-class TestRPBCExtra(BaseRtypingTest):
-
- def test_folding_specialize_support(self):
-
- class S(object):
-
- def w(s, x):
- if isinstance(x, int):
- return x
- if isinstance(x, str):
- return len(x)
- return -1
- w._annspecialcase_ = "specialize:w"
-
- def _freeze_(self):
- return True
-
- s = S()
-
- def f(i, n):
- w = s.w
- if i == 0:
- return w(0)
- elif i == 1:
- return w("abc")
- elif i == 2:
- return w(3*n)
- elif i == 3:
- return w(str(n))
- return -1
-
- class P(policy.AnnotatorPolicy):
- def specialize__w(pol, funcdesc, args_s):
- typ = args_s[1].knowntype
- if args_s[0].is_constant() and args_s[1].is_constant():
- x = args_s[1].const
- v = s.w(x)
- builder = specialize.make_constgraphbuilder(2, v)
- return funcdesc.cachedgraph(x, builder=builder)
- return funcdesc.cachedgraph(typ)
-
- p = P()
-
- res = self.interpret(f, [0, 66], policy=p)
- assert res == 0
- res = self.interpret(f, [1, 66], policy=p)
- assert res == 3
- res = self.interpret(f, [2, 4], policy=p)
- assert res == 12
- res = self.interpret(f, [3, 5555], policy=p)
- assert res == 4
-
-
def test_hlinvoke_simple():
def f(a,b):
return a + b
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit