[pypy-svn] r51888 - in pypy/branch/jit-refactoring/pypy/jit: rainbow/test timeshifter/test
cfbolz at codespeak.net
cfbolz at codespeak.net
Wed Feb 27 00:00:11 CET 2008
Author: cfbolz
Date: Wed Feb 27 00:00:09 2008
New Revision: 51888
Modified:
pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py
pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_portal.py
Log:
move over more passing tests
Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py (original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py Wed Feb 27 00:00:09 2008
@@ -268,3 +268,59 @@
res = self.timeshift_from_portal(ll_main, ll_function, [0], policy=P_NOVIRTUAL)
assert res == ord('2')
self.check_insns(indirect_call=0)
+
+ def test_isinstance(self):
+ class Base(object):
+ pass
+ class Int(Base):
+ def __init__(self, n):
+ self.n = n
+ class Str(Base):
+ def __init__(self, s):
+ self.s = s
+
+ def ll_main(n):
+ if n > 0:
+ o = Int(n)
+ else:
+ o = Str('123')
+ return ll_function(o)
+
+ def ll_function(o):
+ hint(o, deepfreeze=True)
+ hint(o, concrete=True)
+ x = isinstance(o, Str)
+ return x
+
+
+ res = self.timeshift_from_portal(ll_main, ll_function, [5], policy=P_NOVIRTUAL)
+ assert not res
+
+ def test_greenmethod_call_nonpromote(self):
+ class Base(object):
+ pass
+ class Int(Base):
+ def __init__(self, n):
+ self.n = n
+ def tag(self):
+ return 123
+ class Str(Base):
+ def __init__(self, s):
+ self.s = s
+ def tag(self):
+ return 456
+
+ def ll_main(n):
+ if n > 0:
+ o = Int(n)
+ else:
+ o = Str('123')
+ return ll_function(o)
+
+ def ll_function(o):
+ hint(None, global_merge_point=True)
+ return o.tag()
+
+ res = self.timeshift_from_portal(ll_main, ll_function, [5], policy=P_NOVIRTUAL)
+ assert res == 123
+ self.check_insns(indirect_call=1)
Modified: pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_portal.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_portal.py (original)
+++ pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_portal.py Wed Feb 27 00:00:09 2008
@@ -254,61 +254,6 @@
res = self.timeshift_from_portal(main, evaluate, [4, 7])
assert res == 11
- def test_isinstance(self):
- class Base(object):
- pass
- class Int(Base):
- def __init__(self, n):
- self.n = n
- class Str(Base):
- def __init__(self, s):
- self.s = s
-
- def ll_main(n):
- if n > 0:
- o = Int(n)
- else:
- o = Str('123')
- return ll_function(o)
-
- def ll_function(o):
- hint(o, deepfreeze=True)
- hint(o, concrete=True)
- x = isinstance(o, Str)
- return x
-
-
- res = self.timeshift_from_portal(ll_main, ll_function, [5], policy=P_NOVIRTUAL)
- assert not res
-
- def test_greenmethod_call_nonpromote(self):
- class Base(object):
- pass
- class Int(Base):
- def __init__(self, n):
- self.n = n
- def tag(self):
- return 123
- class Str(Base):
- def __init__(self, s):
- self.s = s
- def tag(self):
- return 456
-
- def ll_main(n):
- if n > 0:
- o = Int(n)
- else:
- o = Str('123')
- return ll_function(o)
-
- def ll_function(o):
- hint(None, global_merge_point=True)
- return o.tag()
-
- res = self.timeshift_from_portal(ll_main, ll_function, [5], policy=P_NOVIRTUAL)
- assert res == 123
- self.check_insns(indirect_call=1)
def test_residual_red_call_with_promoted_exc(self):
def h(x):
More information about the Pypy-commit
mailing list