[pypy-svn] r57816 - in pypy/branch/oo-jit/pypy: jit/codegen/cli jit/codegen/cli/test translator/cli

antocuni at codespeak.net antocuni at codespeak.net
Thu Sep 4 19:00:25 CEST 2008


Author: antocuni
Date: Thu Sep  4 19:00:20 2008
New Revision: 57816

Modified:
   pypy/branch/oo-jit/pypy/jit/codegen/cli/methodfactory.py
   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
   pypy/branch/oo-jit/pypy/translator/cli/opcodes.py
Log:
implement ooisnull and oononnull in the CLI JIT backend; this allows most of
test_known_nonzero to pass, but the test still fails because promotion is not
supported yet



Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/methodfactory.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/methodfactory.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/methodfactory.py	Thu Sep  4 19:00:20 2008
@@ -70,6 +70,7 @@
     def create_delegate(self, delegatetype, consts):
         t = self.typeBuilder.CreateType()
         methinfo = t.GetMethod("invoke")
+        #assemblyData.auto_save_assembly.Save()
         return System.Delegate.CreateDelegate(delegatetype,
                                               consts,
                                               methinfo)

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 Sep  4 19:00:20 2008
@@ -171,7 +171,8 @@
         for gv_arg in self.args_gv:
             gv_arg.load(self.meth)
         self.meth.il.EmitCall(OpCodes.Callvirt, meth_invoke, None)
-        self.storeResult()
+        if self.restype():
+            self.storeResult()
 
 
 class GetField(Operation):
@@ -299,6 +300,8 @@
     return '_'.join(parts)
 
 def is_comparison(opname):
+    if opname in ('ooisnull', 'oononnull'):
+        return True
     suffixes = '_lt _le _eq _ne _gt _ge'.split()
     for suffix in suffixes:
         if opname.endswith(suffix):

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 Sep  4 19:00:20 2008
@@ -679,10 +679,16 @@
         return op.gv_res()
 
     def genop_oononnull(self, gv_obj):
-        raise NotImplementedError
+        OP = ops.getopclass1('oononnull')
+        op = OP(self.meth, gv_obj)
+        self.appendop(op)
+        return op.gv_res()
 
     def genop_ooisnull(self, gv_obj):
-        raise NotImplementedError
+        OP = ops.getopclass1('ooisnull')
+        op = OP(self.meth, gv_obj)
+        self.appendop(op)
+        return op.gv_res()
 
     def genop_new(self, alloctoken):
         op = ops.New(self.meth, alloctoken)

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	Thu Sep  4 19:00:20 2008
@@ -88,7 +88,9 @@
 
     check_count_depth = False # see test_self_referential_structures
     
-    test_known_nonzero = skip
+    def test_known_nonzero(self):
+        py.test.skip("Involves promotion")
+
     test_debug_assert_ptr_nonzero = skip
     test_indirect_red_call = skip
     test_indirect_red_call_with_exc = skip

Modified: pypy/branch/oo-jit/pypy/translator/cli/opcodes.py
==============================================================================
--- pypy/branch/oo-jit/pypy/translator/cli/opcodes.py	(original)
+++ pypy/branch/oo-jit/pypy/translator/cli/opcodes.py	Thu Sep  4 19:00:20 2008
@@ -47,9 +47,6 @@
     'cli_eventhandler':         [EventHandler],
     'cli_getstaticfield':       [GetStaticField],
     'cli_setstaticfield':       [SetStaticField],
-    'oois':                     'ceq',
-    'ooisnull':                 [PushAllArgs, 'ldnull', 'ceq'],
-    'oononnull':                [PushAllArgs, 'ldnull', 'ceq']+Not,
     'instanceof':               [CastTo, 'ldnull', 'cgt.un'],
     'subclassof':               [PushAllArgs, 'call bool [pypylib]pypy.runtime.Utils::SubclassOf(class [mscorlib]System.Type, class[mscorlib]System.Type)'],
     'ooidentityhash':           [PushAllArgs, 'callvirt instance int32 object::GetHashCode()'],
@@ -109,6 +106,10 @@
     'ullong_is_true':            [PushAllArgs, 'ldc.i8 0', 'cgt.un'],
     'ullong_invert':             'not',
 
+    'oois':                     'ceq',
+    'ooisnull':                 [PushAllArgs, 'nop', 'nop', 'nop', 'ldnull', 'ceq'],
+    'oononnull':                [PushAllArgs, 'nop', 'nop', 'nop', 'nop', 'ldnull', 'ceq']+Not,
+
     # when casting from bool we want that every truth value is casted
     # to 1: we can't simply DoNothing, because the CLI stack could
     # contains a truth value not equal to 1, so we should use the !=0



More information about the Pypy-commit mailing list