[pypy-svn] r14563 - in pypy/dist/pypy/rpython: . test
arigo at codespeak.net
arigo at codespeak.net
Tue Jul 12 20:06:27 CEST 2005
Author: arigo
Date: Tue Jul 12 20:06:25 2005
New Revision: 14563
Modified:
pypy/dist/pypy/rpython/rpbc.py
pypy/dist/pypy/rpython/test/test_rpbc.py
Log:
get_unique_interplevel_subclass() is specialized in PyPy. This has the
result that the memo calls are only given a single possible argument!
Needs to support this in the rtyper.
Modified: pypy/dist/pypy/rpython/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/rpbc.py (original)
+++ pypy/dist/pypy/rpython/rpbc.py Tue Jul 12 20:06:25 2005
@@ -526,6 +526,8 @@
def rtype_call_memo(hop):
memo_table = hop.args_v[0].value
+ if memo_table.s_result.is_constant():
+ return hop.inputconst(hop.r_result, memo_table.s_result.const)
fieldname = memo_table.fieldname
assert hop.nb_args == 2, "XXX"
Modified: pypy/dist/pypy/rpython/test/test_rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rpbc.py (original)
+++ pypy/dist/pypy/rpython/test/test_rpbc.py Tue Jul 12 20:06:25 2005
@@ -269,6 +269,18 @@
res = interpret(f1, [2])
assert res == 6
+def test_call_memo_with_single_value():
+ class A: pass
+ def memofn(cls):
+ return len(cls.__name__)
+ memofn._annspecialcase_ = "specialize:memo"
+
+ def f1():
+ A() # make sure we have a ClassDef
+ return memofn(A)
+ res = interpret(f1, [])
+ assert res == 1
+
def test_rpbc_bound_method_static_call():
class R:
def meth(self):
More information about the Pypy-commit
mailing list