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

antocuni at codespeak.net antocuni at codespeak.net
Wed Oct 15 16:05:27 CEST 2008


Author: antocuni
Date: Wed Oct 15 16:05:26 2008
New Revision: 59104

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_gencli_interpreter.py
Log:
be sure that genvars inside flexswitch cases are always mapped to their local
variables, not to the vars of the containing method.



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	Wed Oct 15 16:05:26 2008
@@ -302,7 +302,7 @@
         # setup the correct inputargs
         args_manager = graph.graphinfo.args_manager
         args_manager.copy_to_inputargs(graph, self.args_gv)
-
+        
         # jumpto = flexswitch.execute(exitswitch, inputargs);
         # goto dispatch_jump;
         self.gv_flexswitch.load(graph)

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	Wed Oct 15 16:05:26 2008
@@ -125,10 +125,18 @@
     def getkind(self):
         return type2class(self.getCliType())
 
-    def load(self, builder):
+    def load(self, meth):
+        gv = meth.map_genvar(self)
+        gv._do_load(meth)
+
+    def store(self, meth):
+        gv = meth.map_genvar(self)
+        gv._do_store(meth)
+
+    def _do_load(self, meth):
         raise NotImplementedError
 
-    def store(self, builder):
+    def _do_store(self, meth):
         raise NotImplementedError
 
 class GenArgVar(GenVar):
@@ -139,7 +147,7 @@
     def getCliType(self):
         return self.cliType
 
-    def load(self, meth):
+    def _do_load(self, meth):
         if self.index == 0:
             meth.il.Emit(OpCodes.Ldarg_0)
         elif self.index == 1:
@@ -151,23 +159,23 @@
         else:
             meth.il.Emit(OpCodes.Ldarg, self.index)
 
-    def store(self, meth):
+    def _do_store(self, meth):
         meth.il.Emit(OpCodes.Starg, self.index)
 
     def __repr__(self):
         return "GenArgVar(%d)" % self.index
 
 class GenLocalVar(GenVar):
-    def __init__(self, v):
+    def __init__(self, meth, v):
         self.v = v
 
     def getCliType(self):
         return self.v.get_LocalType()
 
-    def load(self, meth):
+    def _do_load(self, meth):
         meth.il.Emit(OpCodes.Ldloc, self.v)
 
-    def store(self, meth):
+    def _do_store(self, meth):
         meth.il.Emit(OpCodes.Stloc, self.v)
 
 
@@ -484,7 +492,7 @@
         return result
 
     def newlocalvar(self, clitype):
-        return GenLocalVar(self.il.DeclareLocal(clitype))
+        return GenLocalVar(self, self.il.DeclareLocal(clitype))
 
     def map_genvar(self, gv_var):
         return gv_var
@@ -683,10 +691,6 @@
     
     @specialize.arg(1)
     def genop2(self, opname, gv_arg1, gv_arg2):
-        # XXX: also other ops
-        gv_arg1 = self.meth.map_genvar(gv_arg1)
-        gv_arg2 = self.meth.map_genvar(gv_arg2)
-        
         opcls = ops.getopclass2(opname)
         op = opcls(self.meth, gv_arg1, gv_arg2)
         self.appendop(op)
@@ -777,6 +781,7 @@
         gv_flexswitch = flexswitch.gv_flexswitch
         default_branch = self.meth.newbranch()
         label = default_branch.enter_next_block(args_gv)
+
         flexswitch.llflexswitch.set_default_blockid(label.blockid)
         op = ops.DoFlexSwitch(self.meth, gv_flexswitch,
                               gv_exitswitch, args_gv)

Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_interpreter.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_interpreter.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_interpreter.py	Wed Oct 15 16:05:26 2008
@@ -91,9 +91,6 @@
     def test_known_nonzero(self):
         py.test.skip("something wrong with promotion")
 
-    def test_debug_assert_ptr_nonzero(self):
-        py.test.skip("something wrong with promotion")
-
     def test_indirect_red_call_with_exc(self):
         py.test.skip("replay: NotImplementedError")
 



More information about the Pypy-commit mailing list