Merge remote-tracking branch 'upstream/main' into lazy

This commit is contained in:
Pablo Galindo 2025-12-06 15:40:02 +00:00
commit db151a5192
869 changed files with 45727 additions and 16994 deletions

View file

@ -14,8 +14,6 @@ extern "C" {
#include "pycore_structs.h" // PyHamtObject
#include "pycore_tstate.h" // _PyThreadStateImpl
#include "pycore_typedefs.h" // _PyRuntimeState
#include "pycore_uop.h" // struct _PyUOpInstruction
#define CODE_MAX_WATCHERS 8
#define CONTEXT_MAX_WATCHERS 8
@ -181,6 +179,10 @@ struct gc_collection_stats {
Py_ssize_t collected;
/* total number of uncollectable objects (put into gc.garbage) */
Py_ssize_t uncollectable;
// Total number of objects considered for collection and traversed:
Py_ssize_t candidates;
// Duration of the collection in seconds:
double duration;
};
/* Running stats per generation */
@ -191,6 +193,10 @@ struct gc_generation_stats {
Py_ssize_t collected;
/* total number of uncollectable objects (put into gc.garbage) */
Py_ssize_t uncollectable;
// Total number of objects considered for collection and traversed:
Py_ssize_t candidates;
// Duration of the collection in seconds:
double duration;
};
enum _GCPhase {
@ -199,7 +205,7 @@ enum _GCPhase {
};
/* If we change this, we need to change the default value in the
signature of gc.collect. */
signature of gc.collect and change the size of PyStats.gc_stats */
#define NUM_GENERATIONS 3
struct _gc_runtime_state {
@ -214,6 +220,9 @@ struct _gc_runtime_state {
struct gc_generation_stats generation_stats[NUM_GENERATIONS];
/* true if we are currently running the collector */
int collecting;
// The frame that started the current collection. It might be NULL even when
// collecting (if no Python frame is running):
_PyInterpreterFrame *frame;
/* list of uncollectable objects */
PyObject *garbage;
/* a list of callbacks to be invoked when collection is performed */
@ -940,10 +949,10 @@ struct _is {
PyObject *common_consts[NUM_COMMON_CONSTANTS];
bool jit;
bool compiling;
struct _PyUOpInstruction *jit_uop_buffer;
struct _PyExecutorObject *executor_list_head;
struct _PyExecutorObject *executor_deletion_list_head;
struct _PyExecutorObject *cold_executor;
struct _PyExecutorObject *cold_dynamic_executor;
int executor_deletion_list_remaining_capacity;
size_t executor_creation_counter;
_rare_events rare_events;
@ -969,6 +978,18 @@ struct _is {
# ifdef Py_STACKREF_CLOSE_DEBUG
_Py_hashtable_t *closed_stackrefs_table;
# endif
#endif
#ifdef Py_STATS
// true if recording of pystats is on, this is used when new threads
// are created to decide if recording should be on for them
int pystats_enabled;
// allocated when (and if) stats are first enabled
PyStats *pystats_struct;
#ifdef Py_GIL_DISABLED
// held when pystats related interpreter state is being updated
PyMutex pystats_mutex;
#endif
#endif
/* the initial PyInterpreterState.threads.head */