Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: regalloc-playground
Changeset: r92350:58247cb00737
Date: 2017-09-07 15:01 +0200
http://bitbucket.org/pypy/pypy/changeset/58247cb00737/

Log:    test and fix for corner case

diff --git a/rpython/jit/backend/llsupport/regalloc.py 
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -841,6 +841,8 @@
         l = self.real_usages
         low = 0
         high = len(l)
+        if position >= l[-1]:
+            return -1
         while low < high:
             mid = low + (high - low) // 2 # no overflow ;-)
             if position < l[mid]:
diff --git a/rpython/jit/backend/llsupport/test/test_regalloc.py 
b/rpython/jit/backend/llsupport/test/test_regalloc.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc.py
@@ -140,6 +140,8 @@
         assert next in lt.real_usages
         assert next > i
         assert lt.real_usages[lt.real_usages.index(next) - 1] <= i
+    assert lt.next_real_usage(100) == -1
+    assert lt.next_real_usage(101) == -1
 
 def test_fixed_position():
     b0, b1, b2 = newboxes(0, 0, 0)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to