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

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Feb 25 22:00:17 CET 2008


Author: cfbolz
Date: Mon Feb 25 22:00:13 2008
New Revision: 51865

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/portal.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py
   pypy/branch/jit-refactoring/pypy/jit/timeshifter/rtimeshift.py
   pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_portal.py
Log:
move over some tests and fix problems I found trying to run them


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 22:00:13 2008
@@ -936,14 +936,18 @@
                   indexboxindex, valboxindex)
 
     def serialize_op_getarraysize(self, op):
+        color = self.opcolor(op)
         arrayvar, = op.args
         PTRTYPE = arrayvar.concretetype
         if PTRTYPE.TO.OF is lltype.Void:
             return
         fielddescindex = self.arrayfielddesc_position(PTRTYPE.TO)
         arrayindex = self.serialize_oparg("red", arrayvar)
-        self.emit("red_getarraysize", arrayindex, fielddescindex)
-        self.register_redvar(op.result)
+        self.emit("%s_getarraysize" % (color, ), arrayindex, fielddescindex)
+        if color == "red":
+            self.register_redvar(op.result)
+        else:
+            self.register_greenvar(op.result)
 
     def serialize_op_getinteriorfield(self, op):
         color = self.opcolor(op)

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	Mon Feb 25 22:00:13 2008
@@ -624,6 +624,10 @@
     def opimpl_red_getarraysize(self, arraybox, fielddesc):
         return rtimeshift.gengetarraysize(self.jitstate, fielddesc, arraybox)
 
+    @arguments("red", "arraydesc", returns="green_from_red")
+    def opimpl_green_getarraysize(self, arraybox, fielddesc):
+        return rtimeshift.gengetarraysize(self.jitstate, fielddesc, arraybox)
+
     @arguments("red", "interiordesc", "bool", "red_varargs", returns="red")
     def opimpl_red_getinteriorfield(self, structbox, interiordesc, deepfrozen,
                                     indexboxes):

Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/portal.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/portal.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/portal.py	Mon Feb 25 22:00:13 2008
@@ -5,7 +5,7 @@
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.rpython.annlowlevel import llhelper, cachedtype
 from pypy.rpython.llinterp import LLInterpreter
-from pypy.rpython.lltypesystem import lltype
+from pypy.rpython.lltypesystem import lltype, llmemory
 
 # graph transformations for transforming the portal graph(s)
 class PortalRewriter(object):

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 22:00:13 2008
@@ -137,6 +137,65 @@
         assert res == 68
         self.check_insns(int_floordiv=1, int_mul=0)
 
+    def test_dfa_compile(self):
+        py.test.skip("not working yet")
+        from pypy.lang.automata.dfa import getautomaton, convertdfa, recognizetable
+        a = getautomaton()
+        dfatable, final_states = convertdfa(a)
+        def main(gets):
+            s = ["aaaaaaaaaab", "aaaa"][gets]
+            return recognizetable(dfatable, s, final_states)
+
+        # must backendoptimize to remove the mallocs related
+        # to the interior ptrs
+        res = self.timeshift_from_portal(main, recognizetable, [0],
+                                         policy=P_NOVIRTUAL,
+                                         backendoptimize=True)
+        assert res
+
+        res = self.timeshift_from_portal(main, recognizetable, [1],
+                                         policy=P_NOVIRTUAL,
+                                         backendoptimize=True)
+        assert not res
+
+    def test_dfa_compile2(self):
+        py.test.skip("not working yet")
+        from pypy.lang.automata.dfa import getautomaton, convertagain, recognizeparts
+        more = [convertagain(getautomaton()), convertagain(getautomaton())]
+        def main(gets, gets2):
+            alltrans, final_states = more[gets2]
+            s = ["aaaaaaaaaab", "aaaa"][gets]
+            return recognizeparts(alltrans, final_states, s)
+
+        # must backendoptimize to remove the mallocs related
+        # to the interior ptrs
+        res = self.timeshift_from_portal(main, recognizeparts, [0, 0],
+                                         policy=P_NOVIRTUAL,
+                                         backendoptimize=True)
+        assert res
+
+        # XXX unfortunately we have to create a new version each time - because of pbc
+        res = self.timeshift_from_portal(main, recognizeparts, [1, 0],
+                                         policy=P_NOVIRTUAL,
+                                         backendoptimize=True)
+        assert not res
+
+    def test_dfa_compile3(self):
+        py.test.skip("not working yet")
+        from pypy.lang.automata.dfa import getautomaton, recognize3
+        def main(gets):
+            auto = getautomaton()
+            s = ["aaaaaaaaaab", "aaaa"][gets]
+            return recognize3(auto, s)
+
+        res = self.timeshift_from_portal(main, recognize3, [0],
+                                         policy=P_OOPSPEC)
+        assert res
+
+        res = self.timeshift_from_portal(main, recognize3, [1],
+                                         policy=P_OOPSPEC)
+        assert not res
+
     def test_method_call_nonpromote(self):
         class Base(object):
             pass

