[pypy-commit] pypy default: Backed out changeset 9d796d6049d6, re-enabling 39a9093e603d
arigo
noreply at buildbot.pypy.org
Tue Jul 26 14:33:25 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r46002:96e2837af4ec
Date: 2011-07-26 13:52 +0200
http://bitbucket.org/pypy/pypy/changeset/96e2837af4ec/
Log: Backed out changeset 9d796d6049d6, re-enabling 39a9093e603d (which I
hope to fix in the next checkin).
diff --git a/pypy/rpython/memory/gc/minimark.py b/pypy/rpython/memory/gc/minimark.py
--- a/pypy/rpython/memory/gc/minimark.py
+++ b/pypy/rpython/memory/gc/minimark.py
@@ -49,6 +49,7 @@
from pypy.rpython.lltypesystem.llmemory import raw_malloc_usage
from pypy.rpython.memory.gc.base import GCBase, MovingGCBase
from pypy.rpython.memory.gc import minimarkpage, env
+from pypy.rpython.memory.support import mangle_hash
from pypy.rlib.rarithmetic import ovfcheck, LONG_BIT, intmask, r_uint
from pypy.rlib.rarithmetic import LONG_BIT_SHIFT
from pypy.rlib.debug import ll_assert, debug_print, debug_start, debug_stop
@@ -1793,7 +1794,7 @@
return self.id_or_identityhash(gcobj, False)
def identityhash(self, gcobj):
- return self.id_or_identityhash(gcobj, True)
+ return mangle_hash(self.id_or_identityhash(gcobj, True))
# ----------
diff --git a/pypy/rpython/memory/lldict.py b/pypy/rpython/memory/lldict.py
--- a/pypy/rpython/memory/lldict.py
+++ b/pypy/rpython/memory/lldict.py
@@ -1,6 +1,7 @@
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython.lltypesystem import rdict
from pypy.rlib.objectmodel import we_are_translated
+from pypy.rpython.memory.support import mangle_hash
# This is a low-level AddressDict, reusing a lot of the logic from rdict.py.
# xxx this is very dependent on the details of rdict.py
@@ -40,7 +41,8 @@
lltype.free(entries, flavor="raw")
if not we_are_translated(): count_alloc(-1)
-_hash = llmemory.cast_adr_to_int
+def _hash(adr):
+ return mangle_hash(llmemory.cast_adr_to_int(adr))
def dict_keyhash(d, key):
return _hash(key)
diff --git a/pypy/rpython/memory/support.py b/pypy/rpython/memory/support.py
--- a/pypy/rpython/memory/support.py
+++ b/pypy/rpython/memory/support.py
@@ -4,6 +4,15 @@
from pypy.rlib.debug import ll_assert
from pypy.tool.identity_dict import identity_dict
+
+def mangle_hash(i):
+ # To hash pointers in dictionaries. Assumes that i shows some
+ # alignment (to 4, 8, maybe 16 bytes), so we use the following
+ # formula to avoid the trailing bits being always 0.
+ return i ^ (i >> 4)
+
+# ____________________________________________________________
+
DEFAULT_CHUNK_SIZE = 1019
More information about the pypy-commit
mailing list