Author: Armin Rigo <[email protected]>
Branch: conditional_call_value_4
Changeset: r88586:f4289ee8dfa3
Date: 2016-11-23 18:38 +0100
http://bitbucket.org/pypy/pypy/changeset/f4289ee8dfa3/

Log:    Use conditional_call_elidable instead of call_shortcut here

diff --git a/rpython/rtyper/lltypesystem/rstr.py 
b/rpython/rtyper/lltypesystem/rstr.py
--- a/rpython/rtyper/lltypesystem/rstr.py
+++ b/rpython/rtyper/lltypesystem/rstr.py
@@ -371,23 +371,21 @@
     @staticmethod
     def ll_strhash(s):
         if s:
-            return LLHelpers._ll_strhash(s)
+            return jit.conditional_call_elidable(s.hash,
+                                                 LLHelpers._ll_strhash, s)
         else:
             return 0
 
     @staticmethod
-    @jit.elidable
-    @jit.call_shortcut
     def _ll_strhash(s):
         # unlike CPython, there is no reason to avoid to return -1
         # but our malloc initializes the memory to zero, so we use zero as the
-        # special non-computed-yet value.
-        x = s.hash
+        # special non-computed-yet value.  Also, jit.conditional_call_elidable
+        # always checks for zero, for now.
+        x = _hash_string(s.chars)
         if x == 0:
-            x = _hash_string(s.chars)
-            if x == 0:
-                x = 29872897
-            s.hash = x
+            x = 29872897
+        s.hash = x
         return x
 
     @staticmethod
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to