[pypy-svn] r55237 - in pypy/branch/oo-jit/pypy/jit: rainbow rainbow/test timeshifter

antocuni at codespeak.net antocuni at codespeak.net
Mon May 26 10:09:46 CEST 2008


Author: antocuni
Date: Mon May 26 10:09:45 2008
New Revision: 55237

Modified:
   pypy/branch/oo-jit/pypy/jit/rainbow/test/test_promotion.py
   pypy/branch/oo-jit/pypy/jit/rainbow/typesystem.py
   pypy/branch/oo-jit/pypy/jit/timeshifter/rtimeshift.py
Log:
start porting promotion tests to ootype



Modified: pypy/branch/oo-jit/pypy/jit/rainbow/test/test_promotion.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/test/test_promotion.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/test/test_promotion.py	Mon May 26 10:09:45 2008
@@ -4,11 +4,11 @@
 from pypy.jit.rainbow.test.test_interpreter import StopAtXPolicy
 from pypy.jit.rainbow.test.test_interpreter import P_NOVIRTUAL
 from pypy.jit.rainbow.test.test_vlist import P_OOPSPEC
+from pypy.jit.rainbow.test.test_interpreter import OOTypeMixin
 from pypy.rlib.jit import hint
 from pypy.rpython.module.support import LLSupport
 
-class TestPromotion(InterpretationTest):
-    type_system = "lltype"
+class BaseTestPromotion(InterpretationTest):
     small = True
 
     def test_simple_promotion(self):
@@ -461,3 +461,22 @@
         res = self.interpret(ll_function, [4, 7], [], policy=P_NOVIRTUAL)
         assert res == 11
         self.check_insns(int_add=0)
+
+class TestLLType(BaseTestPromotion):
+    type_system = "lltype"
+
+class TestOOType(OOTypeMixin, BaseTestPromotion):
+    type_system = "ootype"
+
+    def skip(self):
+        py.test.skip('in progress')
+
+    test_promote_after_call = skip
+    test_promote_after_yellow_call = skip
+    test_merge_then_promote = skip
+    test_vstruct_unfreeze = skip
+    test_more_promotes = skip
+    test_remembers_across_mp = skip
+    test_virtual_list_copy = skip
+    test_raise_result_mixup = skip
+    test_raise_result_mixup_some_more = skip

Modified: pypy/branch/oo-jit/pypy/jit/rainbow/typesystem.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/typesystem.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/typesystem.py	Mon May 26 10:09:45 2008
@@ -28,6 +28,7 @@
 
     name = 'lltype'
     ROOT_TYPE = llmemory.Address
+    BASE_OBJ_TYPE = base_ptr_lltype()
     NULL_OBJECT = base_ptr_lltype()._defl()
     cast_instance_to_base_ptr = staticmethod(cast_instance_to_base_ptr)
 
@@ -54,10 +55,15 @@
         FUNCPTRTYPE = lltype.Ptr(FUNCTYPE)
         return FUNCTYPE, FUNCPTRTYPE
 
+    def PromotionPoint(self, flexswitch, incoming_gv, promotion_path):
+        from pypy.jit.timeshifter.rtimeshift import PromotionPointLLType
+        return PromotionPointLLType(flexswitch, incoming_gv, promotion_path)
+
 class OOTypeHelper(TypeSystemHelper):
 
     name = 'ootype'
     ROOT_TYPE = ootype.Object
+    BASE_OBJ_TYPE = base_obj_ootype()
     NULL_OBJECT = base_obj_ootype()._defl()
     cast_instance_to_base_ptr = staticmethod(cast_instance_to_base_obj)
 
@@ -84,6 +90,10 @@
         FUNCTYPE = ootype.StaticMethod(ARGS, RESULT)
         return FUNCTYPE, FUNCTYPE
 
+    def PromotionPoint(self, flexswitch, incoming_gv, promotion_path):
+        from pypy.jit.timeshifter.rtimeshift import PromotionPointOOType
+        return PromotionPointOOType(flexswitch, incoming_gv, promotion_path)
+
 
 llhelper = LLTypeHelper()
 oohelper = OOTypeHelper()

Modified: pypy/branch/oo-jit/pypy/jit/timeshifter/rtimeshift.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/timeshifter/rtimeshift.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/timeshifter/rtimeshift.py	Mon May 26 10:09:45 2008
@@ -6,7 +6,7 @@
 from pypy.jit.timeshifter.greenkey import newgreendict, empty_key
 from pypy.rlib.objectmodel import we_are_translated
 from pypy.rlib.unroll import unrolling_iterable
-from pypy.rpython.annlowlevel import cachedtype, base_ptr_lltype
+from pypy.rpython.annlowlevel import cachedtype, base_ptr_lltype, base_obj_ootype
 from pypy.rpython.annlowlevel import cast_instance_to_base_ptr
 from pypy.rpython.annlowlevel import cast_base_ptr_to_instance, llhelper
 
@@ -680,7 +680,6 @@
         else:
             self.mergesleft = parent_mergesleft
 
-
 class PromotionPoint(object):
     def __init__(self, flexswitch, incoming_gv, promotion_path):
         assert promotion_path is not None
@@ -688,10 +687,16 @@
         self.incoming_gv = incoming_gv
         self.promotion_path = promotion_path
 
+class PromotionPointLLType(PromotionPoint):
+
     # hack for testing: make the llinterpreter believe this is a Ptr to base
     # instance
     _TYPE = base_ptr_lltype()
 
+class PromotionPointOOType(PromotionPoint):
+    _TYPE = base_obj_ootype()
+
+
 class AbstractPromotionPath(object):
     cut_limit = False
 
@@ -813,7 +818,7 @@
         ll_continue_compilation._debugexc = True
 
         ts = interpreter.ts
-        FUNCTYPE, FUNCPTRTYPE = ts.get_FuncType([base_ptr_lltype(), ERASED], lltype.Void)
+        FUNCTYPE, FUNCPTRTYPE = ts.get_FuncType([ts.BASE_OBJ_TYPE, ERASED], lltype.Void)
         self.FUNCPTRTYPE = FUNCPTRTYPE
         self.sigtoken = interpreter.rgenop.sigToken(FUNCTYPE)
 
@@ -843,8 +848,8 @@
         if resuming is None:
             jitstate.curbuilder = default_builder
             # default case of the switch:
-            pm = PromotionPoint(flexswitch, incoming_gv,
-                                jitstate.promotion_path)
+            pm = jitstate.ts.PromotionPoint(flexswitch, incoming_gv,
+                                            jitstate.promotion_path)
             #debug_print(lltype.Void, "PROMOTE")
             ll_pm = _cast_promotion_point_to_base_ptr(jitstate, pm)
             gv_pm = default_builder.rgenop.genconst(ll_pm)



More information about the Pypy-commit mailing list