[pypy-svn] r49947 - in pypy/dist/pypy/jit/hintannotator: . test
antocuni at codespeak.net
antocuni at codespeak.net
Thu Dec 20 10:32:58 CET 2007
Author: antocuni
Date: Thu Dec 20 10:32:56 2007
New Revision: 49947
Modified:
pypy/dist/pypy/jit/hintannotator/model.py
pypy/dist/pypy/jit/hintannotator/test/test_annotator.py
Log:
yai! One more test passes :-)
Modified: pypy/dist/pypy/jit/hintannotator/model.py
==============================================================================
--- pypy/dist/pypy/jit/hintannotator/model.py (original)
+++ pypy/dist/pypy/jit/hintannotator/model.py Thu Dec 20 10:32:56 2007
@@ -518,12 +518,19 @@
# it's a method of a BuiltinType
bk = getbookkeeper()
origin = bk.myorigin()
- d = setadd(hs_c1.origins, origin)
+ d = hs_c1.origins.copy()
+ eager_concrete = hs_c1.eager_concrete
+ for hs_arg in args_hs:
+ d.update(hs_arg.origins)
+ eager_concrete = eager_concrete or hs_arg.eager_concrete
+ d.update({origin: True})
+
RESTYPE = bk.current_op_concretetype()
hs_res = SomeLLAbstractConstant(RESTYPE, d,
- eager_concrete = hs_c1.eager_concrete,
+ eager_concrete = eager_concrete,
myorigin = origin)
- # if hs_c1.is_constant(): ...
+ # if hs_c1.is_constant(): # and hs_arg.is_constat() for all args_hs
+ # XXX # constfold here?
return hs_res
elif len(graph_list) == 1:
# like a direct_call
Modified: pypy/dist/pypy/jit/hintannotator/test/test_annotator.py
==============================================================================
--- pypy/dist/pypy/jit/hintannotator/test/test_annotator.py (original)
+++ pypy/dist/pypy/jit/hintannotator/test/test_annotator.py Thu Dec 20 10:32:56 2007
@@ -75,7 +75,6 @@
assert len(hs.origins) == 4
assert hs.concretetype == lltype.Signed
-
def test_simple_hint_result(self):
def ll_function(cond, x,y):
if cond:
@@ -699,6 +698,22 @@
hs = self.hannotate(ll_function, [int, int], policy=P_NOVIRTUAL)
assert hs.is_green()
+ def test_concrete_fnptr_for_green_method_call(self):
+ class A:
+ def h(self, n):
+ return n*10
+ class B(A):
+ def h(self, n):
+ return n+20
+ lst = [A(), B()]
+ def ll_function(n, m):
+ obj = hint(lst, deepfreeze=True)[m]
+ res = obj.h(n)
+ hint(res, concrete=True) # so 'obj' and 'h' get green, so 'm' gets green
+ return m
+
+ hs = self.hannotate(ll_function, [int, int], policy=P_NOVIRTUAL)
+ assert hs.is_green()
def test_indirect_yellow_call(self):
More information about the pypy-svn
mailing list