[pypy-commit] pypy reverse-debugger: Give id()s that are generally multiple of 8. Helps running rpython tests.

arigo pypy.commits at gmail.com
Thu Feb 23 08:15:57 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: reverse-debugger
Changeset: r90322:ff1be8a8ca2a
Date: 2017-02-23 14:15 +0100
http://bitbucket.org/pypy/pypy/changeset/ff1be8a8ca2a/

Log:	Give id()s that are generally multiple of 8. Helps running rpython
	tests.

diff --git a/rpython/translator/revdb/src-revdb/revdb.c b/rpython/translator/revdb/src-revdb/revdb.c
--- a/rpython/translator/revdb/src-revdb/revdb.c
+++ b/rpython/translator/revdb/src-revdb/revdb.c
@@ -452,7 +452,14 @@
                 warning_printed = 1;
             }
         }
-        return (Signed)(obj->h_uid);
+        /* on 64-bit, the range is large enough anyway, so shift 3 times
+           to get a result that is a multiple of 8.  The Boehm translation
+           will additionally return the 'int_invert' of that.  So
+           we add 7 to make the user-level id() be a multiple of 8. */
+        if (sizeof(obj->h_uid) == sizeof(Signed))
+            return (obj->h_uid << 3) + 7;
+        else
+            return (Signed)(obj->h_uid);
     }
 }
 


More information about the pypy-commit mailing list