Commits

Antonio Cuni  committed 545559c

forbid autoreds when using can_enter_jit, and explain why

  • Participants
  • Parent commits 60cf0cb
  • Branches autoreds

Comments (0)

Files changed (2)

File pypy/jit/metainterp/test/test_ajit.py

             # by chance
             a = b = c = d = n
             while n > 0:
-                myjitdriver.can_enter_jit(m=m)
                 myjitdriver.jit_merge_point(m=m)
                 n -= 1
                 a += 1 # dummy unused red
             f1 = f2 = f3 = f4 = float(n)
             r1 = r2 = r3 = r4 = MyObj(n)
             while n > 0:
-                myjitdriver.can_enter_jit(m=m)
                 myjitdriver.jit_merge_point(m=m)
                 n -= 1
                 i1 += 1 # dummy unused red
             res = 0
             while n > 0:
                 n -= 1
-                myjitdriver.can_enter_jit(m=m)
                 myjitdriver.jit_merge_point(m=m)
                 res += m*2
             return res

File pypy/jit/metainterp/warmspot.py

         # add all the variables across the links to the reds.
         for block, op in graph.iterblockops():
             if op.opname == 'jit_marker':
+                # if we want to support also can_enter_jit, we should find a
+                # way to detect a consistent set of red vars to pass *both* to
+                # jit_merge_point and can_enter_jit. The current simple
+                # solution doesn't work because can_enter_jit might be in
+                # another block, so the set of alive_v will be different.
+                methname = op.args[0].value
+                assert methname == 'jit_merge_point', (
+                    "reds='auto' is supported only for jit drivers which " 
+                    "calls only jit_merge_point. Found a call to %s" % methname)
+                #
                 jitdriver = op.args[1].value
                 if not jitdriver.autoreds:
                     continue