Re: [pypy-dev] [pypy-commit] pypy default: Detect objects with h_tid==-42

Are you sure this is unsigned? IMO I've seen '0xffffffd5' or something like that. On Tue, Apr 21, 2015 at 7:24 PM, arigo <noreply@buildbot.pypy.org> wrote:
Author: Armin Rigo <arigo@tunes.org> Branch: Changeset: r76860:e30bd43e438c Date: 2015-04-21 19:24 +0200 http://bitbucket.org/pypy/pypy/changeset/e30bd43e438c/
Log: Detect objects with h_tid==-42
diff --git a/pypy/tool/gdb_pypy.py b/pypy/tool/gdb_pypy.py --- a/pypy/tool/gdb_pypy.py +++ b/pypy/tool/gdb_pypy.py @@ -99,6 +99,8 @@ obj = obj.dereference() hdr = lookup(obj, '_gcheader') tid = hdr['h_tid'] + if tid == -42: # forwarded? + return 'Forwarded' if sys.maxsize < 2**32: offset = tid & 0xFFFF # 32bit else: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit

Hi Maciej, On 22 April 2015 at 08:59, Maciej Fijalkowski <fijall@gmail.com> wrote:
Are you sure this is unsigned? IMO I've seen '0xffffffd5' or something like that.
As far as I can tell, the C code contains the declaration "Signed h_tid;". So I would guess that hdr['h_tid'] returns a signed integer. The next line masks it to a number between 0 and 2**32-1, so then -42 would become 0xffffffd5. But I didn't actually check; please fix if I'm wrong. A bientôt, Armin.

Sorry, I couldn't help noticing this:
if sys.maxsize < 2**32: offset = tid & 0xFFFF # 32bit
0xFFFF is not 32 bit, it's 16 bit.. Should that be 0xFFFFFFFF instead? -alex On Apr 22, 2015 9:43 AM, "Armin Rigo" <arigo@tunes.org> wrote:
Hi Maciej,
On 22 April 2015 at 08:59, Maciej Fijalkowski <fijall@gmail.com> wrote:
Are you sure this is unsigned? IMO I've seen '0xffffffd5' or something like that.
As far as I can tell, the C code contains the declaration "Signed h_tid;". So I would guess that hdr['h_tid'] returns a signed integer. The next line masks it to a number between 0 and 2**32-1, so then -42 would become 0xffffffd5. But I didn't actually check; please fix if I'm wrong.
A bientôt,
Armin. _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev

Hi Alex, On 22 April 2015 at 19:31, Alex Stewart <foogod@gmail.com> wrote:
Sorry, I couldn't help noticing this:
if sys.maxsize < 2**32: offset = tid & 0xFFFF # 32bit
0xFFFF is not 32 bit, it's 16 bit.. Should that be 0xFFFFFFFF instead?
No, this "32bit" comment means "we're running on a 32-bit machine". We take half of the word here. Armin
participants (3)
-
Alex Stewart
-
Armin Rigo
-
Maciej Fijalkowski