[pypy-commit] pypy default: A hard-to-test case: an assert which may actually fail

arigo noreply at buildbot.pypy.org
Fri Feb 8 19:39:43 CET 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r60990:bfb3a4f5c8ad
Date: 2013-02-08 18:37 +0100
http://bitbucket.org/pypy/pypy/changeset/bfb3a4f5c8ad/

Log:	A hard-to-test case: an assert which may actually fail

diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -2108,8 +2108,11 @@
         num_green_args = self.jitdriver_sd.num_green_args
         greenkey = original_boxes[:num_green_args]
         if not self.partial_trace:
-            assert self.get_procedure_token(greenkey) is None or \
-                   self.get_procedure_token(greenkey).target_tokens is None
+            ptoken = self.get_procedure_token(greenkey)
+            if ptoken is not None and ptoken.target_tokens is not None:
+                # XXX this path not tested, but shown to occur on pypy-c :-(
+                self.staticdata.log('cancelled: we already have a token now')
+                raise SwitchToBlackhole(Counters.ABORT_BAD_LOOP)
         if self.partial_trace:
             target_token = compile.compile_retrace(self, greenkey, start,
                                                    original_boxes[num_green_args:],


More information about the pypy-commit mailing list