[pypy-commit] pypy default: avoid creating another JIT path

gutworth noreply at buildbot.pypy.org
Thu Mar 29 14:51:47 CEST 2012


Author: Benjamin Peterson <benjamin at python.org>
Branch: 
Changeset: r54062:d6bef3538524
Date: 2012-03-29 08:51 -0400
http://bitbucket.org/pypy/pypy/changeset/d6bef3538524/

Log:	avoid creating another JIT path

diff --git a/pypy/rpython/lltypesystem/rstr.py b/pypy/rpython/lltypesystem/rstr.py
--- a/pypy/rpython/lltypesystem/rstr.py
+++ b/pypy/rpython/lltypesystem/rstr.py
@@ -765,9 +765,10 @@
     def _ll_stringslice(s1, start, stop):
         lgt = stop - start
         assert start >= 0
-        # If start >= stop, return a empty string. This can happen if the start
-        # is greater than the length of the string.
-        if lgt <= 0:
+        # If start > stop, return a empty string. This can happen if the start
+        # is greater than the length of the string. Use < instead <= to avoid
+        # creating another path for the JIT.
+        if lgt < 0:
             return s1.empty()
         newstr = s1.malloc(lgt)
         s1.copy_contents(s1, newstr, start, 0, lgt)


More information about the pypy-commit mailing list