-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Globals immortal objects flags #9
Conversation
/* The GC bit-shifts refcounts left by two, and after that shift we still | ||
* need this to be >> 0, so leave three high zero bits (the sign bit and | ||
* room for a shift of two.) */ | ||
#define _PyObject_IMMORTAL_BIT (1LL << (8 * sizeof(Py_ssize_t) - 4)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a higher bit on 32-bit builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, due to the bits used by GC.
FYI, only one test fails: "test_negative_refcount (test.test_capi.CAPITest)" |
5f91c94
to
a80c213
Compare
I've created a PR upstream: python#24828. |
This is a branch I started in December, before I found python#19474. My approach wasn't actually terribly different from what Eddie proposed. After finding that PR I updated this one a little bit, borrowing some of the details there.
Notable differences from Eddie's PR:
_Py_INCREF()
Note that I haven't looked at this code for a while. There are probably a number of tweaks to make before posting this upstream.
(An alternative approach, albeit probably not ultimately viable, involves sticking a dummy type in
ob_type
: python/cpython@master...ericsnowcurrently:globals-immortal-objects-obtype)