Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r89704:142f2ad47039
Date: 2017-01-23 11:42 +0100
http://bitbucket.org/pypy/pypy/changeset/142f2ad47039/

Log:    Fix: allow get_unique_id=... on a jitdriver whose 'is_recursive'
        status will be set to True later (when it is the only jitdriver in
        the program).

diff --git a/rpython/jit/metainterp/warmspot.py 
b/rpython/jit/metainterp/warmspot.py
--- a/rpython/jit/metainterp/warmspot.py
+++ b/rpython/jit/metainterp/warmspot.py
@@ -52,12 +52,19 @@
         jd.jitdriver.is_recursive = True
     else:
         count_recursive = 0
+        invalid = 0
         for jd in warmrunnerdesc.jitdrivers_sd:
             count_recursive += jd.jitdriver.is_recursive
+            invalid += (jd.jitdriver.has_unique_id and
+                           not jd.jitdriver.is_recursive)
         if count_recursive == 0:
             raise Exception("if you have more than one jitdriver, at least"
                 " one of them has to be marked with is_recursive=True,"
                 " none found")
+        if invalid > 0:
+            raise Exception("found %d jitdriver(s) with 'get_unique_id=...' "
+                            "specified but without 'is_recursive=True'" %
+                            (invalid,))
     for jd in warmrunnerdesc.jitdrivers_sd:
         jd.warmstate.set_param_inlining(inline)
         jd.warmstate.set_param_vec(vec)
diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py
--- a/rpython/rlib/jit.py
+++ b/rpython/rlib/jit.py
@@ -637,8 +637,6 @@
             raise AttributeError("no 'greens' or 'reds' supplied")
         if virtualizables is not None:
             self.virtualizables = virtualizables
-        if get_unique_id is not None:
-            assert is_recursive, "get_unique_id and is_recursive must be 
specified at the same time"
         for v in self.virtualizables:
             assert v in self.reds
         # if reds are automatic, they won't be passed to jit_merge_point, so
@@ -653,6 +651,7 @@
         assert set_jitcell_at is None, "set_jitcell_at no longer used"
         self.get_printable_location = get_printable_location
         self.get_location = get_location
+        self.has_unique_id = (get_unique_id is not None)
         if get_unique_id is None:
             get_unique_id = lambda *args: 0
         self.get_unique_id = get_unique_id
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to