lltype.Signed type in ThreadLocalReference

Hi all, I’m wondering why rthread.ThreadLocalReference is initialised to have lltype.Signed type (rthread.py:387). If in get() it’s retrieved as rclass.OBJECTPTR, why not just set the type of the field to be OBJECTPTR? is this related to some specific optimisation? The problem I’m having is that in my back-end I cannot cast an integer to a GC-ed heap object reference (which the OBJECTPTR translates to), it can only be cast to a non-GC-ed memory object reference (a different memory space not part of the GC managed heap). Any ideas? Regards, John Zhang ------------------------------------------------------ John Zhang Research Assistant Programming Languages, Design & Implementation Division Computer Systems Group ANU College of Engineering & Computer Science 108 North Rd The Australian National University Acton ACT 2601 john.zhang@anu.edu.au<mailto:john.zhang@anu.edu.au>

Hi John, I can't say for sure (Armin probably knows better), but from the commit history it looks like this was specifically changed for the JIT. With commit 5291d2692c2375a4105b43498188e749d4204dc8 the type was changed from llmemory.GCREF to lltype.Signed. I'd recommend changing it back to llmemory.GCREF or rclass.OBJECTPTR in your fork and look whether you'll run into problems later. -Manuel On 2017-03-21 06:29, John Zhang wrote:

Hi Manuel, I attempted to change it to OBJECTPTR in my local repo and it worked. So I will see how it go I guess… Thanks for the reply. Cheers, John Zhang ------------------------------------------------------ John Zhang Research Assistant Programming Languages, Design & Implementation Division Computer Systems Group ANU College of Engineering & Computer Science 108 North Rd The Australian National University Acton ACT 2601 john.zhang@anu.edu.au<mailto:john.zhang@anu.edu.au> On 22 Mar 2017, at 11:03, Manuel Jacob <me@manueljacob.de<mailto:me@manueljacob.de>> wrote: Hi John, I can't say for sure (Armin probably knows better), but from the commit history it looks like this was specifically changed for the JIT. With commit 5291d2692c2375a4105b43498188e749d4204dc8 the type was changed from llmemory.GCREF to lltype.Signed. I'd recommend changing it back to llmemory.GCREF or rclass.OBJECTPTR in your fork and look whether you'll run into problems later. -Manuel On 2017-03-21 06:29, John Zhang wrote: Hi all, I’m wondering why rthread.ThreadLocalReference is initialised to have lltype.Signed type (rthread.py:387). If in get() it’s retrieved as rclass.OBJECTPTR, why not just set the type of the field to be OBJECTPTR? is this related to some specific optimisation? The problem I’m having is that in my back-end I cannot cast an integer to a GC-ed heap object reference (which the OBJECTPTR translates to), it can only be cast to a non-GC-ed memory object reference (a different memory space not part of the GC managed heap). Any ideas? Regards, John Zhang ------------------------------------------------------ John Zhang Research Assistant Programming Languages, Design & Implementation Division Computer Systems Group ANU College of Engineering & Computer Science 108 North Rd The Australian National University Acton ACT 2601 john.zhang@anu.edu.au<mailto:john.zhang@anu.edu.au><mailto:john.zhang@anu.edu.au> _______________________________________________ pypy-dev mailing list pypy-dev@python.org<mailto:pypy-dev@python.org> https://mail.python.org/mailman/listinfo/pypy-dev

Hi John, I can't say for sure (Armin probably knows better), but from the commit history it looks like this was specifically changed for the JIT. With commit 5291d2692c2375a4105b43498188e749d4204dc8 the type was changed from llmemory.GCREF to lltype.Signed. I'd recommend changing it back to llmemory.GCREF or rclass.OBJECTPTR in your fork and look whether you'll run into problems later. -Manuel On 2017-03-21 06:29, John Zhang wrote:

Hi Manuel, I attempted to change it to OBJECTPTR in my local repo and it worked. So I will see how it go I guess… Thanks for the reply. Cheers, John Zhang ------------------------------------------------------ John Zhang Research Assistant Programming Languages, Design & Implementation Division Computer Systems Group ANU College of Engineering & Computer Science 108 North Rd The Australian National University Acton ACT 2601 john.zhang@anu.edu.au<mailto:john.zhang@anu.edu.au> On 22 Mar 2017, at 11:03, Manuel Jacob <me@manueljacob.de<mailto:me@manueljacob.de>> wrote: Hi John, I can't say for sure (Armin probably knows better), but from the commit history it looks like this was specifically changed for the JIT. With commit 5291d2692c2375a4105b43498188e749d4204dc8 the type was changed from llmemory.GCREF to lltype.Signed. I'd recommend changing it back to llmemory.GCREF or rclass.OBJECTPTR in your fork and look whether you'll run into problems later. -Manuel On 2017-03-21 06:29, John Zhang wrote: Hi all, I’m wondering why rthread.ThreadLocalReference is initialised to have lltype.Signed type (rthread.py:387). If in get() it’s retrieved as rclass.OBJECTPTR, why not just set the type of the field to be OBJECTPTR? is this related to some specific optimisation? The problem I’m having is that in my back-end I cannot cast an integer to a GC-ed heap object reference (which the OBJECTPTR translates to), it can only be cast to a non-GC-ed memory object reference (a different memory space not part of the GC managed heap). Any ideas? Regards, John Zhang ------------------------------------------------------ John Zhang Research Assistant Programming Languages, Design & Implementation Division Computer Systems Group ANU College of Engineering & Computer Science 108 North Rd The Australian National University Acton ACT 2601 john.zhang@anu.edu.au<mailto:john.zhang@anu.edu.au><mailto:john.zhang@anu.edu.au> _______________________________________________ pypy-dev mailing list pypy-dev@python.org<mailto:pypy-dev@python.org> https://mail.python.org/mailman/listinfo/pypy-dev
participants (2)
-
John Zhang
-
Manuel Jacob