|
1 | 1 | #ifndef Py_LIMITED_API |
2 | 2 |
|
| 3 | +#ifdef Py_BUILD_CORE |
| 4 | +#include "platf/slp_platformselect.h" |
| 5 | +#endif |
| 6 | + |
3 | 7 | /*** addition to tstate ***/ |
4 | 8 | #ifdef Py_DEBUG |
5 | 9 | #ifndef SLP_WITH_FRAME_REF_DEBUG |
@@ -178,5 +182,41 @@ void slp_kill_tasks_with_stacks(struct _ts *tstate); |
178 | 182 | tstate->st.thread.is_blocked = 0; \ |
179 | 183 | tstate->st.thread.is_idle = 0; |
180 | 184 |
|
| 185 | +/* |
| 186 | + * Stackless runtime state |
| 187 | + * |
| 188 | + * Initialized by |
| 189 | + * void slp_initialize(struct _stackless_runtime_state * state) |
| 190 | + * in stackless_util.c |
| 191 | + */ |
| 192 | +struct _stackless_runtime_state { |
| 193 | + /* |
| 194 | + * flag whether the next call should try to be stackless. |
| 195 | + * The protocol is: This flag may be only set if the called |
| 196 | + * thing supports it. It doesn't matter whether it uses the |
| 197 | + * chance, but it *must* set it to zero before returning. |
| 198 | + * This flags in a way serves as a parameter that we don't have. |
| 199 | + * |
| 200 | + * As long as the GIL is shared between sub-interpreters, |
| 201 | + * try_stackless can be a field in the runtime state. |
| 202 | + */ |
| 203 | + int try_stackless; |
| 204 | + |
| 205 | + /* Used to manage free C-stack objects, see stacklesseval.c */ |
| 206 | + int cstack_cachecount; |
| 207 | + struct _cstack *cstack_cache[CSTACK_SLOTS]; |
| 208 | + |
| 209 | + /* |
| 210 | + * Used during a hard switch. |
| 211 | + */ |
| 212 | + struct { |
| 213 | + struct _cstack **cstprev; |
| 214 | + struct _cstack *cst; |
| 215 | + struct _tasklet *prev; |
| 216 | + } transfer; |
| 217 | +}; |
| 218 | + |
| 219 | +void slp_initialize(struct _stackless_runtime_state *); |
| 220 | + |
181 | 221 | #endif /* #ifdef Py_BUILD_CORE */ |
182 | 222 | #endif /* #ifndef Py_LIMITED_API */ |
0 commit comments