Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 7 additions & 7 deletions Include/internal/pycore_freelist.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,13 +103,13 @@ struct _Py_object_stack_state{
};

typedefstruct_Py_freelist_state{
struct_Py_float_statefloat_state;
struct_Py_tuple_statetuple_state;
struct_Py_list_statelist_state;
struct_Py_slice_stateslice_state;
struct_Py_context_statecontext_state;
struct_Py_async_gen_stateasync_gen_state;
struct_Py_object_stack_stateobject_stack_state;
struct_Py_float_statefloats;
struct_Py_tuple_statetuples;
struct_Py_list_statelists;
struct_Py_slice_stateslices;
struct_Py_context_statecontexts;
struct_Py_async_gen_stateasync_gens;
struct_Py_object_stack_stateobject_stacks;
} _PyFreeListState;

#ifdef__cplusplus
Expand Down
4 changes: 2 additions & 2 deletions Objects/floatobject.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,7 @@ get_float_state(void)
{
_PyFreeListState*state=_PyFreeListState_GET();
assert(state!=NULL);
return&state->float_state;
return&state->floats;
}
#endif

Expand DownExpand Up@@ -1993,7 +1993,7 @@ void
_PyFloat_ClearFreeList(_PyFreeListState*freelist_state, intis_finalization)
{
#ifdefWITH_FREELISTS
struct_Py_float_state*state=&freelist_state->float_state;
struct_Py_float_state*state=&freelist_state->floats;
PyFloatObject*f=state->free_list;
while (f!=NULL){
PyFloatObject*next= (PyFloatObject*) Py_TYPE(f);
Expand Down
4 changes: 2 additions & 2 deletions Objects/genobject.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -1633,7 +1633,7 @@ static struct _Py_async_gen_state *
get_async_gen_state(void)
{
_PyFreeListState *state = _PyFreeListState_GET();
return &state->async_gen_state;
return &state->async_gens;
}
#endif

Expand All@@ -1659,7 +1659,7 @@ void
_PyAsyncGen_ClearFreeLists(_PyFreeListState *freelist_state, int is_finalization)
{
#ifdef WITH_FREELISTS
struct _Py_async_gen_state *state = &freelist_state->async_gen_state;
struct _Py_async_gen_state *state = &freelist_state->async_gens;

while (state->value_numfree > 0){
_PyAsyncGenWrappedValue *o;
Expand Down
4 changes: 2 additions & 2 deletions Objects/listobject.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ get_list_state(void)
{
_PyFreeListState *state = _PyFreeListState_GET();
assert(state != NULL);
return &state->list_state;
return &state->lists;
}
#endif

Expand DownExpand Up@@ -124,7 +124,7 @@ void
_PyList_ClearFreeList(_PyFreeListState *freelist_state, int is_finalization)
{
#ifdef WITH_FREELISTS
struct _Py_list_state *state = &freelist_state->list_state;
struct _Py_list_state *state = &freelist_state->lists;
while (state->numfree > 0){
PyListObject *op = state->free_list[--state->numfree];
assert(PyList_CheckExact(op));
Expand Down
14 changes: 7 additions & 7 deletions Objects/sliceobject.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -106,9 +106,9 @@ PyObject _Py_EllipsisObject = _PyObject_HEAD_INIT(&PyEllipsis_Type);
void _PySlice_ClearCache(_PyFreeListState *state)
{
#ifdef WITH_FREELISTS
PySliceObject *obj = state->slice_state.slice_cache;
PySliceObject *obj = state->slices.slice_cache;
if (obj != NULL){
state->slice_state.slice_cache = NULL;
state->slices.slice_cache = NULL;
PyObject_GC_Del(obj);
}
#endif
Expand All@@ -132,9 +132,9 @@ _PyBuildSlice_Consume2(PyObject *start, PyObject *stop, PyObject *step)
PySliceObject *obj;
#ifdef WITH_FREELISTS
_PyFreeListState *state = _PyFreeListState_GET();
if (state->slice_state.slice_cache != NULL){
obj = state->slice_state.slice_cache;
state->slice_state.slice_cache = NULL;
if (state->slices.slice_cache != NULL){
obj = state->slices.slice_cache;
state->slices.slice_cache = NULL;
_Py_NewReference((PyObject *)obj);
}
else
Expand DownExpand Up@@ -370,8 +370,8 @@ slice_dealloc(PySliceObject *r)
Py_DECREF(r->stop);
#ifdef WITH_FREELISTS
_PyFreeListState *state = _PyFreeListState_GET();
if (state->slice_state.slice_cache == NULL){
state->slice_state.slice_cache = r;
if (state->slices.slice_cache == NULL){
state->slices.slice_cache = r;
}
else
#endif
Expand Down
2 changes: 1 addition & 1 deletion Objects/tupleobject.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -1125,7 +1125,7 @@ tuple_iter(PyObject *seq)
* freelists *
*************/

#define STATE (state->tuple_state)
#define STATE (state->tuples)
#define FREELIST_FINALIZED (STATE.numfree[0] < 0)

static inline PyTupleObject *
Expand Down
4 changes: 2 additions & 2 deletions Python/context.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,7 +69,7 @@ static struct _Py_context_state *
get_context_state(void)
{
_PyFreeListState *state = _PyFreeListState_GET();
return &state->context_state;
return &state->contexts;
}
#endif

Expand DownExpand Up@@ -1270,7 +1270,7 @@ void
_PyContext_ClearFreeList(_PyFreeListState *freelist_state, int is_finalization)
{
#ifdef WITH_FREELISTS
struct _Py_context_state *state = &freelist_state->context_state;
struct _Py_context_state *state = &freelist_state->contexts;
for (; state->numfree > 0; state->numfree--){
PyContext *ctx = state->freelist;
state->freelist = (PyContext *)ctx->ctx_weakreflist;
Expand Down
4 changes: 2 additions & 2 deletions Python/object_stack.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ static struct _Py_object_stack_state *
get_state(void)
{
_PyFreeListState *state = _PyFreeListState_GET();
return &state->object_stack_state;
return &state->object_stacks;
}

_PyObjectStackChunk *
Expand DownExpand Up@@ -76,7 +76,7 @@ _PyObjectStackChunk_ClearFreeList(_PyFreeListState *free_lists, int is_finalizat
return;
}

struct _Py_object_stack_state *state = &free_lists->object_stack_state;
struct _Py_object_stack_state *state = &free_lists->object_stacks;
while (state->numfree > 0){
_PyObjectStackChunk *buf = state->free_list;
state->free_list = buf->prev;
Expand Down