[pypy-svn] r55516 - in pypy/branch/oo-jit/pypy/jit/rainbow: . test

antocuni at codespeak.net antocuni at codespeak.net
Tue Jun 3 16:00:06 CEST 2008


Author: antocuni
Date: Tue Jun  3 16:00:03 2008
New Revision: 55516

Modified:
   pypy/branch/oo-jit/pypy/jit/rainbow/codewriter.py
   pypy/branch/oo-jit/pypy/jit/rainbow/test/test_portal.py
Log:
emit yellow_retrieve_result_as_red only just after
vstruct_oosend. This fixes a bug that prevented
test_greenmethod_call_nonpromote to run



Modified: pypy/branch/oo-jit/pypy/jit/rainbow/codewriter.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/codewriter.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/codewriter.py	Tue Jun  3 16:00:03 2008
@@ -1789,7 +1789,7 @@
         self.emit(methdescindex)
         self.emit(has_result)
 
-    def handle_red_oosend(self, op, withexc):
+    def handle_red_or_yellow_oosend(self, op, withexc, kind):
         SELFTYPE, name, opargs = self.decompose_oosend(op)
         has_result = self.has_result(op)
         graph2tsgraph = dict(self.graphs_from(op))
@@ -1815,12 +1815,21 @@
         self.emit(*emitted_args)
         methnameindex = self.string_position(name)
         self.emit(methnameindex)
-
+        if kind == 'yellow':
+            self.emit("yellow_retrieve_result_as_red")
+            self.emit(self.type_position(op.result.concretetype))
+            
         if has_result:
             self.register_redvar(op.result)
 
         self.emit(label(("after oosend", op)))
 
+    def handle_yellow_oosend(self, op, withexc):
+        return self.handle_red_or_yellow_oosend(op, withexc, 'yellow')
+
+    def handle_red_oosend(self, op, withexc):
+        return self.handle_red_or_yellow_oosend(op, withexc, 'red')
+
     def handle_direct_oosend(self, op, withexc):
         SELFTYPE, name, opargs = self.decompose_oosend(op)
         has_result = self.has_result(op)
@@ -1838,10 +1847,6 @@
         if has_result:
             self.register_redvar(op.result)
 
-    def handle_yellow_oosend(self, op, withexc):
-        self.handle_red_oosend(op, withexc)
-        self.emit("yellow_retrieve_result_as_red")
-        self.emit(self.type_position(op.result.concretetype))
 
     def fill_methodcodes(self, INSTANCE, methname, graph2tsgraph):
         TYPES = [INSTANCE] + INSTANCE._subclasses

Modified: pypy/branch/oo-jit/pypy/jit/rainbow/test/test_portal.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/test/test_portal.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/test/test_portal.py	Tue Jun  3 16:00:03 2008
@@ -352,7 +352,7 @@
 
         res = self.timeshift_from_portal(ll_main, ll_function, [5], policy=P_NOVIRTUAL)
         assert res == 123
-        self.check_insns(indirect_call=1)
+        self.check_method_calls(1)
 
     def test_cast_ptr_to_int(self):
         GCS1 = lltype.GcStruct('s1', ('x', lltype.Signed))
@@ -628,7 +628,7 @@
     type_system = 'ootype'
 
     def check_method_calls(self, n):
-        self.check_insns(oosend=2)
+        self.check_insns(oosend=n)
 
     def _skip(self):
         py.test.skip('in progress')
@@ -636,7 +636,6 @@
     test_method_call_promote = _skip
     test_float_promote = _skip
     test_isinstance = _skip
-    test_greenmethod_call_nonpromote = _skip
     test_virt_obj_method_call_promote = _skip
     test_simple_recursive_portal_call_with_exc = _skip
 
@@ -644,4 +643,4 @@
     type_system = 'lltype'
 
     def check_method_calls(self, n):
-        self.check_insns(indirect_call=2)
+        self.check_insns(indirect_call=n)



More information about the Pypy-commit mailing list