-
-
Notifications
You must be signed in to change notification settings - Fork 32k
GH-125174: Mark objects as statically allocated. #127797
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
Conversation
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.
Mostly LGTM. I've left a couple of minor comments. This will be a nice improvement.
Out of curiosity, how disruptive is adding a new field to the object structure? |
It doesn't change the size of the |
0e7513a
to
3788c60
Compare
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.
LGTM
#if SIZEOF_VOID_P > 4 | ||
/* If an object has been freed, it will have a negative full refcnt | ||
* If it has not it been freed, will have a very large refcnt */ | ||
if (op->ob_refcnt_full <= 0 || op->ob_refcnt > (UINT32_MAX - (1<<20))) { |
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.
Apparently UINT32_MAX
is not defined in all builds, so this breaks a buildbot.
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.
We use UINT32_MAX
all over the place, so it must be defined. Maybe we're missing a #include
somewhere.
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.
Looks like it's a C++ build that failing, which might explain it
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.
* Set a bit in the unused part of the refcount on 64 bit machines and the free-threaded build. * Use the top of the refcount range on 32 bit machines
This PR is a follow up to #125251 which made checking for immortal objects more robust.
This adds the ability to check whether objects are statically allocated or not, which should assist finalization and safety checks.