[pypy-commit] pypy default: add a (probably not too costly) sanity check to make sure that the traces the

cfbolz noreply at buildbot.pypy.org
Tue Nov 22 17:05:58 CET 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: 
Changeset: r49667:3b335c5116cf
Date: 2011-11-22 17:05 +0100
http://bitbucket.org/pypy/pypy/changeset/3b335c5116cf/

Log:	add a (probably not too costly) sanity check to make sure that the
	traces the optimizer produces have the SSA property, ie every
	variable is assigned only once.

diff --git a/pypy/jit/metainterp/optimizeopt/optimizer.py b/pypy/jit/metainterp/optimizeopt/optimizer.py
--- a/pypy/jit/metainterp/optimizeopt/optimizer.py
+++ b/pypy/jit/metainterp/optimizeopt/optimizer.py
@@ -348,6 +348,7 @@
         self.opaque_pointers = {}
         self.replaces_guard = {}
         self._newoperations = []
+        self.seen_results = {}
         self.optimizer = self
         self.optpure = None
         self.optearlyforce = None
@@ -542,6 +543,10 @@
                 op = self.store_final_boxes_in_guard(op)
         elif op.can_raise():
             self.exception_might_have_happened = True
+        if op.result:
+            if op.result in self.seen_results:
+                raise ValueError, "invalid optimization"
+            self.seen_results[op.result] = None
         self._newoperations.append(op)
 
     def replace_op(self, old_op, new_op):


More information about the pypy-commit mailing list