Commits

Armin Rigo committed 8be5fec

Test and fix for an issue reported by krono on irc

  • Participants
  • Parent commits 3daccc9

Comments (0)

Files changed (2)

File rpython/rlib/jit.py

     else:
         if condition:
             function(*args)
+conditional_call._annenforceargs_ = [bool, None, None]
 
 class ConditionalCallEntry(ExtRegistryEntry):
     _about_ = _jit_conditional_call

File rpython/rlib/test/test_jit.py

 from rpython.conftest import option
 from rpython.annotator.model import UnionError
 from rpython.rlib.jit import (hint, we_are_jitted, JitDriver, elidable_promote,
-    JitHintError, oopspec, isconstant)
+    JitHintError, oopspec, isconstant, conditional_call)
 from rpython.rlib.rarithmetic import r_uint
 from rpython.rtyper.test.tool import BaseRtypingTest
 from rpython.rtyper.lltypesystem import lltype
+from rpython.translator.translator import TranslationContext
+from rpython.rtyper.annlowlevel import MixLevelHelperAnnotator
+from rpython.annotator import model as annmodel
 
 
 def test_oopspec():
         # this used to fail on 64-bit, because r_uint == r_ulonglong
         myjitdriver = JitDriver(greens=['i1'], reds=[])
         myjitdriver.jit_merge_point(i1=r_uint(42))
+
+    def test_conditional_call(self):
+        def g():
+            pass
+        def f(n):
+            conditional_call(n >= 0, g)
+        def later(m):
+            conditional_call(m, g)
+        t = TranslationContext()
+        t.buildannotator().build_types(f, [int])
+        t.buildrtyper().specialize()
+        mix = MixLevelHelperAnnotator(t.rtyper)
+        mix.getgraph(later, [annmodel.s_Bool], annmodel.s_None)
+        mix.finish()