[pypy-commit] pypy py3.5: Use conditional_call_value
arigo
pypy.commits at gmail.com
Thu Nov 24 10:47:52 EST 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r88640:85f1c9ac66f6
Date: 2016-11-24 15:09 +0100
http://bitbucket.org/pypy/pypy/changeset/85f1c9ac66f6/
Log: Use conditional_call_value
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
@@ -79,14 +79,9 @@
def identifier_w(self, space):
try:
- if jit.isconstant(self._value):
- # constantly encode that unicode string; don't try
- # to access the cache _utf8 at all
- identifier = self._value.encode('utf-8')
- else:
- # call the elidable function, with a jit.call_shortcut in case
- # self._utf8 is already computed
- identifier = g_identifier_w(self, space)
+ identifier = jit.conditional_call_elidable(
+ self._utf8, g_encode_utf8, self._value)
+ self._utf8 = identifier
except UnicodeEncodeError:
# bah, this is just to get an official app-level
# UnicodeEncodeError
@@ -1278,15 +1273,9 @@
allow_surrogates=allow_surrogates)
@jit.elidable
- at jit.call_shortcut
-def g_identifier_w(self, space):
- """This is a global function because of @jit.call_shortcut"""
- identifier = self._utf8
- if identifier is not None:
- return identifier
- identifier = self._value.encode('utf-8')
- self._utf8 = identifier
- return identifier
+def g_encode_utf8(value):
+ """This is a global function because of jit.conditional_call_value"""
+ return value.encode('utf-8')
_repr_function, _ = make_unicode_escape_function(
pass_printable=True, unicode_output=True, quotes=True, prefix='')
More information about the pypy-commit
mailing list