@@ -47,35 +47,13 @@ struct _Py_long_state {
47
47
The PyInterpreterState typedef is in Include/pytypedefs.h.
48
48
*/
49
49
struct _is {
50
- PyInterpreterState * next ;
51
-
52
- int64_t id ;
53
- int64_t id_refcount ;
54
- int requires_idref ;
55
- PyThread_type_lock id_mutex ;
56
-
57
- /* Has been initialized to a safe state.
58
50
59
- In order to be effective, this must be set to 0 during or right
60
- after allocation. */
61
- int _initialized ;
62
- int finalizing ;
51
+ struct _ceval_state ceval ;
52
+ PyInterpreterState * next ;
63
53
64
54
uint64_t monitoring_version ;
65
55
uint64_t last_restart_version ;
66
56
67
- /* The fields above this line are declared as early as possible to
68
- facilitate out-of-process observability tools. */
69
-
70
- /* Set by Py_EndInterpreter().
71
-
72
- Use _PyInterpreterState_GetFinalizing()
73
- and _PyInterpreterState_SetFinalizing()
74
- to access it, don't access it directly. */
75
- _Py_atomic_address _finalizing ;
76
-
77
- PyCodeObject * interpreter_trampoline ;
78
-
79
57
struct pythreads {
80
58
uint64_t next_unique_id ;
81
59
/* The linked list of threads, newest first. */
@@ -94,22 +72,30 @@ struct _is {
94
72
Get runtime from tstate: tstate->interp->runtime. */
95
73
struct pyruntimestate * runtime ;
96
74
97
- struct _gc_runtime_state gc ;
75
+ int64_t id ;
76
+ int64_t id_refcount ;
77
+ int requires_idref ;
78
+ PyThread_type_lock id_mutex ;
98
79
99
- /* The following fields are here to avoid allocation during init.
100
- The data is exposed through PyInterpreterState pointer fields.
101
- These fields should not be accessed directly outside of init.
80
+ /* Has been initialized to a safe state.
102
81
103
- All other PyInterpreterState pointer fields are populated when
104
- needed and default to NULL.
82
+ In order to be effective, this must be set to 0 during or right
83
+ after allocation. */
84
+ int _initialized ;
85
+ int finalizing ;
105
86
106
- For now there are some exceptions to that rule, which require
107
- allocation during init. These will be addressed on a case-by-case
108
- basis. Also see _PyRuntimeState regarding the various mutex fields.
109
- */
87
+ /* Set by Py_EndInterpreter().
110
88
111
- /* The per-interpreter GIL, which might not be used. */
112
- struct _gil_runtime_state _gil ;
89
+ Use _PyInterpreterState_GetFinalizing()
90
+ and _PyInterpreterState_SetFinalizing()
91
+ to access it, don't access it directly. */
92
+ _Py_atomic_address _finalizing ;
93
+
94
+ struct _obmalloc_state obmalloc ;
95
+
96
+ struct _gc_runtime_state gc ;
97
+
98
+ struct _import_state imports ;
113
99
114
100
// Dictionary of the sys module
115
101
PyObject * sysdict ;
@@ -147,12 +133,6 @@ struct _is {
147
133
struct _warnings_runtime_state warnings ;
148
134
struct atexit_state atexit ;
149
135
150
- struct _ceval_state ceval ;
151
-
152
- struct _obmalloc_state obmalloc ;
153
-
154
- struct _import_state imports ;
155
-
156
136
PyObject * audit_hooks ;
157
137
PyType_WatchCallback type_watchers [TYPE_MAX_WATCHERS ];
158
138
PyCode_WatchCallback code_watchers [CODE_MAX_WATCHERS ];
@@ -179,6 +159,7 @@ struct _is {
179
159
struct ast_state ast ;
180
160
struct types_state types ;
181
161
struct callable_cache callable_cache ;
162
+ PyCodeObject * interpreter_trampoline ;
182
163
_PyOptimizerObject * optimizer ;
183
164
uint16_t optimizer_resume_threshold ;
184
165
uint16_t optimizer_backedge_threshold ;
@@ -195,6 +176,21 @@ struct _is {
195
176
struct _Py_interp_cached_objects cached_objects ;
196
177
struct _Py_interp_static_objects static_objects ;
197
178
179
+ /* The following fields are here to avoid allocation during init.
180
+ The data is exposed through PyInterpreterState pointer fields.
181
+ These fields should not be accessed directly outside of init.
182
+
183
+ All other PyInterpreterState pointer fields are populated when
184
+ needed and default to NULL.
185
+
186
+ For now there are some exceptions to that rule, which require
187
+ allocation during init. These will be addressed on a case-by-case
188
+ basis. Also see _PyRuntimeState regarding the various mutex fields.
189
+ */
190
+
191
+ /* The per-interpreter GIL, which might not be used. */
192
+ struct _gil_runtime_state _gil ;
193
+
198
194
/* the initial PyInterpreterState.threads.head */
199
195
PyThreadState _initial_thread ;
200
196
};
0 commit comments