8000 GH-100240: Generic freelist, applied to ints by iritkatriel · Pull Request #101453 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-100240: Generic freelist, applied t 8000 o ints #101453

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

Closed
wants to merge 19 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
shift instead of div
  • Loading branch information
iritkatriel committed Feb 8, 2023
commit a9e76ad15182cdd43ca0c062b687936c93c8ceaf
13 changes: 11 additions & 2 deletions Include/internal/pycore_interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,17 @@ PyAPI_FUNC(int) _PyInterpreterState_IDInitref(PyInterpreterState *);
PyAPI_FUNC(int) _PyInterpreterState_IDIncref(PyInterpreterState *);
PyAPI_FUNC(void) _PyInterpreterState_IDDecref(PyInterpreterState *);

#define FREELIST_QUANTUM (2*sizeof(void*))
#define SIZE_TO_FREELIST_INDEX(size) (((size) + FREELIST_QUANTUM - 1)/FREELIST_QUANTUM)
#if SIZEOF_VOID_P == 4
#define LOG_BASE_2_OF_FREELIST_QUANTUM 3
#elif SIZEOF_VOID_P == 8
#define LOG_BASE_2_OF_FREELIST_QUANTUM 4
#else
#error "void pointer size not in (32, 64)"
#endif

#define FREELIST_QUANTUM (2*SIZEOF_VOID_P)
#define SIZE_TO_FREELIST_INDEX(size) (((size) + FREELIST_QUANTUM - 1) >> \
LOG_BASE_2_OF_FREELIST_QUANTUM)
#define FREELIST_INDEX_TO_ALLOCATED_SIZE(idx) ((idx) * FREELIST_QUANTUM)

static inline PyObject*
Expand Down
0