Modified: pypy/branch/jit-refactoring/pypy/jit/timeshifter/rtimeshift.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/timeshifter/rtimeshift.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/timeshifter/rtimeshift.py	Mon Feb 25 22:00:13 2008
@@ -203,7 +203,7 @@
         resgv = fielddesc.getarraysize_if_non_null(
                 jitstate, argbox.getgenvar(jitstate))
         if resgv is not None:
-            return fielddesc.makebox(jitstate, resgv)
+            return rvalue.redboxbuilder_int(fielddesc.indexkind, resgv)
     genvar = jitstate.curbuilder.genop_getarraysize(
         fielddesc.arraytoken,
         argbox.getgenvar(jitstate))

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 22:00:13 2008
@@ -142,61 +142,6 @@
         
 class TestPortal(PortalTest):
             
-    def test_dfa_compile(self):
-        from pypy.lang.automata.dfa import getautomaton, convertdfa, recognizetable
-        a = getautomaton()
-        dfatable, final_states = convertdfa(a)
-        def main(gets):
-            s = ["aaaaaaaaaab", "aaaa"][gets]
-            return recognizetable(dfatable, s, final_states)
-
-        # must backendoptimize to remove the mallocs related
-        # to the interior ptrs
-        res = self.timeshift_from_portal(main, recognizetable, [0],
-                                         policy=P_NOVIRTUAL,
-                                         backendoptimize=True)
-        assert res
-
-        res = self.timeshift_from_portal(main, recognizetable, [1],
-                                         policy=P_NOVIRTUAL,
-                                         backendoptimize=True)
-        assert not res
-
-    def test_dfa_compile2(self):
-        from pypy.lang.automata.dfa import getautomaton, convertagain, recognizeparts
-        more = [convertagain(getautomaton()), convertagain(getautomaton())]
-        def main(gets, gets2):
-            alltrans, final_states = more[gets2]
-            s = ["aaaaaaaaaab", "aaaa"][gets]
-            return recognizeparts(alltrans, final_states, s)
-
-        # must backendoptimize to remove the mallocs related
-        # to the interior ptrs
-        res = self.timeshift_from_portal(main, recognizeparts, [0, 0],
-                                         policy=P_NOVIRTUAL,
-                                         backendoptimize=True)
-        assert res
-
-        # XXX unfortunately we have to create a new version each time - because of pbc
-        res = self.timeshift_from_portal(main, recognizeparts, [1, 0],
-                                         policy=P_NOVIRTUAL,
-                                         backendoptimize=True)
-        assert not res
-
-    def test_dfa_compile3(self):
-        from pypy.lang.automata.dfa import getautomaton, recognize3
-        def main(gets):
-            auto = getautomaton()
-            s = ["aaaaaaaaaab", "aaaa"][gets]
-            return recognize3(auto, s)
-
-        res = self.timeshift_from_portal(main, recognize3, [0],
-                                         policy=P_OOPSPEC)
-        assert res
-
-        res = self.timeshift_from_portal(main, recognize3, [1],
-                                         policy=P_OOPSPEC)
-        assert not res
 
 
     def test_virt_obj_method_call_promote(self):



More information about the Pypy-commit mailing list