1. Pypy
  2. Untitled project
  3. pypy


Antonio Cuni  committed b967529

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

  • Participants
  • Parent commits ea85bb6
  • Branches autoreds

Comments (0)

Files changed (3)

File pypy/jit/metainterp/warmspot.py

View file
                     "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:
         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:

File pypy/rlib/jit.py

View file
             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"
             if reds is not None:
                 self.reds = reds

File pypy/rlib/test/test_jit.py

View file
     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():