Author: Antonio Cuni <[email protected]>
Branch: autoreds
Changeset: r58881:b967529b3359
Date: 2012-11-14 13:39 +0100
http://bitbucket.org/pypy/pypy/changeset/b967529b3359/

Log:    crash very early if we try to use JitDriver hooks with reds='auto',
        and detect it anyway in warmspot.py, giving a better assertion
        message

diff --git a/pypy/jit/metainterp/warmspot.py b/pypy/jit/metainterp/warmspot.py
--- a/pypy/jit/metainterp/warmspot.py
+++ b/pypy/jit/metainterp/warmspot.py
@@ -311,7 +311,6 @@
                     "reds='auto' is supported only for jit drivers which " 
                     "calls only jit_merge_point. Found a call to %s" % 
methname)
                 #
-                assert jitdriver.confirm_enter_jit is None
                 # compute the set of live variables before the jit_marker
                 alive_v = set(block.inputargs)
                 for op1 in block.operations:
@@ -593,7 +592,9 @@
         if func is None:
             return None
         #
-        assert not jitdriver_sd.jitdriver.autoreds
+        assert not jitdriver_sd.jitdriver.autoreds, (
+            "reds='auto' is not compatible with JitDriver hooks such as "
+            "{get,set}_jitcell_at, get_printable_location, confirm_enter_jit, 
etc.")
         extra_args_s = []
         if s_first_arg is not None:
             extra_args_s.append(s_first_arg)
diff --git a/pypy/rlib/jit.py b/pypy/rlib/jit.py
--- a/pypy/rlib/jit.py
+++ b/pypy/rlib/jit.py
@@ -457,7 +457,9 @@
             self.autoreds = True
             self.reds = []
             self.numreds = None # see warmspot.autodetect_jit_markers_redvars
-            assert confirm_enter_jit is None, 'cannot use automatic reds if 
confirm_enter_jit is given'
+            for hook in (get_jitcell_at, set_jitcell_at, 
get_printable_location,
+                         confirm_enter_jit):
+                assert hook is None, "reds='auto' is not compatible with 
JitDriver hooks"
         else:
             if reds is not None:
                 self.reds = reds
diff --git a/pypy/rlib/test/test_jit.py b/pypy/rlib/test/test_jit.py
--- a/pypy/rlib/test/test_jit.py
+++ b/pypy/rlib/test/test_jit.py
@@ -22,6 +22,7 @@
     assert driver.numreds is None
     py.test.raises(TypeError, "driver.can_enter_jit(foo='something')")
     #
+    py.test.raises(AssertionError, "JitDriver(greens=['foo'], reds='auto', 
get_printable_location='something')")
     py.test.raises(AssertionError, "JitDriver(greens=['foo'], reds='auto', 
confirm_enter_jit='something')")
 
 def test_jitdriver_numreds():
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to