Author: Armin Rigo <[email protected]>
Branch: unicode-utf8
Changeset: r95917:fb5c9143c946
Date: 2019-02-09 13:50 +0100
http://bitbucket.org/pypy/pypy/changeset/fb5c9143c946/
Log: Add a conditional_call_elidable here
diff --git a/pypy/objspace/std/unicodeobject.py
b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -847,13 +847,12 @@
descr_rmul = descr_mul
def _get_index_storage(self):
- # XXX write the correct jit.elidable
- if self._index_storage == rutf8.null_storage():
- storage = rutf8.create_utf8_index_storage(self._utf8, self._length)
- else:
- storage = self._index_storage
- if not jit.isconstant(self):
- self._index_storage = storage
+ return jit.conditional_call_elidable(self._index_storage,
+ W_UnicodeObject._compute_index_storage, self)
+
+ def _compute_index_storage(self):
+ storage = rutf8.create_utf8_index_storage(self._utf8, self._length)
+ self._index_storage = storage
return storage
def _getitem_result(self, space, index):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit