[pypy-svn] r51863 - in pypy/branch/jit-refactoring/pypy/jit: rainbow rainbow/test timeshifter/test

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Feb 25 21:34:37 CET 2008


Author: cfbolz
Date: Mon Feb 25 21:34:36 2008
New Revision: 51863

Modified:
   pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py
   pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_portal.py
Log:
one more test that just passes. typo


Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py	Mon Feb 25 21:34:36 2008
@@ -769,7 +769,7 @@
         emitted_args = []
         for v in op.args[1:]:
             emitted_args.append(self.serialize_oparg("red", v))
-        self.emit("red_residual_direct_call")
+        self.emit("red_residual_call")
         self.emit(func, pos, withexc, len(emitted_args), *emitted_args)
         self.emit(self.promotiondesc_position(lltype.Signed))
         self.register_redvar(op.result)

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	Mon Feb 25 21:34:36 2008
@@ -137,3 +137,78 @@
         assert res == 68
         self.check_insns(int_floordiv=1, int_mul=0)
 
+    def test_method_call_nonpromote(self):
+        class Base(object):
+            pass
+        class Int(Base):
+            def __init__(self, n):
+                self.n = n
+            def double(self):
+                return Int(self.n * 2)
+            def get(self):
+                return self.n
+        class Str(Base):
+            def __init__(self, s):
+                self.s = s
+            def double(self):
+                return Str(self.s + self.s)
+            def get(self):
+                return ord(self.s[4])
+
+        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.double().get()
+
+        res = self.timeshift_from_portal(ll_main, ll_function, [5], policy=P_NOVIRTUAL)
+        assert res == 10
+        self.check_insns(indirect_call=2)
+
+        res = self.timeshift_from_portal(ll_main, ll_function, [0], policy=P_NOVIRTUAL)
+        assert res == ord('2')
+        self.check_insns(indirect_call=2)
+
+    def test_method_call_promote(self):
+        py.test.skip("not working yet")
+        class Base(object):
+            pass
+        class Int(Base):
+            def __init__(self, n):
+                self.n = n
+            def double(self):
+                return Int(self.n * 2)
+            def get(self):
+                return self.n
+        class Str(Base):
+            def __init__(self, s):
+                self.s = s
+            def double(self):
+                return Str(self.s + self.s)
+            def get(self):
+                return ord(self.s[4])
+
+        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)
+            hint(o.__class__, promote=True)
+            return o.double().get()
+
+        res = self.timeshift_from_portal(ll_main, ll_function, [5], policy=P_NOVIRTUAL)
+        assert res == 10
+        self.check_insns(indirect_call=0)
+
+        res = self.timeshift_from_portal(ll_main, ll_function, [0], policy=P_NOVIRTUAL)
+        assert res == ord('2')
+        self.check_insns(indirect_call=0)

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	Mon Feb 25 21:34:36 2008
@@ -198,80 +198,6 @@
                                          policy=P_OOPSPEC)
         assert not res
 
-    def test_method_call_nonpromote(self):
-        class Base(object):
-            pass
-        class Int(Base):
-            def __init__(self, n):
-                self.n = n
-            def double(self):
-                return Int(self.n * 2)
-            def get(self):
-                return self.n
-        class Str(Base):
-            def __init__(self, s):
-                self.s = s
-            def double(self):
-                return Str(self.s + self.s)
-            def get(self):
-                return ord(self.s[4])
-
-        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.double().get()
-
-        res = self.timeshift_from_portal(ll_main, ll_function, [5], policy=P_NOVIRTUAL)
-        assert res == 10
-        self.check_insns(indirect_call=2)
-
-        res = self.timeshift_from_portal(ll_main, ll_function, [0], policy=P_NOVIRTUAL)
-        assert res == ord('2')
-        self.check_insns(indirect_call=2)
-
-    def test_method_call_promote(self):
-        class Base(object):
-            pass
-        class Int(Base):
-            def __init__(self, n):
-                self.n = n
-            def double(self):
-                return Int(self.n * 2)
-            def get(self):
-                return self.n
-        class Str(Base):
-            def __init__(self, s):
-                self.s = s
-            def double(self):
-                return Str(self.s + self.s)
-            def get(self):
-                return ord(self.s[4])
-
-        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)
-            hint(o.__class__, promote=True)
-            return o.double().get()
-
-        res = self.timeshift_from_portal(ll_main, ll_function, [5], policy=P_NOVIRTUAL)
-        assert res == 10
-        self.check_insns(indirect_call=0)
-
-        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_virt_obj_method_call_promote(self):
         class Base(object):



More information about the Pypy-commit mailing list