[pypy-commit] pypy default: hg backout 75a00a3b038f: the jit explodes when seeing and optimizing

arigo noreply at buildbot.pypy.org
Sat Sep 5 14:39:03 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r79463:9291449ec424
Date: 2015-09-05 14:39 +0200
http://bitbucket.org/pypy/pypy/changeset/9291449ec424/

Log:	hg backout 75a00a3b038f: the jit explodes when seeing and optimizing
	getfield_gc(p, 'hash')

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
@@ -358,21 +358,20 @@
         return b
 
     @staticmethod
-    def _compute_hash(s):
+    @jit.elidable
+    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 = _hash_string(s.chars)
-        if x == 0:
-            x = 29872897
-        s.hash = x
-
-    @staticmethod
-    def ll_strhash(s):
         if not s:
             return 0
-        jit.conditional_call(s.hash == 0, LLHelpers._compute_hash, s)
-        return s.hash
+        x = s.hash
+        if x == 0:
+            x = _hash_string(s.chars)
+            if x == 0:
+                x = 29872897
+            s.hash = x
+        return x
 
     @staticmethod
     def ll_length(s):


More information about the pypy-commit mailing list