[pypy-svn] r54224 - in pypy/branch/oo-jit/pypy/jit/codegen/cli: . test

antocuni at codespeak.net antocuni at codespeak.net
Tue Apr 29 12:01:24 CEST 2008


Author: antocuni
Date: Tue Apr 29 12:01:24 2008
New Revision: 54224

Modified:
   pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py
   pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_rgenop.py
Log:
split the tests into direct and compiled, as in rgenop_tests; lot of
them are broken in strange ways



Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py	Tue Apr 29 12:01:24 2008
@@ -18,6 +18,7 @@
 
 cInt32 = classof(System.Int32)
 cBoolean = classof(System.Boolean)
+cDouble = classof(System.Double)
 cObject = classof(System.Object)
 
 class SigToken:
@@ -105,6 +106,27 @@
     def __repr__(self):
         return "const=%s" % self.value
 
+
+class FloatConst(GenConst):
+
+    def __init__(self, value):
+        self.value = value
+
+    @specialize.arg(1)
+    def revealconst(self, T):
+        assert T is ootype.Float
+        if T is ootype.Float:
+            return self.value
+
+    def getCliType(self):
+        return typeof(System.Double)
+
+    def load(self, builder):
+        builder.il.Emit(OpCodes.Ldc_R8, self.value)
+
+    def __repr__(self):
+        return "const=%s" % self.value
+
 class BaseConst(GenConst):
 
     def _get_index(self, builder):
@@ -161,7 +183,8 @@
 
     def getobj(self):
         # XXX: should the conversion be done automatically?
-        return ootype.ooupcast(OBJECT, self.holder)
+        #return ootype.ooupcast(OBJECT, self.holder)
+        return self.holder
 
     def load(self, builder):
         holdertype = box(self.holder).GetType()
@@ -197,6 +220,8 @@
             return IntConst(llvalue)
         elif T is ootype.Bool:
             return IntConst(int(llvalue))
+        elif T is ootype.Float:
+            return FloatConst(llvalue)
         elif T is llmemory.Address:
             assert llvalue is llmemory.NULL
             return zero_const
@@ -234,6 +259,8 @@
             return cInt32
         elif T is ootype.Bool:
             return cBoolean
+        elif T is ootype.Float:
+            return cDouble
         elif isinstance(T, ootype.Instance):
             return cObject # XXX?
         else:

Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_rgenop.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_rgenop.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_rgenop.py	Tue Apr 29 12:01:24 2008
@@ -1,69 +1,53 @@
 import py
 from pypy.rpython.ootypesystem import ootype
 from pypy.jit.codegen.cli.rgenop import RCliGenOp
-from pypy.jit.codegen.test.rgenop_tests import AbstractRGenOpTests, OOType
+from pypy.jit.codegen.test.rgenop_tests import OOType
+from pypy.jit.codegen.test.rgenop_tests import AbstractRGenOpTestsDirect
+from pypy.jit.codegen.test.rgenop_tests import AbstractRGenOpTestsCompile
 from pypy.translator.cli.test.runtest import compile_function
 
-class TestRCliGenop(AbstractRGenOpTests):
+# for the individual tests see
+# ====> ../../test/rgenop_tests.py
+
+class TestRCliGenopDirect(AbstractRGenOpTestsDirect):
     RGenOp = RCliGenOp
     T = OOType
 
-    # for the individual tests see
-    # ====> ../../test/rgenop_tests.py
-
-    def getcompiled(self, fn, annotation, annotatorpolicy):
-        return compile_function(fn, annotation,
-                                annotatorpolicy=annotatorpolicy,
-                                nowrap=False)
-
-    def cast(self, gv, nb_args):
+    def cast(self, gv, nb_args, RESULT='not used'):
         "NOT_RPYTHON"
         def fn(*args):
             return gv.getobj().func.Invoke(*args)
         return fn
+    cast_float = cast
+    cast_whatever = cast
 
     def directtesthelper(self, FUNCTYPE, func):
         py.test.skip('???')
 
-    def test_largedummy_compile(self):
-        py.test.skip('it works only if we increase .maxstack')
+    def test_cast_raising(self):
+        py.test.skip('fixme')
 
     def test_switch_direct(self):
         py.test.skip('no promotion/flexswitch for now please :-)')
 
-    def test_switch_compile(self):
-        py.test.skip('no promotion/flexswitch for now please :-)')
-
     def test_large_switch_direct(self):
         py.test.skip('no promotion/flexswitch for now please :-)')
 
-    def test_large_switch_compile(self):
-        py.test.skip('no promotion/flexswitch for now please :-)')
-
     def test_defaultonly_switch(self):
         py.test.skip('no promotion/flexswitch for now please :-)')
 
     def test_read_frame_var_direct(self):
         py.test.skip('fixme: add support for frames')
 
-    def test_read_frame_var_compile(self):
-        py.test.skip('fixme: add support for frames')
-
     def test_write_frame_place_direct(self):
         py.test.skip('fixme: add support for frames')
 
-    def test_write_frame_place_compile(self):
-        py.test.skip('fixme: add support for frames')
-
     def test_write_lots_of_frame_places_direct(self):
         py.test.skip('fixme: add support for frames')
         
     def test_read_frame_place_direct(self):
         py.test.skip('fixme: add support for frames')
-        
-    def test_read_frame_place_compile(self):
-        py.test.skip('fixme: add support for frames')
-        
+
     def test_frame_vars_like_the_frontend_direct(self):
         py.test.skip('fixme: add support for frames')
 
@@ -79,15 +63,9 @@
     def test_ovfcheck_adder_direct(self):
         py.test.skip('fixme')
 
-    def test_ovfcheck_adder_compile(self):
-        py.test.skip('fixme')
-
     def test_ovfcheck1_direct(self):
         py.test.skip('fixme')
 
-    def test_ovfcheck1_compile(self):
-        py.test.skip('fixme')
-
     def test_ovfcheck2_direct(self):
         py.test.skip('fixme')
 
@@ -99,3 +77,37 @@
 
     def test_interior_access(self):
         py.test.skip('fixme')
+
+
+class TestRCliGenopCompile(AbstractRGenOpTestsCompile):
+    RGenOp = RCliGenOp
+    T = OOType
+
+    def getcompiled(self, fn, annotation, annotatorpolicy):
+        return compile_function(fn, annotation,
+                                annotatorpolicy=annotatorpolicy,
+                                nowrap=False)
+
+    def test_largedummy_compile(self):
+        py.test.skip('it works only if we increase .maxstack')
+
+    def test_switch_compile(self):
+        py.test.skip('no promotion/flexswitch for now please :-)')
+
+    def test_large_switch_compile(self):
+        py.test.skip('no promotion/flexswitch for now please :-)')
+
+    def test_read_frame_var_compile(self):
+        py.test.skip('fixme: add support for frames')
+
+    def test_write_frame_place_compile(self):
+        py.test.skip('fixme: add support for frames')
+
+    def test_read_frame_place_compile(self):
+        py.test.skip('fixme: add support for frames')
+        
+    def test_ovfcheck_adder_compile(self):
+        py.test.skip('fixme')
+
+    def test_ovfcheck1_compile(self):
+        py.test.skip('fixme')



More information about the Pypy-commit mailing list