[pypy-svn] r68328 - pypy/branch/gc-hash/pypy/rlib

arigo at codespeak.net arigo at codespeak.net
Sun Oct 11 23:55:40 CEST 2009


Author: arigo
Date: Sun Oct 11 23:55:39 2009
New Revision: 68328

Modified:
   pypy/branch/gc-hash/pypy/rlib/rweakrefimpl.py
Log:
Remove a usage of gethash().


Modified: pypy/branch/gc-hash/pypy/rlib/rweakrefimpl.py
==============================================================================
--- pypy/branch/gc-hash/pypy/rlib/rweakrefimpl.py	(original)
+++ pypy/branch/gc-hash/pypy/rlib/rweakrefimpl.py	Sun Oct 11 23:55:39 2009
@@ -91,6 +91,8 @@
                                     adtmeths=entrymeths,
                                     hints={'weakarray': 'value'})
 
+ll_strhash = rstr.LLHelpers.ll_strhash
+
 @jit.dont_look_inside
 def ll_new_weakdict():
     d = lltype.malloc(WEAKDICT)
@@ -101,7 +103,8 @@
 
 @jit.dont_look_inside
 def ll_get(d, llkey):
-    i = rdict.ll_dict_lookup(d, llkey, llkey.gethash())
+    hash = ll_strhash(llkey)
+    i = rdict.ll_dict_lookup(d, llkey, hash)
     #llop.debug_print(lltype.Void, i, 'get')
     valueref = d.entries[i].value
     if valueref:
@@ -118,8 +121,9 @@
 
 @jit.dont_look_inside
 def ll_set_nonnull(d, llkey, llvalue):
+    hash = ll_strhash(llkey)
     valueref = weakref_create(llvalue)    # GC effects here, before the rest
-    i = rdict.ll_dict_lookup(d, llkey, llkey.gethash())
+    i = rdict.ll_dict_lookup(d, llkey, hash)
     everused = d.entries.everused(i)
     d.entries[i].key = llkey
     d.entries[i].value = valueref
@@ -132,7 +136,8 @@
 
 @jit.dont_look_inside
 def ll_set_null(d, llkey):
-    i = rdict.ll_dict_lookup(d, llkey, llkey.gethash())
+    hash = ll_strhash(llkey)
+    i = rdict.ll_dict_lookup(d, llkey, hash)
     if d.entries.everused(i):
         # If the entry was ever used, clean up its key and value.
         # We don't store a NULL value, but a dead weakref, because



More information about the Pypy-commit mailing list