[pypy-svn] r52073 - in pypy/branch/jit-refactoring/pypy/jit/rainbow: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Mar 2 20:56:13 CET 2008


Author: cfbolz
Date: Sun Mar  2 20:56:13 2008
New Revision: 52073

Modified:
   pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_frontend.py
Log:
support for _is_early_constant as well


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	Sun Mar  2 20:56:13 2008
@@ -1236,6 +1236,19 @@
         else:
             self.register_greenvar(op.result)
 
+    def serialize_op_is_early_constant(self, op):
+        consttrue = flowmodel.Constant(True, lltype.Bool)
+        trueindex = self.serialize_oparg("green", consttrue)
+        if self.varcolor(op.args[0]) == "green":
+            self.register_greenvar(op.result, trueindex)
+        else:
+            constfalse = flowmodel.Constant(False, lltype.Bool)
+            falseindex = self.serialize_oparg("green", constfalse)
+            argindex = self.serialize_oparg("red", op.args[0])
+            self.emit("is_constant")
+            self.emit(argindex, trueindex, falseindex)
+            self.register_greenvar(op.result)
+
 
     # call handling
 

Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py	Sun Mar  2 20:56:13 2008
@@ -771,6 +771,13 @@
         return interiordesc.gengetinteriorarraysize(
             self.jitstate, arraybox, indexboxes)
 
+    @arguments("red", "green", "green", returns="green")
+    def opimpl_is_constant(self, arg, true, false):
+        if arg.is_constant():
+            return true
+        return false
+
+
     # ____________________________________________________________
     # construction-time interface
 

Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_frontend.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_frontend.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_frontend.py	Sun Mar  2 20:56:13 2008
@@ -20,7 +20,6 @@
         assert res == 42
 
     def test_is_early_constant(self):
-        py.test.skip("implement me")
         def f(x):
             if _is_early_constant(x):
                 return 42
@@ -32,7 +31,6 @@
         assert res == 42
 
     def test_is_early_constant_for_green(self):
-        py.test.skip("implement me")
         def g(x):
             if _is_early_constant(x):
                 return 42


More information about the pypy-svn mailing list