[Python-Dev] Re: "immortal" objects and how they would help per-interpreter GIL

2021年12月15日 11:03:36 -0800

On Tue, Dec 14, 2021 at 11:19 AM Eric Snow <[email protected]> wrote:
> There is one solution that would help both of the above in a nice way:
> "immortal" objects.
FYI, here are some observations that came up during some discussions
with the "faster-cpython" team today:
* immortal objects should probably only be immutable ones (other than
ob_refcnt, of course)
* GC concerns are less of an issue if a really high ref count (bit) is
used to identify immortal objects
* ob_refcnt is part of the public API (sadly), so using it to mark
immortal objects may be sensitive to interference
* ob_refcnt is part of the stable ABI (even more sadly), affecting any
solution using ref counts
* using the ref count isn't the only viable approach; another would be
checking the pointer itself
 + put the object in a specific section of static data and compare
the pointer against the bounds
 + this avoids loading the actual object data if it is immortal
 + for objects that are mostly treated as markers (e.g. None), this
could have a meaningful impact
 + not compatible with dynamically allocated objects
-eric
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/LVLFPOIOXM34NQ2G73BAXIRS4TIN74JV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to