[pypy-svn] r22951 - in pypy/dist/pypy/translator: backendopt c/test

ericvrp at codespeak.net ericvrp at codespeak.net
Thu Feb 2 13:33:52 CET 2006


Author: ericvrp
Date: Thu Feb  2 13:33:51 2006
New Revision: 22951

Modified:
   pypy/dist/pypy/translator/backendopt/raisingop2direct_call.py
   pypy/dist/pypy/translator/c/test/test_backendoptimized.py
   pypy/dist/pypy/translator/c/test/test_stackless.py
   pypy/dist/pypy/translator/c/test/test_typed.py
Log:
Allow operations to be not implemented in RPython.
Fall back on the src/int.h implementation in that case.



Modified: pypy/dist/pypy/translator/backendopt/raisingop2direct_call.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/raisingop2direct_call.py	(original)
+++ pypy/dist/pypy/translator/backendopt/raisingop2direct_call.py	Thu Feb  2 13:33:51 2006
@@ -19,13 +19,16 @@
         if not s.endswith('_zer') and not s.endswith('_ovf') and not s.endswith('_val'): #not s in special_operations:
            return False
         return True
-    
+
+    log('starting')
     seen = {}
     for op in all_operations(translator):
         if not is_raisingop(op):
             continue
         func = getattr(pypy.rpython.raisingops.raisingops, op.opname, None)
-        assert func, "exception raising operation %s was not found" % op.opname
+        if not func:
+            log.warning("%s not found" % op.opname)
+            continue
         if op.opname not in seen:
             seen[op.opname] = 0
         seen[op.opname] += 1
@@ -34,7 +37,7 @@
 
     #statistics...
     for k, v in seen.iteritems():
-        log.info("%dx %s" % (v, k))
+        log("%dx %s" % (v, k))
 
     #specialize newly annotated functions
     if seen != {}:
@@ -49,6 +52,8 @@
 
     #selfdiagnostics... assert that there are no more raisingops
     for op in all_operations(translator):
-        assert not is_raisingop(op)
+        if is_raisingop(op):
+            log.warning("%s not transformed" % op.opname)
 
     #translator.view()
+    log('finished')

Modified: pypy/dist/pypy/translator/c/test/test_backendoptimized.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_backendoptimized.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_backendoptimized.py	Thu Feb  2 13:33:51 2006
@@ -9,7 +9,7 @@
     def process(self, t):
         _TestTypedTestCase.process(self, t)
         self.t = t
-        backend_optimizations(t, raisingop2direct_call_all=False, merge_if_blocks_to_switch=False)
+        backend_optimizations(t, merge_if_blocks_to_switch=False)
 
     def test_remove_same_as(self):
         def f(n=bool):

Modified: pypy/dist/pypy/translator/c/test/test_stackless.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_stackless.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_stackless.py	Thu Feb  2 13:33:51 2006
@@ -4,7 +4,6 @@
 from pypy.annotation.listdef import ListDef
 from pypy.rpython.rstack import stack_unwind, stack_frames_depth, stack_too_big
 from pypy.rpython.rstack import yield_current_frame_to_caller
-from pypy.translator.backendopt.raisingop2direct_call import raisingop2direct_call
 import os
 
 def wrap_stackless_function(fn):
@@ -17,7 +16,6 @@
     t = TranslationContext()
     t.buildannotator().build_types(entry_point, [s_list_of_strings])
     t.buildrtyper().specialize()
-    raisingop2direct_call(t)
 
     cbuilder = CStandaloneBuilder(t, entry_point)
     cbuilder.stackless = True

Modified: pypy/dist/pypy/translator/c/test/test_typed.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_typed.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_typed.py	Thu Feb  2 13:33:51 2006
@@ -4,8 +4,6 @@
 from py.test import raises
 from pypy.translator.test import snippet 
 from pypy.rpython.rarithmetic import r_uint, r_longlong, intmask
-from pypy.translator.backendopt.raisingop2direct_call import raisingop2direct_call
-
 from pypy.translator.c.test.test_annotated import TestAnnotatedTestCase as _TestAnnotatedTestCase
 
 
@@ -223,7 +221,6 @@
         raises(OverflowError, fn, n, 5)
 
     def test_int_mod_ovf_zer(self):
-        #py.test.skip("XXX does not annotate anymore after raisingops2direct_call transformation")
         fn = self.getcompiled(snippet.mod_func)
         raises(OverflowError, fn, -1)
         raises(ZeroDivisionError, fn, 0)



More information about the Pypy-commit mailing list