[pypy-svn] r32305 - in pypy/dist/pypy/jit/hintannotator: . test
pedronis at codespeak.net
pedronis at codespeak.net
Thu Sep 14 14:34:36 CEST 2006
Author: pedronis
Date: Thu Sep 14 14:34:34 2006
New Revision: 32305
Modified:
pypy/dist/pypy/jit/hintannotator/bookkeeper.py
pypy/dist/pypy/jit/hintannotator/container.py
pypy/dist/pypy/jit/hintannotator/test/test_annotator.py
Log:
simple tests about methods. fix a small bug in graph_family_call.
The abstract container test is skipped: it explodes because our cast logic for abstract containers
doesn't even try to do anything sane for dynamic casts from a small to a larger structs.
Modified: pypy/dist/pypy/jit/hintannotator/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/jit/hintannotator/bookkeeper.py (original)
+++ pypy/dist/pypy/jit/hintannotator/bookkeeper.py Thu Sep 14 14:34:34 2006
@@ -212,7 +212,7 @@
hs_res = hintmodel.reorigin(hs_res, *deps_hs)
return hs_res
- def graph_family_call(self, graph, fixed, args_hs):
+ def graph_family_call(self, graph_list, fixed, args_hs):
tsgraphs = []
results_hs = []
for graph in graph_list:
Modified: pypy/dist/pypy/jit/hintannotator/container.py
==============================================================================
--- pypy/dist/pypy/jit/hintannotator/container.py (original)
+++ pypy/dist/pypy/jit/hintannotator/container.py Thu Sep 14 14:34:34 2006
@@ -104,6 +104,7 @@
else:
for n in range(-down_or_up):
vstruct = vstruct.vparent
+ assert vstruct
return vstruct
def fieldtype(self, name):
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 Sep 14 14:34:34 2006
@@ -531,3 +531,45 @@
assert isinstance(hs, SomeLLAbstractConstant)
assert hs.is_green()
assert not hs.is_fixed()
+
+def test_blue_simple_meth():
+ py.test.skip("with abstract containers this test explode in the cast_pointer annotation logic")
+ class Base(object):
+
+ def m(self):
+ raise NotImplementedError
+
+ class Concrete(Base):
+
+ def m(self):
+ return 42
+
+ def f(flag):
+ if flag:
+ o = Base()
+ else:
+ o = Concrete()
+ return o.m()
+
+ hs = hannotate(f, [bool], policy=P_OOPSPEC)
+
+
+def test_simple_meth():
+ class Base(object):
+
+ def m(self):
+ raise NotImplementedError
+
+ class Concrete(Base):
+
+ def m(self):
+ return 42
+
+ def f(flag):
+ if flag:
+ o = Base()
+ else:
+ o = Concrete()
+ return o.m()
+
+ hs = hannotate(f, [bool], policy=P_OOPSPEC_NOVIRTUAL)
More information about the Pypy-commit
mailing list