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

antocuni at codespeak.net antocuni at codespeak.net
Thu Jul 24 11:39:56 CEST 2008


Author: antocuni
Date: Thu Jul 24 11:39:55 2008
New Revision: 56765

Modified:
   pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py
   pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py
   pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_rgenop.py
Log:
some rpython fixes, and test_switch_compile also passes



Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py	Thu Jul 24 11:39:55 2008
@@ -227,7 +227,7 @@
         graph = self.meth
         il = graph.il
         # get MethodInfo for LowLevelFlexSwitch.execute
-        clitype = self.gv_flexswitch.flexswitch.GetType()
+        clitype = self.gv_flexswitch.llflexswitch.GetType()
         meth_execute = clitype.GetMethod('execute')
 
         # setup the correct inputargs

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	Thu Jul 24 11:39:55 2008
@@ -14,6 +14,7 @@
 System = CLR.System
 DelegateHolder = CLR.pypy.runtime.DelegateHolder
 LowLevelFlexSwitch = CLR.pypy.runtime.LowLevelFlexSwitch
+FlexSwitchCase = CLR.pypy.runtime.FlexSwitchCase
 InputArgs = CLR.pypy.runtime.InputArgs
 OpCodes = System.Reflection.Emit.OpCodes
 
@@ -26,7 +27,7 @@
 cChar = classof(System.Char)
 cInputArgs = classof(InputArgs)
 cUtils = classof(CLR.pypy.runtime.Utils)
-cFlexSwitchCase = classof(CLR.pypy.runtime.FlexSwitchCase)
+cFlexSwitchCase = classof(FlexSwitchCase)
 
 class SigToken:
     def __init__(self, args, res, funcclass):
@@ -198,9 +199,7 @@
         self.delegatetype = delegatetype
 
     def getobj(self):
-        # XXX: should the conversion be done automatically?
-        #return ootype.ooupcast(OBJECT, self.holder)
-        return self.holder
+        return dotnet.cliupcast(self.holder, System.Object)
 
     def load(self, meth):
         holdertype = box(self.holder).GetType()
@@ -222,15 +221,15 @@
 
 class FlexSwitchConst(BaseConst):
 
-    def __init__(self, flexswitch):
-        self.flexswitch = flexswitch
+    def __init__(self, llflexswitch):
+        self.llflexswitch = llflexswitch
 
     def getobj(self):
-        return self.flexswitch
+        return dotnet.cliupcast(self.llflexswitch, System.Object)
 
     def load(self, meth):
         index = self._get_index(meth)
-        self._load_from_array(meth, index, self.flexswitch.GetType())
+        self._load_from_array(meth, index, self.llflexswitch.GetType())
 
 
 class Label(GenLabel):
@@ -534,7 +533,8 @@
     def emit_code(self):
         MethodGenerator.emit_code(self)
         func = self.gv_entrypoint.holder.GetFunc()
-        self.parent_flexswitch.llflexswitch.add_case(self.value, func)
+        func2 = clidowncast(func, FlexSwitchCase)
+        self.parent_flexswitch.llflexswitch.add_case(self.value, func2)
 
     def emit_preamble(self):
         from pypy.jit.codegen.cli.operation import InputArgsManager

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	Thu Jul 24 11:39:55 2008
@@ -125,9 +125,6 @@
     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 :-)')
 



More information about the Pypy-commit mailing list