Author: Brian Kearns <[email protected]>
Branch: 
Changeset: r71267:c1705fbd5f73
Date: 2014-05-04 16:32 -0400
http://bitbucket.org/pypy/pypy/changeset/c1705fbd5f73/

Log:    allow jit to look inside buf.getslice if size is constant

diff --git a/rpython/rlib/buffer.py b/rpython/rlib/buffer.py
--- a/rpython/rlib/buffer.py
+++ b/rpython/rlib/buffer.py
@@ -1,7 +1,7 @@
 """
 Buffer protocol support.
 """
-from rpython.rlib.objectmodel import import_from_mixin
+from rpython.rlib import jit
 
 
 class Buffer(object):
@@ -21,6 +21,7 @@
         "Returns the index'th character in the buffer."
         raise NotImplementedError   # Must be overriden.  No bounds checks.
 
+    @jit.look_inside_iff(lambda self, start, stop, step, size: 
jit.isconstant(size))
     def getslice(self, start, stop, step, size):
         # May be overridden.  No bounds checks.
         return ''.join([self.getitem(i) for i in range(start, stop, step)])
diff --git a/rpython/rlib/rstruct/formatiterator.py 
b/rpython/rlib/rstruct/formatiterator.py
--- a/rpython/rlib/rstruct/formatiterator.py
+++ b/rpython/rlib/rstruct/formatiterator.py
@@ -82,6 +82,7 @@
     def finished(self):
         pass
 
+
 class CalcSizeFormatIterator(FormatIterator):
     totalsize = 0
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to