[pypy-svn] r56287 - pypy/dist/pypy/translator/backendopt

arigo at codespeak.net arigo at codespeak.net
Fri Jul 4 10:14:12 CEST 2008


Author: arigo
Date: Fri Jul  4 10:14:11 2008
New Revision: 56287

Modified:
   pypy/dist/pypy/translator/backendopt/removeassert.py
Log:
Fix this code to use a more standard interface.
The previous code failed after the merging of
the less-meta-instances branch.


Modified: pypy/dist/pypy/translator/backendopt/removeassert.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/removeassert.py	(original)
+++ pypy/dist/pypy/translator/backendopt/removeassert.py	Fri Jul  4 10:14:11 2008
@@ -9,9 +9,9 @@
 
 def remove_asserts(translator, graphs):
     rtyper = translator.rtyper
+    excdata = rtyper.exceptiondata
     clsdef = translator.annotator.bookkeeper.getuniqueclassdef(AssertionError)
-    r_AssertionError = rclass.getclassrepr(rtyper, clsdef)
-    ll_AssertionError = r_AssertionError.convert_const(AssertionError)
+    ll_AssertionError = excdata.get_standard_ll_exc_instance(rtyper, clsdef)
     total_count = [0, 0]
 
     for graph in graphs:
@@ -23,8 +23,8 @@
             join_blocks(graph)
             for link in graph.iterlinks():
                 if (link.target is graph.exceptblock
-                    and isinstance(link.args[0], Constant)
-                    and link.args[0].value == ll_AssertionError):
+                    and isinstance(link.args[1], Constant)
+                    and link.args[1].value == ll_AssertionError):
                     if kill_assertion_link(graph, link):
                         count += 1
                         morework = True



More information about the Pypy-commit mailing list