-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
gh-81057: Move the global Dict-Related Versions to _PyRuntimeState #99497
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
Merged
ericsnowcurrently
merged 4 commits into
python:main
from
ericsnowcurrently:consolidate-obj-version-globals
Nov 16, 2022
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c00d1e0
Move next_dict_keys_version to _PyRuntimeState.
ericsnowcurrently a937251
Move _pydict_global_version to _PyRuntimeState.
ericsnowcurrently ba9e889
Move next_func_version to _PyRuntimeState.
ericsnowcurrently f684dcd
Make "struct _Py_dict_state" a little more compact.
ericsnowcurrently File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Move _pydict_global_version to _PyRuntimeState.
- Loading branch information
commit a937251749be819c780f530f84b509a2c7c9dc9f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef Py_INTERNAL_DICT_STATE_H | ||
#define Py_INTERNAL_DICT_STATE_H | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#ifndef Py_BUILD_CORE | ||
# error "this header requires Py_BUILD_CORE define" | ||
#endif | ||
|
||
|
||
struct _Py_dict_runtime_state { | ||
/*Global counter used to set ma_version_tag field of dictionary. | ||
* It is incremented each time that a dictionary is created and each | ||
* time that a dictionary is modified. */ | ||
uint64_t global_version; | ||
uint32_t next_keys_version; | ||
}; | ||
|
||
|
||
#ifndef WITH_FREELISTS | ||
// without freelists | ||
# define PyDict_MAXFREELIST 0 | ||
#endif | ||
|
||
#ifndef PyDict_MAXFREELIST | ||
# define PyDict_MAXFREELIST 80 | ||
#endif | ||
|
||
#define DICT_MAX_WATCHERS 8 | ||
|
||
struct _Py_dict_state { | ||
#if PyDict_MAXFREELIST > 0 | ||
/* Dictionary reuse scheme to save calls to malloc and free */ | ||
PyDictObject *free_lis 8000 t[PyDict_MAXFREELIST]; | ||
int numfree; | ||
PyDictKeysObject *keys_free_list[PyDict_MAXFREELIST]; | ||
int keys_numfree; | ||
#endif | ||
PyDict_WatchCallback watchers[DICT_MAX_WATCHERS]; | ||
}; | ||
|
||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif /* !Py_INTERNAL_DICT_STATE_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How about reorder members to make struct compact?
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.
I don't mind doing that, but it isn't much related to this PR and I was trying to minimize extra changes. That said, it is a fairly small and simple change so I'll go ahead and do 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.
done