Skip to content
Permalink
Browse files

Stackless issue python#152: Add Stackless extension structures to run…

…time and interpreter state

Add struct _stackless_runtime_state to _PyRuntimeState and
PyStacklessInterpreterState to PyInterpreterState. For now both structs
are empty. I'll move Stackless globals into them.
  • Loading branch information...
akruis committed Mar 25, 2018
1 parent adec2f2 commit d3b6239a32acb7d9bff42dd379c72eaef289e9ab
@@ -11,6 +11,7 @@ extern "C" {
#include "internal/mem.h"
#include "internal/ceval.h"
#include "internal/warnings.h"
#include "core/stackless_structs.h"


/* GIL state */
@@ -70,7 +71,9 @@ typedef struct pyruntimestate {
struct _warnings_runtime_state warnings;
struct _ceval_runtime_state ceval;
struct _gilstate_runtime_state gilstate;

#ifdef STACKLESS
struct _stackless_runtime_state st;
#endif
// XXX Consolidate globals found via the check-c-globals script.
} _PyRuntimeState;

@@ -98,6 +98,10 @@ typedef struct _is {
PyObject *after_forkers_parent;
PyObject *after_forkers_child;
#endif

#ifdef STACKLESS
PyStacklessInterpreterState st;
#endif
} PyInterpreterState;
#endif

@@ -48,6 +48,7 @@ _PyRuntimeState_Init(_PyRuntimeState *runtime)
_PyMem_Initialize(&runtime->mem);
_PyGC_Initialize(&runtime->gc);
_PyEval_Initialize(&runtime->ceval);
slp_initialize(&runtime->sl);

runtime->gilstate.check_enabled = 1;
/* A TSS key must be initialized with Py_tss_NEEDS_INIT
@@ -141,6 +142,9 @@ PyInterpreterState_New(void)
interp->after_forkers_parent = NULL;
interp->after_forkers_child = NULL;
#endif
#ifdef STACKLESS
SPL_INTERPRETERSTATE_NEW(interp);
#endif

HEAD_LOCK();
interp->next = _PyRuntime.interpreters.head;
@@ -187,6 +191,9 @@ PyInterpreterState_Clear(PyInterpreterState *interp)
Py_CLEAR(interp->after_forkers_parent);
Py_CLEAR(interp->after_forkers_child);
#endif
#ifdef STACKLESS
SPL_INTERPRETERSTATE_CLEAR(interp);
#endif
}


@@ -15,8 +15,9 @@ extern "C" {

#include "structmember.h"
#include "compile.h"
#include "frameobject.h"

/* platform specific constants (mainly SEH stuff to store )*/
#include "platf/slp_platformselect.h"
#include "core/stackless_structs.h"
#include "pickling/prickelpit.h"

@@ -685,6 +686,9 @@ int slp_schedule_task(PyObject **result,
void slp_thread_unblock(PyThreadState *ts);

int slp_initialize_main_and_current(void);
/* not yet implemented
void slp_initialize(struct _stackless_runtime_state *); */
#define slp_initialize(s) /* empty */

/* setting the tasklet's tempval, optimized for no change */

@@ -854,6 +858,8 @@ long slp_parse_thread_id(PyObject *thread_id, unsigned long *id);

#define STACKLESS_DECLARE_METHOD(type, meth)

#define slp_initialize(s) /* empty */

#endif /* STACKLESS */

#ifdef __cplusplus
@@ -5,9 +5,9 @@
extern "C" {
#endif

/* platform specific constants (mainly SEH stuff to store )*/
#include "platf/slp_platformselect.h"
#include "frameobject.h"

#ifdef STACKLESS


/*** important structures: tasklet ***/
@@ -256,6 +256,13 @@ PyAPI_DATA(PyTypeObject) PyChannel_Type;
#define PyChannel_Check(op) PyObject_TypeCheck(op, &PyChannel_Type)
#define PyChannel_CheckExact(op) (Py_TYPE(op) == PyChannel_TypePtr)

/*
* runtime state */
struct _stackless_runtime_state {
};

#endif /* #ifdef STACKLESS */

#ifdef __cplusplus
}
#endif
@@ -11,6 +11,14 @@
#endif
#endif

typedef struct {
} PyStacklessInterpreterState;

#define SPL_INTERPRETERSTATE_NEW(interp) /* empty */

#define SPL_INTERPRETERSTATE_CLEAR(interp) /* empty */


struct _frame; /* Avoid including frameobject.h */

typedef struct _sts {

0 comments on commit d3b6239

Please sign in to comment.
You can’t perform that action at this time.