[pypy-commit] pypy jit-usable_retrace_3: conditionals

hakanardo noreply at buildbot.pypy.org
Mon Jan 14 19:17:32 CET 2013


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-usable_retrace_3
Changeset: r60060:c7d96f0b3ac3
Date: 2013-01-13 18:33 +0100
http://bitbucket.org/pypy/pypy/changeset/c7d96f0b3ac3/

Log:	conditionals

diff --git a/pypy/jit/metainterp/test/test_random_loops.py b/pypy/jit/metainterp/test/test_random_loops.py
--- a/pypy/jit/metainterp/test/test_random_loops.py
+++ b/pypy/jit/metainterp/test/test_random_loops.py
@@ -14,6 +14,16 @@
     def sub(self, other):
         return IntBox(self.value() - other.value())
 
+    def gt(self, other):
+        return IntBox(self.value() > other.value())
+
+    def lt(self, other):
+        return IntBox(self.value() < other.value())
+
+    def eq(self, other):
+        return IntBox(self.value() == other.value())
+
+
 class UnknonwOpCode(Exception):
     pass
 
@@ -63,12 +73,25 @@
                     value = prev.add(value)
                 elif op == '-':
                     value = prev.sub(value)
+                elif op == '>':
+                    value = prev.gt(value)
+                elif op == '<':
+                    value = prev.lt(value)
+                elif op == '=':
+                    value = prev.eq(value)
                 elif op == '{':
                     pass
                 elif op == '}':
                     if value.value():
                         pc -= offsets[pc]
                         myjitdriver.can_enter_jit(pc=pc, a=a, b=b, c=c, d=d, e=e, value=value, prev=prev)
+                elif op == '(':
+                    if not value.value():
+                        value = IntBox(1)
+                        pc += offsets[pc]
+                        myjitdriver.can_enter_jit(pc=pc, a=a, b=b, c=c, d=d, e=e, value=value, prev=prev)
+                elif op == ')':
+                    value = IntBox(0)
                 else:
                     raise UnknonwOpCode
 
@@ -110,5 +133,8 @@
     def test_loop(self):
         self.check('0A9B{ab+Ab1-Bb}', a=45)
 
+    def test_conditional(self):
+        self.check('0A0C9B{b4<(a1+A)(c1+C)b1-Bb}', c=6, a=3)
+
 class TestLLtype(BaseTests, LLJitMixin):
     pass


More information about the pypy-commit mailing list