[pypy-commit] pypy online-transforms: Do perform_normalizations() at the end of annotation

rlamy noreply at buildbot.pypy.org
Mon Nov 3 17:49:35 CET 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: online-transforms
Changeset: r74332:50956c5661c5
Date: 2014-11-03 16:00 +0000
http://bitbucket.org/pypy/pypy/changeset/50956c5661c5/

Log:	Do perform_normalizations() at the end of annotation

diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -12,6 +12,7 @@
 from rpython.annotator import model as annmodel, signature
 from rpython.annotator.argument import simple_args
 from rpython.annotator.bookkeeper import Bookkeeper
+from rpython.rtyper.normalizecalls import perform_normalizations
 
 import py
 log = py.log.Producer("annrpython")
@@ -313,6 +314,8 @@
                     graphs[graph] = True
         for graph in graphs:
             simplify.eliminate_empty_blocks(graph)
+        if block_subset is None:
+            perform_normalizations(self)
 
 
     #___ flowing annotations in blocks _____________________
diff --git a/rpython/rtyper/normalizecalls.py b/rpython/rtyper/normalizecalls.py
--- a/rpython/rtyper/normalizecalls.py
+++ b/rpython/rtyper/normalizecalls.py
@@ -378,6 +378,9 @@
 # ____________________________________________________________
 
 def perform_normalizations(annotator):
+    from rpython.rtyper.exceptiondata import standardexceptions
+    for cls in standardexceptions:
+        annotator.bookkeeper.getuniqueclassdef(cls)
     create_class_constructors(annotator)
     annotator.frozen += 1
     try:
diff --git a/rpython/rtyper/rtyper.py b/rpython/rtyper/rtyper.py
--- a/rpython/rtyper/rtyper.py
+++ b/rpython/rtyper/rtyper.py
@@ -26,7 +26,6 @@
     attachRuntimeTypeInfo, Primitive)
 from rpython.rtyper.rmodel import Repr, inputconst, BrokenReprTyperError
 from rpython.rtyper.typesystem import LowLevelTypeSystem, getfunctionptr
-from rpython.rtyper.normalizecalls import perform_normalizations
 from rpython.rtyper import rclass
 from rpython.rtyper.rclass import RootClassRepr
 from rpython.tool.pairtype import pair
@@ -167,22 +166,16 @@
     def specialize(self, dont_simplify_again=False):
         """Main entry point: specialize all annotated blocks of the program."""
         # specialize depends on annotator simplifications
-        assert dont_simplify_again in (False, True)  # safety check
         if not dont_simplify_again:
             self.annotator.simplify()
-
-        # first make sure that all functions called in a group have exactly
-        # the same signature, by hacking their flow graphs if needed
-        perform_normalizations(self.annotator)
         self.exceptiondata.finish(self)
 
         # new blocks can be created as a result of specialize_block(), so
         # we need to be careful about the loop here.
         self.already_seen = {}
         self.specialize_more_blocks()
-        if self.exceptiondata is not None:
-            self.exceptiondata.make_helpers(self)
-            self.specialize_more_blocks()   # for the helpers just made
+        self.exceptiondata.make_helpers(self)
+        self.specialize_more_blocks()   # for the helpers just made
 
     def getannmixlevel(self):
         if self.annmixlevel is not None:


More information about the pypy-commit mailing list