From tismer at centera.de Wed Apr 7 03:01:02 2004 From: tismer at centera.de (Christian Tismer) Date: Wed, 07 Apr 2004 03:01:02 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_version.h, 1.40, 1.41 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv22363/src/2.3/dev/Stackless Modified Files: stackless_version.h Log Message: failed to publish binaries :-) Index: stackless_version.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_version.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** stackless_version.h 2 Apr 2004 23:53:06 -0000 1.40 --- stackless_version.h 7 Apr 2004 01:00:59 -0000 1.41 *************** *** 1,7 **** /* * Stackless Python version string ! * created at Sat Apr 03 01:43:41 2004 by mkversion.py */ /* keep this entry up-to-date */ ! #define STACKLESS_VERSION "3.0 040403" --- 1,7 ---- /* * Stackless Python version string ! * created at Wed Apr 07 02:51:47 2004 by mkversion.py */ /* keep this entry up-to-date */ ! #define STACKLESS_VERSION "3.0 040407" _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 23 02:34:40 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 23 Apr 2004 02:34:40 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Objects descrobject.c, 1.9, 1.10 moduleobject.c, 1.3, 1.4 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Objects In directory centera.de:/tmp/cvs-serv4949/dev/Objects Modified Files: descrobject.c moduleobject.c Log Message: I did a complete rewrite of Stackless pickling. There is *no longer* any patched type. All post-pickled builtin types are now installed into copy_reg. This is done through a module _wrap in stackless. The implementation use sshadow type objects which act like the real types, but they have __reduce__, __new__, __setstate__. This works just great now. One missing spot is pickleing of def f():yield 42 pickle.dumps(type(f()).next) This needs a slot wrapper which is missing. Besides that, I have thought out a second rewrite of pickling which uses a simple special object, which is much smaller and can serve the same service. This will generalize pickling even much more and will make it easier to adopt to all those many new types in Zope, for instance. Stay tuned! Index: descrobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/descrobject.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** descrobject.c 5 Apr 2004 17:17:36 -0000 1.9 --- descrobject.c 23 Apr 2004 00:34:37 -0000 1.10 *************** *** 1024,1028 **** --- 1024,1033 ---- } + #ifdef STACKLESS + #define wrappertype PyMethodWrapper_Type + PyTypeObject PyMethodWrapper_Type = { + #else static PyTypeObject wrappertype = { + #endif PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ Index: moduleobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/moduleobject.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** moduleobject.c 14 Jan 2004 19:11:08 -0000 1.3 --- moduleobject.c 23 Apr 2004 00:34:37 -0000 1.4 *************** *** 5,12 **** #include "structmember.h" - #ifdef STACKLESS - #include "prickelpit.h" - #endif - typedef struct { PyObject_HEAD --- 5,8 ---- *************** *** 28,36 **** return NULL; nameobj = PyString_FromString(name); - #ifdef STACKLESS - m->md_dict = PyModuleDict_New(nameobj); - #else m->md_dict = PyDict_New(); - #endif if (m->md_dict == NULL || nameobj == NULL) goto fail; --- 24,28 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:59:00 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:59:00 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Modules cPickle.c, 1.11, 1.12 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Modules In directory centera.de:/tmp/cvs-serv5382/Modules Modified Files: cPickle.c Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: cPickle.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Modules/cPickle.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** cPickle.c 24 Apr 2004 23:29:39 -0000 1.11 --- cPickle.c 29 Apr 2004 17:58:58 -0000 1.12 *************** *** 2,6 **** #include "cStringIO.h" #include "structmember.h" ! #include "stackless_impl.h" PyDoc_STRVAR(cPickle_module_documentation, --- 2,6 ---- #include "cStringIO.h" #include "structmember.h" ! #include "core/stackless_impl.h" PyDoc_STRVAR(cPickle_module_documentation, _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 5 19:17:38 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 05 Apr 2004 19:17:38 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Objects abstract.c, 1.9, 1.10 classobject.c, 1.13, 1.14 descrobject.c, 1.8, 1.9 funcobject.c, 1.7, 1.8 typeobject.c, 1.11, 1.12 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Objects In directory centera.de:/tmp/cvs-serv17563/Objects Modified Files: abstract.c classobject.c descrobject.c funcobject.c typeobject.c Log Message: removed certain #ifdefs, which unfortunatly became necessary after the STACKLESS_GETARG was moved to the top of every function. I chnaged the definition for the not STACKLESS case to a typedef, which is probably ignored and doesn't give warnings. Index: abstract.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/abstract.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** abstract.c 5 Apr 2004 14:47:13 -0000 1.9 --- abstract.c 5 Apr 2004 17:17:36 -0000 1.10 *************** *** 1751,1765 **** PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif ternaryfunc call; if ((call = func->ob_type->tp_call) != NULL) { - #ifdef STACKLESS PyObject *result = (STACKLESS_PROMOTE(func), (*call)(func, arg, kw)); - #else - PyObject *result = (*call)(func, arg, kw); - #endif if (result == NULL && !PyErr_Occurred()) PyErr_SetString( --- 1751,1759 ---- *************** *** 1776,1782 **** PyObject_CallFunction(PyObject *callable, char *format, ...) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif va_list va; PyObject *args, *retval; --- 1770,1774 ---- *************** *** 1806,1816 **** args = a; } - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif retval = PyObject_Call(callable, args, NULL); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif Py_DECREF(args); --- 1798,1804 ---- *************** *** 1821,1827 **** PyObject_CallMethod(PyObject *o, char *name, char *format, ...) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif va_list va; PyObject *args, *func = 0, *retval; --- 1809,1813 ---- *************** *** 1860,1870 **** args = a; } - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif retval = PyObject_Call(func, args, NULL); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif Py_DECREF(args); Py_DECREF(func); --- 1846,1852 ---- *************** *** 1907,1913 **** PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif PyObject *args, *tmp; va_list vargs; --- 1889,1893 ---- *************** *** 1928,1938 **** return NULL; } - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif tmp = PyObject_Call(callable, args, NULL); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif Py_DECREF(args); Py_DECREF(callable); --- 1908,1914 ---- *************** *** 1944,1950 **** PyObject_CallFunctionObjArgs(PyObject *callable, ...) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif PyObject *args, *tmp; va_list vargs; --- 1920,1924 ---- *************** *** 1959,1969 **** if (args == NULL) return NULL; - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif tmp = PyObject_Call(callable, args, NULL); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif Py_DECREF(args); --- 1933,1939 ---- *************** *** 2223,2240 **** PyIter_Next(PyObject *iter) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif PyObject *result; assert(PyIter_Check(iter)); #ifdef STACKLESS /* we use the same flag here, since iterators are not callable */ - - STACKLESS_PROMOTE(iter); #endif result = (*iter->ob_type->tp_iternext)(iter); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif if (result == NULL && PyErr_Occurred() && --- 2193,2205 ---- PyIter_Next(PyObject *iter) { STACKLESS_GETARG(); PyObject *result; assert(PyIter_Check(iter)); #ifdef STACKLESS /* we use the same flag here, since iterators are not callable */ #endif + STACKLESS_PROMOTE(iter); result = (*iter->ob_type->tp_iternext)(iter); STACKLESS_ASSERT(); if (result == NULL && PyErr_Occurred() && Index: classobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/classobject.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** classobject.c 5 Apr 2004 14:47:13 -0000 1.13 --- classobject.c 5 Apr 2004 17:17:36 -0000 1.14 *************** *** 2352,2360 **** } - #ifdef STACKLESS - void - #else static void - #endif getclassname(PyObject *class, char *buf, int bufsize) { --- 2352,2356 ---- *************** *** 2378,2386 **** } - #ifdef STACKLESS - void - #else static void - #endif getinstclassname(PyObject *inst, char *buf, int bufsize) { --- 2374,2378 ---- *************** *** 2407,2413 **** instancemethod_call(PyObject *func, PyObject *arg, PyObject *kw) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif PyObject *self = PyMethod_GET_SELF(func); PyObject *class = PyMethod_GET_CLASS(func); --- 2399,2403 ---- Index: descrobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/descrobject.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** descrobject.c 5 Apr 2004 14:47:13 -0000 1.8 --- descrobject.c 5 Apr 2004 17:17:36 -0000 1.9 *************** *** 211,217 **** methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwds) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif int argc; PyObject *self, *func, *result; --- 211,215 ---- *************** *** 260,266 **** PyObject *kwds) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif PyObject *func, *result; --- 258,262 ---- *************** *** 269,279 **** return NULL; - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif result = PyEval_CallObjectWithKeywords(func, args, kwds); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif Py_DECREF(func); return result; --- 265,271 ---- *************** *** 283,289 **** wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif int argc; PyObject *self, *func, *result; --- 275,279 ---- *************** *** 320,330 **** return NULL; } - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif result = PyEval_CallObjectWithKeywords(func, args, kwds); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif Py_DECREF(args); Py_DECREF(func); --- 310,316 ---- Index: funcobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/funcobject.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** funcobject.c 5 Apr 2004 14:47:13 -0000 1.7 --- funcobject.c 5 Apr 2004 17:17:36 -0000 1.8 *************** *** 469,475 **** function_call(PyObject *func, PyObject *arg, PyObject *kw) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif PyObject *result; PyObject *argdefs; --- 469,473 ---- *************** *** 505,511 **** nk = 0; } - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif result = PyEval_EvalCodeEx( (PyCodeObject *)PyFunction_GET_CODE(func), --- 503,507 ---- *************** *** 515,521 **** PyFunction_GET_CLOSURE(func)); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif if (k != NULL) PyMem_DEL(k); --- 511,515 ---- Index: typeobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/typeobject.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** typeobject.c 5 Apr 2004 14:47:13 -0000 1.11 --- typeobject.c 5 Apr 2004 17:17:36 -0000 1.12 *************** *** 895,901 **** call_method(PyObject *o, char *name, PyObject **nameobj, char *format, ...) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif va_list va; PyObject *args, *func = 0, *retval; --- 895,899 ---- *************** *** 921,931 **** assert(PyTuple_Check(args)); - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif retval = PyObject_Call(func, args, NULL); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif Py_DECREF(args); Py_DECREF(func); --- 919,925 ---- *************** *** 939,945 **** call_maybe(PyObject *o, char *name, PyObject **nameobj, char *format, ...) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif va_list va; PyObject *args, *func = 0, *retval; --- 933,937 ---- *************** *** 967,977 **** assert(PyTuple_Check(args)); - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif retval = PyObject_Call(func, args, NULL); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif Py_DECREF(args); Py_DECREF(func); --- 959,965 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 04:18:42 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 04:18:42 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/PCbuild _sre.dsp, 1.5, 1.6 python.dsp, 1.6, 1.7 pythoncore.dsp, 1.56, 1.57 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/PCbuild In directory centera.de:/tmp/cvs-serv16658/PCbuild Modified Files: _sre.dsp python.dsp pythoncore.dsp Log Message: added a new Windows target for speed tests: STACKLESS_OFF is a new variable to build Python without stackless. ReleaseOff will compile with STACKLESS undefined. XXX add an option to the configure script! Index: _sre.dsp =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/PCbuild/_sre.dsp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _sre.dsp 14 Jan 2004 19:11:08 -0000 1.5 --- _sre.dsp 29 Apr 2004 02:18:40 -0000 1.6 *************** *** 20,23 **** --- 20,24 ---- !MESSAGE "_sre - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "_sre - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") + !MESSAGE "_sre - Win32 ReleaseOff" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE *************** *** 86,89 **** --- 87,120 ---- # SUBTRACT LINK32 /pdb:none + !ELSEIF "$(CFG)" == "_sre - Win32 ReleaseOff" + + # PROP BASE Use_MFC 0 + # PROP BASE Use_Debug_Libraries 0 + # PROP BASE Output_Dir "_sre___Win32_ReleaseOff" + # PROP BASE Intermediate_Dir "_sre___Win32_ReleaseOff" + # PROP BASE Ignore_Export_Lib 0 + # PROP BASE Target_Dir "" + # PROP Use_MFC 0 + # PROP Use_Debug_Libraries 0 + # PROP Output_Dir "off" + # PROP Intermediate_Dir "x86-temp-releaseOff\_sre" + # PROP Ignore_Export_Lib 0 + # PROP Target_Dir "" + F90=df.exe + # ADD BASE CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /I "..\Stackless" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c + # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /I "..\Stackless" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c + # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 + # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 + # ADD BASE RSC /l 0x409 /d "NDEBUG" + # ADD RSC /l 0x409 /d "NDEBUG" + BSC32=bscmake.exe + # ADD BASE BSC32 /nologo + # ADD BSC32 /nologo + LINK32=link.exe + # ADD BASE LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1e1e0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_sre.pyd" + # SUBTRACT BASE LINK32 /pdb:none + # ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1e1e0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_sre.pyd" + # SUBTRACT LINK32 /pdb:none + !ENDIF *************** *** 92,95 **** --- 123,127 ---- # Name "_sre - Win32 Release" # Name "_sre - Win32 Debug" + # Name "_sre - Win32 ReleaseOff" # Begin Source File Index: python.dsp =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/PCbuild/python.dsp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** python.dsp 14 Jan 2004 19:11:08 -0000 1.6 --- python.dsp 29 Apr 2004 02:18:40 -0000 1.7 *************** *** 20,23 **** --- 20,24 ---- !MESSAGE "python - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "python - Win32 Debug" (based on "Win32 (x86) Console Application") + !MESSAGE "python - Win32 ReleaseOff" (based on "Win32 (x86) Console Application") !MESSAGE *************** *** 79,82 **** --- 80,110 ---- # SUBTRACT LINK32 /pdb:none + !ELSEIF "$(CFG)" == "python - Win32 ReleaseOff" + + # PROP BASE Use_MFC 0 + # PROP BASE Use_Debug_Libraries 0 + # PROP BASE Output_Dir "python___Win32_ReleaseOff" + # PROP BASE Intermediate_Dir "python___Win32_ReleaseOff" + # PROP BASE Ignore_Export_Lib 0 + # PROP BASE Target_Dir "" + # PROP Use_MFC 0 + # PROP Use_Debug_Libraries 0 + # PROP Output_Dir "off" + # PROP Intermediate_Dir "x86-temp-releaseOff\python" + # PROP Ignore_Export_Lib 0 + # PROP Target_Dir "" + # ADD BASE CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "..\Stackless" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c + # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "..\Stackless" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c + # ADD BASE RSC /l 0x409 /d "NDEBUG" + # ADD RSC /l 0x409 /d "NDEBUG" + BSC32=bscmake.exe + # ADD BASE BSC32 /nologo + # ADD BSC32 /nologo + LINK32=link.exe + # ADD BASE LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 + # SUBTRACT BASE LINK32 /pdb:none + # ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 + # SUBTRACT LINK32 /pdb:none + !ENDIF *************** *** 85,88 **** --- 113,117 ---- # Name "python - Win32 Release" # Name "python - Win32 Debug" + # Name "python - Win32 ReleaseOff" # Begin Source File Index: pythoncore.dsp =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/PCbuild/pythoncore.dsp,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** pythoncore.dsp 24 Apr 2004 23:29:40 -0000 1.56 --- pythoncore.dsp 29 Apr 2004 02:18:40 -0000 1.57 *************** *** 20,23 **** --- 20,24 ---- !MESSAGE "pythoncore - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "pythoncore - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") + !MESSAGE "pythoncore - Win32 ReleaseOff" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE *************** *** 87,90 **** --- 88,121 ---- # SUBTRACT LINK32 /pdb:none + !ELSEIF "$(CFG)" == "pythoncore - Win32 ReleaseOff" + + # PROP BASE Use_MFC 0 + # PROP BASE Use_Debug_Libraries 0 + # PROP BASE Output_Dir "pythoncore___Win32_ReleaseOff" + # PROP BASE Intermediate_Dir "pythoncore___Win32_ReleaseOff" + # PROP BASE Ignore_Export_Lib 0 + # PROP BASE Target_Dir "" + # PROP Use_MFC 0 + # PROP Use_Debug_Libraries 0 + # PROP Output_Dir "off" + # PROP Intermediate_Dir "x86-temp-releaseOff\pythoncore" + # PROP Ignore_Export_Lib 0 + # PROP Target_Dir "" + F90=df.exe + # ADD BASE CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "..\Stackless" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_DL_EXPORT" /FAcs /YX /FD /Zm200 /c + # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "..\Stackless" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_DL_EXPORT" /D "STACKLESS_OFF" /FAcs /YX /FD /Zm200 /c + # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" + # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" + # ADD BASE RSC /l 0x409 /i "..\Include" /i "..\Stackless" /d "NDEBUG" + # ADD RSC /l 0x409 /i "..\Include" /i "..\Stackless" /d "NDEBUG" + BSC32=bscmake.exe + # ADD BASE BSC32 /nologo + # ADD BSC32 /nologo + LINK32=link.exe + # ADD BASE LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python23.dll" + # SUBTRACT BASE LINK32 /pdb:none + # ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./off/python23.dll" + # SUBTRACT LINK32 /pdb:none + !ENDIF *************** *** 93,96 **** --- 124,128 ---- # Name "pythoncore - Win32 Release" # Name "pythoncore - Win32 Debug" + # Name "pythoncore - Win32 ReleaseOff" # Begin Group "stackless" _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:29:42 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:29:42 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Doc/lib libos.tex, 1.3, 1.4 libtime.tex, 1.3, 1.4 liburllib2.tex, 1.3, 1.4 libwinreg.tex, 1.2, 1.3 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Doc/lib In directory centera.de:/tmp/cvs-serv10482/Doc/lib Modified Files: libos.tex libtime.tex liburllib2.tex libwinreg.tex Log Message: I did a big cleanup. Tried to reformat everything using 8-tabs, roemoved dead code, and tried to make all Python source file whitespace compatible with the Stackless' version. I hope I didn't make too many mistakes... Index: libos.tex =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Doc/lib/libos.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libos.tex 14 Jan 2004 19:11:07 -0000 1.3 --- libos.tex 24 Apr 2004 23:29:39 -0000 1.4 *************** *** 1764,1773 **** \end{datadesc} - \begin{datadesc}{extsep} - The character which separates the base filename from the extension; - for example, the \character{.} in \code{os.py}. - \versionadded{2.2} - \end{datadesc} - \begin{datadesc}{pathsep} The character conventionally used by the operating system to separate --- 1764,1767 ---- Index: libtime.tex =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Doc/lib/libtime.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libtime.tex 14 Jan 2004 19:11:07 -0000 1.3 --- libtime.tex 24 Apr 2004 23:29:39 -0000 1.4 *************** *** 308,317 **** \end{datadesc} - \begin{datadesc}{struct_time} - The type of the time value sequence returned by \function{gmtime()}, - \function{localtime()}, and \function{strptime()}. - \versionadded{2.2} - \end{datadesc} - \begin{funcdesc}{time}{} Return the time as a floating point number expressed in seconds since --- 308,311 ---- Index: liburllib2.tex =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Doc/lib/liburllib2.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** liburllib2.tex 14 Jan 2004 19:11:07 -0000 1.3 --- liburllib2.tex 24 Apr 2004 23:29:39 -0000 1.4 *************** *** 461,469 **** \end{methoddesc} - \begin{methoddesc}[HTTPRedirectHandler]{http_error_303}{req, - fp, code, msg, hdrs} - The same as \method{http_error_301()}, but called for the - `see other' redirect response. - \end{methoddesc} \subsection{ProxyHandler Objects \label{proxy-handler}} --- 461,464 ---- Index: libwinreg.tex =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Doc/lib/libwinreg.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libwinreg.tex 21 Aug 2003 16:59:14 -0000 1.2 --- libwinreg.tex 24 Apr 2004 23:29:39 -0000 1.3 *************** *** 26,32 **** The hkey argument specifies a previously opened key. ! Note that if \var{hkey} is not closed using this method or the ! \method{handle.Close()} method, it is closed when the \var{hkey} object ! is destroyed by Python. \end{funcdesc} --- 26,32 ---- The hkey argument specifies a previously opened key. ! Note that if \var{hkey} is not closed using this method, (or the ! \method{handle.Close()} closed when the \var{hkey} object is ! destroyed by Python. \end{funcdesc} *************** *** 388,393 **** underlying Windows handle value. ! Handle objects can be converted to an integer (perhaps using the ! builtin \function{int()} function), in which case the underlying Windows handle value is returned. You can also use the \method{Detach()} method to return the integer handle, and --- 388,393 ---- underlying Windows handle value. ! Handle objects can be converted to an integer (eg, using the ! builtin \function{int()} function, in which case the underlying Windows handle value is returned. You can also use the \method{Detach()} method to return the integer handle, and _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 30 22:51:24 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 30 Apr 2004 22:51:24 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python ceval.c, 1.82, 1.83 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv11168/Python Modified Files: ceval.c Log Message: smallish PEP7 omissions Index: ceval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/ceval.c,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** ceval.c 29 Apr 2004 17:58:58 -0000 1.82 --- ceval.c 30 Apr 2004 20:51:22 -0000 1.83 *************** *** 2673,2679 **** PyObject **defs, int defcount, PyObject *closure) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif register PyFrameObject *f; register PyObject *retval = NULL; --- 2673,2677 ---- *************** *** 3997,4001 **** PCALL(PCALL_OTHER); #endif ! STACKLESS_PROPOSE(func); result = PyObject_Call(func, callargs, kwdict); STACKLESS_ASSERT(); --- 3995,3999 ---- PCALL(PCALL_OTHER); #endif ! STACKLESS_PROPOSE(func); result = PyObject_Call(func, callargs, kwdict); STACKLESS_ASSERT(); _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 21:51:29 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 21:51:29 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev Makefile.pre.in, 1.26, 1.27 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev In directory centera.de:/tmp/cvs-serv4029/dev Modified Files: Makefile.pre.in Log Message: a first shot at safe pickling, see the new file safe_pickle.c Index: Makefile.pre.in =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Makefile.pre.in,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Makefile.pre.in 7 Apr 2004 23:25:29 -0000 1.26 --- Makefile.pre.in 18 Apr 2004 19:51:27 -0000 1.27 *************** *** 229,232 **** --- 229,233 ---- Stackless/taskletobject.o \ Stackless/prickelpit.o \ + Stackless/safe_pickle.o \ Python/compile.o \ Python/codecs.o \ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 21:51:30 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 21:51:30 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless safe_pickle.c, NONE, 1.1 stackless_impl.h, 1.79, 1.80 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv4029/dev/Stackless Modified Files: stackless_impl.h Added Files: safe_pickle.c Log Message: a first shot at safe pickling, see the new file safe_pickle.c --- NEW FILE: safe_pickle.c --- #include "Python.h" #ifdef STACKLESS #include "compile.h" #include "stackless_impl.h" static int(*cPickle_save)(PyObject *, PyObject *, int) = NULL; static PyObject * pickle_callback(PyFrameObject *f, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *cur = ts->st.current; PyCStackObject *cst = cur->cstate; PyObject *self, *args; int pers_save, ret; if (!PyArg_ParseTuple(retval, "OOi", &self, &args, &pers_save)) return NULL; ret = cPickle_save(self, args, pers_save); cur->tempval = PyInt_FromLong(ret); /* jump back */ ts->frame = f->f_back; Py_DECREF(f); slp_transfer(NULL, cst, NULL); /* never come here */ return NULL; } int slp_safe_pickling(int(*save)(PyObject *, PyObject *, int), PyObject *self, PyObject *args, int pers_save) { PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *cur = ts->st.current; PyCStackObject *cst = cur->cstate; PyCStackObject *stub = ts->st.initial_stub; PyObject *retval = NULL; int ret = -1; PyObject *cb_args = Py_BuildValue("OOi", self, args, pers_save); PyBaseFrameObject *bf = NULL; if (cb_args == NULL) goto finally; cPickle_save = save; cur->tempval = cb_args; bf = slp_baseframe_new(pickle_callback, 1, 0); if (bf == NULL) goto finally; ts->frame = (PyFrameObject *) bf; cur->cstate = NULL; if (slp_transfer(&cur->cstate, stub, cur)) goto finally; Py_XDECREF(cur->cstate); cur->cstate = cst; retval = cur->tempval; cur->tempval = NULL; if (retval == NULL) goto finally; if (PyInt_Check(retval)) ret = PyInt_AsLong(retval); finally: Py_XDECREF(retval); Py_XDECREF(cb_args); return ret; } #endif Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** stackless_impl.h 18 Apr 2004 15:14:37 -0000 1.79 --- stackless_impl.h 18 Apr 2004 19:51:27 -0000 1.80 *************** *** 275,288 **** PyAPI_FUNC(PyObject *) slp_schedule_task(PyTaskletObject *prev, PyTaskletObject *next, int stackless, PyObject *retval); ! PyObject * slp_run_tasklet(PyFrameObject *f); ! PyObject * slp_resume_tasklet(PyFrameObject *f); ! int initialize_main_and_current(PyFrameObject *f); /* handy abbrevations */ ! PyObject * slp_type_error(const char *msg); ! PyObject * slp_runtime_error(const char *msg); ! PyObject * slp_value_error(const char *msg); ! PyObject * slp_null_error(void); /* this seems to be needed for gcc */ --- 275,288 ---- PyAPI_FUNC(PyObject *) slp_schedule_task(PyTaskletObject *prev, PyTaskletObject *next, int stackless, PyObject *retval); ! PyAPI_FUNC(PyObject *) slp_run_tasklet(PyFrameObject *f); ! PyAPI_FUNC(PyObject *) slp_resume_tasklet(PyFrameObject *f); ! PyAPI_FUNC(int) initialize_main_and_current(PyFrameObject *f); /* handy abbrevations */ ! PyAPI_FUNC(PyObject *) slp_type_error(const char *msg); ! PyAPI_FUNC(PyObject *) slp_runtime_error(const char *msg); ! PyAPI_FUNC(PyObject *) slp_value_error(const char *msg); ! PyAPI_FUNC(PyObject *) slp_null_error(void); /* this seems to be needed for gcc */ *************** *** 301,315 **** #define VALUE_ERROR(str, ret) (slp_value_error(str), ret) ! PyBaseFrameObject * slp_baseframe_new(PyFrame_ExecFunc *exec, unsigned int linked, ! unsigned int extra); ! PyCFrameObject * slp_cframe_new(PyObject *func, PyObject *args, PyObject *kwds, unsigned int linked); ! PyFrameObject * slp_get_frame(PyTaskletObject *task); ! PyTaskletFlagStruc * slp_get_flags(PyTaskletObject *task); ! void slp_check_pending_irq(void); ! int slp_return_wrapper(PyObject *retval); ! int slp_int_wrapper(PyObject *retval); ! int slp_current_wrapper( int(*func)(PyTaskletObject*), PyTaskletObject *task); ! int slp_revive_main(void); /* debugging/monitoring */ --- 301,320 ---- #define VALUE_ERROR(str, ret) (slp_value_error(str), ret) ! PyAPI_FUNC(PyBaseFrameObject *) slp_baseframe_new(PyFrame_ExecFunc *exec, unsigned int linked, ! unsigned int extra); ! PyAPI_FUNC(PyCFrameObject *) slp_cframe_new(PyObject *func, PyObject *args, PyObject *kwds, unsigned int linked); ! PyAPI_FUNC(PyFrameObject *) slp_get_frame(PyTaskletObject *task); ! PyAPI_FUNC(PyTaskletFlagStruc *) slp_get_flags(PyTaskletObject *task); ! PyAPI_FUNC(void) slp_check_pending_irq(void); ! PyAPI_FUNC(int) slp_return_wrapper(PyObject *retval); ! PyAPI_FUNC(int) slp_int_wrapper(PyObject *retval); ! PyAPI_FUNC(int) slp_current_wrapper( int(*func)(PyTaskletObject*), PyTaskletObject *task); ! PyAPI_FUNC(int) slp_revive_main(void); ! ! /* stackless pickling support */ ! ! PyAPI_FUNC(int) slp_safe_pickling(int(*save)(PyObject *, PyObject *, int), ! PyObject *self, PyObject *args, int pers_save); /* debugging/monitoring */ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:59:01 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:59:01 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/core cframeobject.c, 1.67, 1.68 stackless_impl.h, 1.83, 1.84 stacklesseval.c, 1.143, 1.144 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/core In directory centera.de:/tmp/cvs-serv5382/Stackless/core Modified Files: cframeobject.c stackless_impl.h stacklesseval.c Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: cframeobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/core/cframeobject.c,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** cframeobject.c 29 Apr 2004 02:22:15 -0000 1.67 --- cframeobject.c 29 Apr 2004 17:58:59 -0000 1.68 *************** *** 34,38 **** #ifdef STACKLESS #include "stackless_impl.h" ! #include "prickelpit.h" /* access macro to the members which are floating "behind" the object */ --- 34,38 ---- #ifdef STACKLESS #include "stackless_impl.h" ! #include "pickling/prickelpit.h" /* access macro to the members which are floating "behind" the object */ Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/core/stackless_impl.h,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** stackless_impl.h 24 Apr 2004 23:29:39 -0000 1.83 --- stackless_impl.h 29 Apr 2004 17:58:59 -0000 1.84 *************** *** 14,20 **** #include "frameobject.h" ! #include "flextype.h" ! #include "stackless_structs.h" ! #include "prickelpit.h" #undef STACKLESS_SPY --- 14,20 ---- #include "frameobject.h" ! #include "module/flextype.h" ! #include "core/stackless_structs.h" ! #include "pickling/prickelpit.h" #undef STACKLESS_SPY Index: stacklesseval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/core/stacklesseval.c,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** stacklesseval.c 29 Apr 2004 02:41:22 -0000 1.143 --- stacklesseval.c 29 Apr 2004 17:58:59 -0000 1.144 *************** *** 7,14 **** #include "stackless_impl.h" ! #include "prickelpit.h" /* platform specific constants */ ! #include "slp_platformselect.h" /* Stackless extension for ceval.c */ --- 7,14 ---- #include "stackless_impl.h" ! #include "pickling/prickelpit.h" /* platform specific constants */ ! #include "platf/slp_platformselect.h" /* Stackless extension for ceval.c */ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:29:42 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:29:42 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python bltinmodule.c, 1.7, 1.8 ceval.c, 1.79, 1.80 pystate.c, 1.10, 1.11 pythonrun.c, 1.18, 1.19 traceback.c, 1.9, 1.10 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv10482/Python Modified Files: bltinmodule.c ceval.c pystate.c pythonrun.c traceback.c Log Message: I did a big cleanup. Tried to reformat everything using 8-tabs, roemoved dead code, and tried to make all Python source file whitespace compatible with the Stackless' version. I hope I didn't make too many mistakes... Index: bltinmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/bltinmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** bltinmodule.c 5 Apr 2004 17:17:36 -0000 1.7 --- bltinmodule.c 24 Apr 2004 23:29:39 -0000 1.8 *************** *** 2039,2044 **** {"divmod", builtin_divmod, METH_VARARGS, divmod_doc}, #ifdef STACKLESS ! {"eval", builtin_eval, METH_VARARGS | METH_STACKLESS, eval_doc}, ! {"execfile", builtin_execfile, METH_VARARGS | METH_STACKLESS, execfile_doc}, #else {"eval", builtin_eval, METH_VARARGS, eval_doc}, --- 2039,2046 ---- {"divmod", builtin_divmod, METH_VARARGS, divmod_doc}, #ifdef STACKLESS ! {"eval", builtin_eval, METH_VARARGS | METH_STACKLESS, ! eval_doc}, ! {"execfile", builtin_execfile, METH_VARARGS | METH_STACKLESS, ! execfile_doc}, #else {"eval", builtin_eval, METH_VARARGS, eval_doc}, Index: ceval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/ceval.c,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** ceval.c 18 Apr 2004 14:07:33 -0000 1.79 --- ceval.c 24 Apr 2004 23:29:39 -0000 1.80 *************** *** 53,57 **** #endif static int call_trace(Py_tracefunc, PyObject *, PyFrameObject *, ! int, PyObject *); static void call_trace_protected(Py_tracefunc, PyObject *, PyFrameObject *, int); --- 53,57 ---- #endif static int call_trace(Py_tracefunc, PyObject *, PyFrameObject *, ! int, PyObject *); static void call_trace_protected(Py_tracefunc, PyObject *, [...1194 lines suppressed...] v = PyRun_FileFlags(fp, name, Py_file_input, globals, ! locals, &cf); else v = PyRun_File(fp, name, Py_file_input, globals, ! locals); } else { *************** *** 4357,4361 **** if (PyEval_MergeCompilerFlags(&cf)) v = PyRun_StringFlags(str, Py_file_input, globals, ! locals, &cf); else v = PyRun_String(str, Py_file_input, globals, locals); --- 4359,4363 ---- if (PyEval_MergeCompilerFlags(&cf)) v = PyRun_StringFlags(str, Py_file_input, globals, ! locals, &cf); else v = PyRun_String(str, Py_file_input, globals, locals); Index: pystate.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/pystate.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pystate.c 26 Mar 2004 18:52:38 -0000 1.10 --- pystate.c 24 Apr 2004 23:29:39 -0000 1.11 *************** *** 3,6 **** --- 3,11 ---- #include "Python.h" + #ifdef STACKLESS + /* XXX this should vanish! */ + #include "compile.h" + #include "frameobject.h" + #endif #ifdef HAVE_DLOPEN *************** *** 38,41 **** --- 43,47 ---- PyThreadFrameGetter _PyThreadState_GetFrame = NULL; + PyInterpreterState * PyInterpreterState_New(void) *************** *** 126,131 **** #ifdef STACKLESS /* make sure to return a real frame */ ! PyFrameObject *f = self->frame; ! while (f != NULL && ! PyFrame_Check(f)) f = f->f_back; return f; --- 132,137 ---- #ifdef STACKLESS /* make sure to return a real frame */ ! struct _frame *f = self->frame; ! while (f != NULL && !PyFrame_Check(f)) f = f->f_back; return f; *************** *** 175,178 **** --- 181,185 ---- STACKLESS_PYSTATE_NEW; #endif + HEAD_LOCK(); tstate->next = interp->tstate_head; *************** *** 191,196 **** STACKLESS_PYSTATE_ZAP; #endif ! ! if (Py_VerboseFlag && tstate->frame != NULL) fprintf(stderr, "PyThreadState_Clear: warning: thread still has a frame\n"); --- 198,202 ---- STACKLESS_PYSTATE_ZAP; #endif ! if (Py_VerboseFlag && tstate->frame != NULL) fprintf(stderr, "PyThreadState_Clear: warning: thread still has a frame\n"); Index: pythonrun.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/pythonrun.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** pythonrun.c 23 Apr 2004 00:34:38 -0000 1.18 --- pythonrun.c 24 Apr 2004 23:29:39 -0000 1.19 *************** *** 331,335 **** call_sys_exitfunc(); #ifdef STACKLESS ! PyStackless_kill_tasks_with_stacks(); #endif initialized = 0; --- 331,335 ---- call_sys_exitfunc(); #ifdef STACKLESS ! PyStackless_kill_tasks_with_stacks(); #endif initialized = 0; *************** *** 431,434 **** --- 431,435 ---- PyInt_Fini(); PyFloat_Fini(); + #ifdef Py_USING_UNICODE /* Cleanup Unicode implementation */ Index: traceback.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/traceback.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** traceback.c 18 Apr 2004 16:45:25 -0000 1.9 --- traceback.c 24 Apr 2004 23:29:39 -0000 1.10 *************** *** 97,102 **** 0, /* tp_iternext */ 0, /* tp_methods */ ! 0, /* tp_members */ ! 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ --- 97,102 ---- 0, /* tp_iternext */ 0, /* tp_methods */ ! 0, /* tp_members */ ! 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 18:45:27 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 18:45:27 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless prickelpit.c, 1.59, 1.60 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv31818/Stackless Modified Files: prickelpit.c Log Message: simplified pickling of tracebacks. They are recursive, again. I will try to make cPickle stackless, instead. Removed all patches from tracebackobject.c Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** prickelpit.c 18 Apr 2004 15:20:20 -0000 1.59 --- prickelpit.c 18 Apr 2004 16:45:25 -0000 1.60 *************** *** 746,759 **** /* ! * Has been all transferred to traceback.c :-) ! * ! * XXX revert this as much as possible and keep the patch small !! */ static int init_tracebacktype(void) { /* initialization of traceback pickling support */ ! return init_type(&PyTraceBack_Type, NULL, NULL); } --- 746,844 ---- /* ! * Simplified version with full recursion. ! * This is fine, since we are making cPickle stackless. */ + /* XXX automate checking these double definitions: */ + + typedef struct _tracebackobject { + PyObject_HEAD + struct _tracebackobject *tb_next; + PyFrameObject *tb_frame; + int tb_lasti; + int tb_lineno; + } tracebackobject; + + static PyObject * + tb_reduce(tracebackobject * tb, PyObject *args) + { + PyObject *tup = NULL; + char *fmt = "(O(OiiO))"; + int proto = 0; + + if (!PyArg_ParseTuple(args, "|i:__reduce_ex__", &proto)) + return NULL; + + if (tb->tb_next == NULL) + fmt = "(O(Oii))"; + tup = Py_BuildValue(fmt, + &PyTraceBack_Type, + tb->tb_frame, tb->tb_lasti, tb->tb_lineno, tb->tb_next); + return tup; + } + + static + PyObject * + traceback_new(PyTypeObject *type, PyObject *args, PyObject *kwds) + { + tracebackobject *tb, *next = NULL; + PyFrameObject *frame; + int lasti, lineno; + + if (kwds != NULL) { + PyErr_SetString(PyExc_ValueError, "Keyword parameters not supported for traceback_new"); + return NULL; + } + if (!PyArg_ParseTuple(args, "O!ii|O!:traceback", + &PyFrame_Type, &frame, + &lasti, &lineno, + &PyTraceBack_Type, &next)) + return NULL; + + tb = PyObject_GC_New(tracebackobject, &PyTraceBack_Type); + if (tb != NULL) { + Py_XINCREF(next); + tb->tb_next = next; + Py_XINCREF(frame); + tb->tb_frame = frame; + tb->tb_lasti = lasti; + tb->tb_lineno = lineno; + PyObject_GC_Track(tb); + } + + return (PyObject *) tb; + } + + static PyMethodDef tb_methodlist[] = { + {"__reduce__", (PyCFunction)tb_reduce, METH_VARARGS, + PyDoc_STR("tb.__reduce__() -- reduce method for pickling")}, + {"__reduce_ex__", (PyCFunction)tb_reduce, METH_VARARGS, + PyDoc_STR("tb.__reduce__() -- reduce method for pickling")}, + {NULL, NULL} + }; + + /* XXX submit a patch to traceback.c, it is out of date! */ + + #define OFF(x) offsetof(tracebackobject, x) + + static PyMemberDef tb_memberlist[] = { + {"tb_next", T_OBJECT, OFF(tb_next)}, + {"tb_frame", T_OBJECT, OFF(tb_frame)}, + {"tb_lasti", T_INT, OFF(tb_lasti)}, + {"tb_lineno", T_INT, OFF(tb_lineno)}, + {NULL} /* Sentinel */ + }; + + #undef OFF + static int init_tracebacktype(void) { /* initialization of traceback pickling support */ ! assert(PyTraceBack_Type.tp_getattro == NULL); ! PyTraceBack_Type.tp_getattro = PyObject_GenericGetAttr; ! assert(PyTraceBack_Type.tp_members == NULL); ! PyTraceBack_Type.tp_members = tb_memberlist; ! return init_type(&PyTraceBack_Type, tb_methodlist, traceback_new); } _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 20:09:26 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 20:09:26 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev Makefile.pre.in, 1.29, 1.30 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev In directory centera.de:/tmp/cvs-serv6334 Modified Files: Makefile.pre.in Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: Makefile.pre.in =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Makefile.pre.in,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Makefile.pre.in 24 Apr 2004 23:29:39 -0000 1.29 --- Makefile.pre.in 29 Apr 2004 18:09:23 -0000 1.30 *************** *** 219,232 **** Python/exceptions.o \ Python/ceval.o \ ! Stackless/stacklesseval.o \ ! Stackless/slp_transfer.o \ ! Stackless/stacklessmodule.o \ ! Stackless/cframeobject.o \ ! Stackless/channelobject.o \ ! Stackless/flextype.o \ ! Stackless/scheduling.o \ ! Stackless/stackless_util.o \ ! Stackless/taskletobject.o \ ! Stackless/prickelpit.o \ Python/compile.o \ Python/codecs.o \ --- 219,232 ---- Python/exceptions.o \ Python/ceval.o \ ! Stackless/core/cframeobject.o \ ! Stackless/core/slp_transfer.o \ ! Stackless/core/stacklesseval.o \ ! Stackless/core/stackless_util.o \ ! Stackless/module/channelobject.o \ ! Stackless/module/flextype.o \ ! Stackless/module/scheduling.o \ ! Stackless/module/stacklessmodule.o \ ! Stackless/module/taskletobject.o \ ! Stackless/pickling/prickelpit.o \ Python/compile.o \ Python/codecs.o \ *************** *** 468,473 **** $(srcdir)/Objects/unicodetype_db.h ! Stackless/slp_transfer.o: $(srcdir)/Stackless/slp_transfer.c ! $(CC) -c $(PY_CFLAGS) $(SLPFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Stackless/slp_transfer.c ############################################################################ --- 468,473 ---- $(srcdir)/Objects/unicodetype_db.h ! Stackless/slp_transfer.o: $(srcdir)/Stackless/core/slp_transfer.c ! $(CC) -c $(PY_CFLAGS) $(SLPFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Stackless/core/slp_transfer.c ############################################################################ *************** *** 521,542 **** Include/unicodeobject.h \ Include/weakrefobject.h \ - Stackless/cframeobject.h \ - Stackless/channelobject.h \ - Stackless/flextype.h \ - Stackless/prickelpit.h \ - Stackless/slp_platformselect.h \ Stackless/stackless.h \ Stackless/stackless_api.h \ - Stackless/stackless_impl.h \ - Stackless/stackless_structs.h \ - Stackless/stackless_tstate.h \ Stackless/stackless_version.h \ ! Stackless/switch_ppc_macosx.h \ ! Stackless/switch_ppc_unix.h \ ! Stackless/switch_s390_unix.h \ ! Stackless/switch_sparc_sun_gcc.h \ ! Stackless/switch_x86_msvc.h \ ! Stackless/switch_x86_unix.h \ ! Stackless/taskletobject.h \ pyconfig.h --- 521,542 ---- Include/unicodeobject.h \ Include/weakrefobject.h \ Stackless/stackless.h \ Stackless/stackless_api.h \ Stackless/stackless_version.h \ ! Stackless/core/cframeobject.h \ ! Stackless/core/stackless_impl.h \ ! Stackless/core/stackless_structs.h \ ! Stackless/core/stackless_tstate.h \ ! Stackless/module/channelobject.h \ ! Stackless/module/flextype.h \ ! Stackless/module/taskletobject.h \ ! Stackless/pickling/prickelpit.h \ ! Stackless/platf/slp_platformselect.h \ ! Stackless/platf/switch_ppc_macosx.h \ ! Stackless/platf/switch_ppc_unix.h \ ! Stackless/platf/switch_s390_unix.h \ ! Stackless/platf/switch_sparc_sun_gcc.h \ ! Stackless/platf/switch_x86_msvc.h \ ! Stackless/platf/switch_x86_unix.h \ pyconfig.h _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 30 05:29:41 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 30 Apr 2004 05:29:41 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Lib pickle.py,1.8,1.9 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Lib In directory centera.de:/tmp/cvs-serv21336/dev/Lib Modified Files: pickle.py Log Message: marked patch to pickle.py as stackless specific Index: pickle.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Lib/pickle.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pickle.py 24 Apr 2004 23:29:40 -0000 1.8 --- pickle.py 30 Apr 2004 03:29:38 -0000 1.9 *************** *** 213,216 **** --- 213,217 ---- self.bin = protocol >= 1 self.fast = 0 + ## Stackless addition BEGIN try: from stackless import _pickle_moduledict *************** *** 218,221 **** --- 219,223 ---- _pickle_moduledict = lambda self, obj:None self._pickle_moduledict = _pickle_moduledict + ## Stackless addition END def clear_memo(self): _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 21:00:18 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 21:00:18 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.2/src/Stackless/testbench testbench.cpp, 1.4, 1.5 Message-ID: Update of /home/cvs/slpdev/src/2.2/src/Stackless/testbench In directory centera.de:/tmp/cvs-serv8707/Stackless/testbench Modified Files: testbench.cpp Log Message: removed multiple interpreters. Index: testbench.cpp =================================================================== RCS file: /home/cvs/slpdev/src/2.2/src/Stackless/testbench/testbench.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testbench.cpp 15 Apr 2004 22:31:42 -0000 1.4 --- testbench.cpp 29 Apr 2004 19:00:15 -0000 1.5 *************** *** 155,159 **** { public: ! PyThreadState *m_interp; PyObject *m_script_code; PyObject *m_tasklet; --- 155,159 ---- { public: ! // PyThreadState *m_interp; PyObject *m_script_code; PyObject *m_tasklet; *************** *** 162,167 **** rTasklet() { ! m_interp = Py_NewInterpreter(); ! PyThreadState_Swap(m_interp); PyPythonScript_Type.ob_type = &PyType_Type; --- 162,167 ---- rTasklet() { ! // m_interp = Py_NewInterpreter(); ! // PyThreadState_Swap(m_interp); PyPythonScript_Type.ob_type = &PyType_Type; *************** *** 181,185 **** void CompileAndExecuteMain( char* code ) { ! PyThreadState_Swap(m_interp); m_script_code = Py_CompileString(code, "pythoncode", Py_file_input); Py_INCREF(m_script_code); --- 181,185 ---- void CompileAndExecuteMain( char* code ) { ! // PyThreadState_Swap(m_interp); m_script_code = Py_CompileString(code, "pythoncode", Py_file_input); Py_INCREF(m_script_code); *************** *** 193,197 **** PyObject *CreateTask(char* func_name ) { ! PyThreadState_Swap(m_interp); PyObject *pName, *pModule, *pDict; pName = PyString_FromString("__main__"); --- 193,197 ---- PyObject *CreateTask(char* func_name ) { ! // PyThreadState_Swap(m_interp); PyObject *pName, *pModule, *pDict; pName = PyString_FromString("__main__"); *************** *** 209,213 **** void RunTask( char* msg ) { ! PyThreadState_Swap(m_interp); CPCE(PySW_RunTasklet(m_tasklet), msg); } --- 209,213 ---- void RunTask( char* msg ) { ! // PyThreadState_Swap(m_interp); CPCE(PySW_RunTasklet(m_tasklet), msg); } *************** *** 215,219 **** void ContinueTask(char* msg ) { ! PyThreadState_Swap(m_interp); CPCE(PySW_ContinueTasklet(m_tasklet), msg); } --- 215,219 ---- void ContinueTask(char* msg ) { ! // PyThreadState_Swap(m_interp); CPCE(PySW_ContinueTasklet(m_tasklet), msg); } *************** *** 221,225 **** void ResetTask(char* msg ) { ! PyThreadState_Swap(m_interp); CPCE(PySW_ResetTasklet(m_tasklet), msg); } --- 221,225 ---- void ResetTask(char* msg ) { ! // PyThreadState_Swap(m_interp); CPCE(PySW_ResetTasklet(m_tasklet), msg); } *************** *** 230,234 **** if( m_tasklet ) { ! PyThreadState_Swap(m_interp); CPCE(PySW_CleanupTasklet( m_tasklet ), msg); // Py_XDECREF(m_tasklet); --- 230,234 ---- if( m_tasklet ) { ! // PyThreadState_Swap(m_interp); CPCE(PySW_CleanupTasklet( m_tasklet ), msg); // Py_XDECREF(m_tasklet); *************** *** 244,248 **** PyObject *GetFunction(char *func_name) { ! PyThreadState_Swap(m_interp); PyObject *pName, *pModule, *pDict; pName = PyString_FromString("__main__"); --- 244,248 ---- PyObject *GetFunction(char *func_name) { ! // PyThreadState_Swap(m_interp); PyObject *pName, *pModule, *pDict; pName = PyString_FromString("__main__"); *************** *** 256,263 **** { ! PyThreadState *old_state = PyThreadState_Swap(m_interp); ! PyThreadState_Clear(m_interp); ! // Interpreter deletion deos not work yet! And it leakes now memory ... // PyThreadState_Swap(NULL); // Should not be required ... nobody has tested these python calls together // PyThreadState_Delete(m_interp); --- 256,263 ---- { ! // PyThreadState *old_state = PyThreadState_Swap(m_interp); ! // PyThreadState_Clear(m_interp); ! // Interpreter deletion does not work yet! And it leakes now memory ... // PyThreadState_Swap(NULL); // Should not be required ... nobody has tested these python calls together // PyThreadState_Delete(m_interp); *************** *** 265,269 **** // PyThreadState_Swap(m_interp); // CPCE( true, msg); ! Py_EndInterpreter( m_interp ); } --- 265,269 ---- // PyThreadState_Swap(m_interp); // CPCE( true, msg); ! // Py_EndInterpreter( m_interp ); } _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 11 14:02:25 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 11 Apr 2004 14:02:25 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.2/src/Stackless/testbench simwrapper.c, 1.5, 1.7 testbench.dsp, 1.2, 1.4 Message-ID: Update of /home/cvs/slpdev/src/2.2/src/Stackless/testbench In directory centera.de:/tmp/cvs-serv31373/src/2.3/dev/Stackless/testbench Modified Files: simwrapper.c testbench.dsp Log Message: temporary Index: simwrapper.c =================================================================== RCS file: /home/cvs/slpdev/src/2.2/src/Stackless/testbench/simwrapper.c,v retrieving revision 1.5 retrieving revision 1.7 diff -C2 -d -r1.5 -r1.7 *** simwrapper.c 14 Jan 2004 16:33:13 -0000 1.5 --- simwrapper.c 11 Apr 2004 12:02:23 -0000 1.7 *************** *** 52,56 **** if ( PyTasklet_Alive( task )) ret = PyTasklet_Kill( task ); ! Py_DECREF( task ); } return ret; --- 52,56 ---- if ( PyTasklet_Alive( task )) ret = PyTasklet_Kill( task ); ! Py_XDECREF( task ); } return ret; *************** *** 94,98 **** PyTaskletObject *task = (PyTaskletObject *) tasklet; ! ret = PyTasklet_Call(task, args, NULL ); if (ret) return ret; ret = PyTasklet_Run(task); --- 94,98 ---- PyTaskletObject *task = (PyTaskletObject *) tasklet; ! ret = PyTasklet_Setup(task, args, NULL ); if (ret) return ret; ret = PyTasklet_Run(task); *************** *** 114,118 **** if( task ) { ! Py_DECREF(task); return wrap(PyStackless_Schedule(Py_None, 0)); } --- 114,118 ---- if( task ) { ! Py_XDECREF(task); return wrap(PyStackless_Schedule(Py_None, 0)); } Index: testbench.dsp =================================================================== RCS file: /home/cvs/slpdev/src/2.2/src/Stackless/testbench/testbench.dsp,v retrieving revision 1.2 retrieving revision 1.4 diff -C2 -d -r1.2 -r1.4 *** testbench.dsp 22 Nov 2003 04:52:43 -0000 1.2 --- testbench.dsp 11 Apr 2004 12:02:23 -0000 1.4 *************** *** 39,49 **** # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 ! # PROP Output_Dir "Release" ! # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c ! # ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /I "..\..\stackless" /I "..\..\PC" /I "..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 --- 39,49 ---- # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 ! # PROP Output_Dir "." ! # PROP Intermediate_Dir "..\..\pcbuild\x86-temp-release\testbench" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c ! # ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /I "..\..\stackless" /I "..\..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FR /FD /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 *************** *** 56,60 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib python22.lib /nologo /subsystem:console /machine:I386 /out:"..\..\PCbuild\testbench.exe" /libpath:"..\..\PCbuild" # SUBTRACT LINK32 /pdb:none --- 56,60 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\PCbuild\testbench.exe" /libpath:"..\..\PCbuild" # SUBTRACT LINK32 /pdb:none *************** *** 68,73 **** # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 ! # PROP Output_Dir "Debug" ! # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" --- 68,73 ---- # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 ! # PROP Output_Dir "." ! # PROP Intermediate_Dir "..\..\pcbuild\x86-temp-debug\testbench" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" *************** *** 75,79 **** # ADD F90 /browser # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c ! # ADD CPP /nologo /MT /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\stackless" /I "..\..\PC" /I "..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /FD /GZ /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 --- 75,79 ---- # ADD F90 /browser # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c ! # ADD CPP /nologo /MT /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\stackless" /I "..\..\PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /FD /GZ /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 *************** *** 112,116 **** !ELSEIF "$(CFG)" == "testbench - Win32 Debug" ! # ADD CPP /I "C:\codebase\main\development\3rdparty\Include" /I "C:\codebase\main\development\3rdparty\PC" /I "C:\codebase\main\development\3rdparty\stackless" /I "C:\codebase\main\development\3rdparty\simwrapper" /Yc"stdafx.h" !ENDIF --- 112,116 ---- !ELSEIF "$(CFG)" == "testbench - Win32 Debug" ! # ADD CPP /I "C:\codebase\main\development\3rdparty\stackless\src\Include" /I "C:\codebase\main\development\3rdparty\stackless\src\PC" /I "C:\codebase\main\development\3rdparty\stackless\src\stackless" /I "C:\codebase\main\development\3rdparty\stackless\src\simwrapper" /Yc"stdafx.h" !ENDIF *************** *** 125,129 **** !ELSEIF "$(CFG)" == "testbench - Win32 Debug" ! # ADD CPP /I "C:\codebase\main\development\3rdparty\Include" /I "C:\codebase\main\development\3rdparty\PC" /I "C:\codebase\main\development\3rdparty\stackless" /I "C:\codebase\main\development\3rdparty\simwrapper" !ENDIF --- 125,129 ---- !ELSEIF "$(CFG)" == "testbench - Win32 Debug" ! # ADD CPP /I "C:\codebase\main\development\3rdparty\stackless\src\Include" /I "C:\codebase\main\development\3rdparty\stackless\src\PC" /I "C:\codebase\main\development\3rdparty\stackless\src\stackless" /I "C:\codebase\main\development\3rdparty\stackless\src\simwrapper" !ENDIF _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 5 21:00:06 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 05 Apr 2004 21:00:06 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_impl.h, 1.75, 1.76 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv5729/Stackless Modified Files: stackless_impl.h Log Message: still trying to convince gcc not to blather... Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** stackless_impl.h 5 Apr 2004 18:52:45 -0000 1.75 --- stackless_impl.h 5 Apr 2004 19:00:04 -0000 1.76 *************** *** 300,305 **** #define STACKLESS_PROPOSE_FLAG(flag) {int stackless = 0;} #define STACKLESS_PROPOSE_ALL() {int stackless = 0;} ! #define STACKLESS_RETRACT() {int stackless = 0;} ! #define STACKLESS_ASSERT() {int stackless = 0;} #endif /* STACKLESS */ --- 300,305 ---- #define STACKLESS_PROPOSE_FLAG(flag) {int stackless = 0;} #define STACKLESS_PROPOSE_ALL() {int stackless = 0;} ! #define STACKLESS_RETRACT() assert(1) ! #define STACKLESS_ASSERT() assert(1) #endif /* STACKLESS */ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 16 00:31:14 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 16 Apr 2004 00:31:14 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Objects abstract.c, 1.10, 1.11 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Objects In directory centera.de:/tmp/cvs-serv27744/src/2.3/dev/Objects Modified Files: abstract.c Log Message: small omission Index: abstract.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/abstract.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** abstract.c 5 Apr 2004 17:17:36 -0000 1.10 --- abstract.c 15 Apr 2004 22:31:11 -0000 1.11 *************** *** 1756,1759 **** --- 1756,1760 ---- if ((call = func->ob_type->tp_call) != NULL) { PyObject *result = (STACKLESS_PROMOTE(func), (*call)(func, arg, kw)); + STACKLESS_ASSERT(); if (result == NULL && !PyErr_Occurred()) PyErr_SetString( _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From gherman at centera.de Wed Apr 21 20:08:08 2004 From: gherman at centera.de (Dinu Gherman) Date: Wed, 21 Apr 2004 20:08:08 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/unittests test_chan_cb.py, 1.2, 1.3 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/unittests In directory centera.de:/tmp/cvs-serv27071 Modified Files: test_chan_cb.py Log Message: Minor editing Index: test_chan_cb.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/unittests/test_chan_cb.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_chan_cb.py 17 Mar 2004 17:31:48 -0000 1.2 --- test_chan_cb.py 21 Apr 2004 18:08:06 -0000 1.3 *************** *** 9,13 **** def __call__(self, channel, tasklet, isSending, willBlock): ! self.history.append((channel, tasklet, isSending, willBlock, tasklet.tempval)) --- 9,14 ---- def __call__(self, channel, tasklet, isSending, willBlock): ! tup = (channel, tasklet, isSending, willBlock, tasklet.tempval) ! self.history.append(tup) *************** *** 36,46 **** # found = chanMon.history[0][1].tempval # self.failUnlessEqual(val, found) # FAILS - why? # fails, because the value is moved from sender to receiver # also, I need to modify channels a little :-) # this one works, because I keep a copy of the value. ! print chanMon.history found = chanMon.history[0][-1] self.failUnlessEqual(val, found) if __name__ == "__main__": unittest.main() --- 37,50 ---- # found = chanMon.history[0][1].tempval # self.failUnlessEqual(val, found) # FAILS - why? + # # fails, because the value is moved from sender to receiver # also, I need to modify channels a little :-) # this one works, because I keep a copy of the value. ! # ! # print chanMon.history found = chanMon.history[0][-1] self.failUnlessEqual(val, found) + if __name__ == "__main__": unittest.main() _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 5 19:17:38 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 05 Apr 2004 19:17:38 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python bltinmodule.c, 1.6, 1.7 ceval.c, 1.76, 1.77 pythonrun.c, 1.14, 1.15 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv17563/Python Modified Files: bltinmodule.c ceval.c pythonrun.c Log Message: removed certain #ifdefs, which unfortunatly became necessary after the STACKLESS_GETARG was moved to the top of every function. I chnaged the definition for the not STACKLESS case to a typedef, which is probably ignored and doesn't give warnings. Index: bltinmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/bltinmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bltinmodule.c 5 Apr 2004 14:48:41 -0000 1.6 --- bltinmodule.c 5 Apr 2004 17:17:36 -0000 1.7 *************** *** 4,10 **** #include "Python.h" - #ifdef STACKLESS #include "stackless_impl.h" - #endif #include "node.h" --- 4,8 ---- *************** *** 459,465 **** builtin_eval(PyObject *self, PyObject *args) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif PyObject *cmd, *result, *tmp = NULL; PyObject *globals = Py_None, *locals = Py_None; --- 457,461 ---- *************** *** 492,498 **** return NULL; } - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals); } --- 488,492 ---- *************** *** 521,531 **** (void)PyEval_MergeCompilerFlags(&cf); - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif result = PyRun_StringFlags(str, Py_eval_input, globals, locals, &cf); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif Py_XDECREF(tmp); return result; --- 515,521 ---- *************** *** 545,551 **** builtin_execfile(PyObject *self, PyObject *args) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif char *filename; PyObject *globals = Py_None, *locals = Py_None; --- 535,539 ---- *************** *** 625,631 **** } cf.cf_flags = 0; - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif if (PyEval_MergeCompilerFlags(&cf)) res = PyRun_FileExFlags(fp, filename, Py_file_input, globals, --- 613,617 ---- *************** *** 634,640 **** res = PyRun_FileEx(fp, filename, Py_file_input, globals, locals, 1); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif return res; } --- 620,624 ---- Index: ceval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/ceval.c,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** ceval.c 5 Apr 2004 14:48:41 -0000 1.76 --- ceval.c 5 Apr 2004 17:17:36 -0000 1.77 *************** *** 2680,2686 **** PyObject **defs, int defcount, PyObject *closure) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif register PyFrameObject *f; register PyObject *retval = NULL; --- 2680,2684 ---- *************** *** 3597,3603 **** PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif PyObject *result; --- 3595,3599 ---- *************** *** 3618,3628 **** return NULL; } - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif result = PyObject_Call(func, arg, kw); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif Py_DECREF(arg); return result; --- 3614,3620 ---- Index: pythonrun.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/pythonrun.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pythonrun.c 5 Apr 2004 14:48:41 -0000 1.14 --- pythonrun.c 5 Apr 2004 17:17:36 -0000 1.15 *************** *** 1226,1238 **** PyObject *locals, int closeit) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif node *n = PyParser_SimpleParseFile(fp, filename, start); if (closeit) fclose(fp); - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif return run_err_node(n, filename, globals, locals, NULL); } --- 1226,1234 ---- *************** *** 1259,1272 **** PyObject *locals, int closeit, PyCompilerFlags *flags) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif node *n = PyParser_SimpleParseFileFlags(fp, filename, start, PARSER_FLAGS(flags)); if (closeit) fclose(fp); - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif return run_err_node(n, filename, globals, locals, flags); } --- 1255,1264 ---- *************** *** 1276,1287 **** PyCompilerFlags *flags) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif if (n == NULL) return NULL; - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif return run_node(n, filename, globals, locals, flags); } --- 1268,1275 ---- *************** *** 1291,1297 **** PyCompilerFlags *flags) { - #ifdef STACKLESS STACKLESS_GETARG(); - #endif PyCodeObject *co; PyObject *v; --- 1279,1283 ---- *************** *** 1300,1310 **** if (co == NULL) return NULL; - #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); - #endif v = PyEval_EvalCode(co, globals, locals); - #ifdef STACKLESS STACKLESS_ASSERT(); - #endif Py_DECREF(co); return v; --- 1286,1292 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:59:01 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:59:01 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/PCbuild pythoncore.dsp, 1.57, 1.58 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/PCbuild In directory centera.de:/tmp/cvs-serv5382/PCbuild Modified Files: pythoncore.dsp Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: pythoncore.dsp =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/PCbuild/pythoncore.dsp,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** pythoncore.dsp 29 Apr 2004 02:18:40 -0000 1.57 --- pythoncore.dsp 29 Apr 2004 17:58:58 -0000 1.58 *************** *** 133,249 **** # Begin Source File ! SOURCE=..\Stackless\cframeobject.c # End Source File # Begin Source File ! SOURCE=..\Stackless\channelobject.c # End Source File # Begin Source File ! SOURCE=..\Stackless\flextype.c # End Source File # Begin Source File ! SOURCE=..\Stackless\flextype.h # End Source File # Begin Source File ! SOURCE=..\Stackless\prickelpit.c # End Source File # Begin Source File ! SOURCE=..\Stackless\prickelpit.h # End Source File # Begin Source File ! SOURCE=..\Stackless\safe_pickle.c # End Source File # Begin Source File ! SOURCE=..\Stackless\scheduling.c # End Source File # Begin Source File ! SOURCE=..\Stackless\stackless_util.c # End Source File # Begin Source File ! SOURCE=..\Stackless\stacklessmodule.c # End Source File # Begin Source File ! SOURCE=..\Stackless\taskletobject.c # End Source File # Begin Source File ! SOURCE=..\Stackless\taskletobject.h # End Source File - # End Group - # Begin Group "core" - - # PROP Default_Filter "" # Begin Source File ! SOURCE=..\Stackless\slp_transfer.c # End Source File # Begin Source File ! SOURCE=..\Stackless\stackless.h # End Source File # Begin Source File ! SOURCE=..\Stackless\stackless_api.h # End Source File # Begin Source File ! SOURCE=..\Stackless\stackless_impl.h # End Source File # Begin Source File ! SOURCE=..\Stackless\stackless_structs.h # End Source File # Begin Source File ! SOURCE=..\Stackless\stackless_tstate.h # End Source File # Begin Source File ! SOURCE=..\Stackless\stackless_version.h # End Source File # Begin Source File ! SOURCE=..\Stackless\stacklesseval.c # End Source File ! # End Group ! # Begin Group "platf" ! # PROP Default_Filter "" # Begin Source File ! SOURCE=..\Stackless\slp_platformselect.h # End Source File # Begin Source File ! SOURCE=..\Stackless\switch_ppc_macosx.h # End Source File # Begin Source File ! SOURCE=..\Stackless\switch_ppc_unix.h # End Source File # Begin Source File ! SOURCE=..\Stackless\switch_s390_unix.h # End Source File # Begin Source File ! SOURCE=..\Stackless\switch_sparc_sun_gcc.h # End Source File # Begin Source File ! SOURCE=..\Stackless\switch_x86_msvc.h # End Source File # Begin Source File ! SOURCE=..\Stackless\switch_x86_unix.h # End Source File # End Group --- 133,257 ---- # Begin Source File ! SOURCE=..\Stackless\module\channelobject.c # End Source File # Begin Source File ! SOURCE=..\Stackless\module\channelobject.h # End Source File # Begin Source File ! SOURCE=..\Stackless\module\flextype.c # End Source File # Begin Source File ! SOURCE=..\Stackless\module\flextype.h # End Source File # Begin Source File ! SOURCE=..\Stackless\module\scheduling.c # End Source File # Begin Source File ! SOURCE=..\Stackless\module\stacklessmodule.c # End Source File # Begin Source File ! SOURCE=..\Stackless\module\taskletobject.c # End Source File # Begin Source File ! SOURCE=..\Stackless\module\taskletobject.h # End Source File + # End Group + # Begin Group "core" + + # PROP Default_Filter "" # Begin Source File ! SOURCE=..\Stackless\core\cframeobject.c # End Source File # Begin Source File ! SOURCE=..\Stackless\core\slp_transfer.c # End Source File # Begin Source File ! SOURCE=..\Stackless\stackless.h # End Source File # Begin Source File ! SOURCE=..\Stackless\stackless_api.h # End Source File # Begin Source File ! SOURCE=..\Stackless\core\stackless_impl.h # End Source File # Begin Source File ! SOURCE=..\Stackless\core\stackless_structs.h # End Source File # Begin Source File ! SOURCE=..\Stackless\core\stackless_tstate.h # End Source File # Begin Source File ! SOURCE=..\Stackless\core\stackless_util.c # End Source File # Begin Source File ! SOURCE=..\Stackless\core\stackless_version.h # End Source File # Begin Source File ! SOURCE=..\Stackless\core\stacklesseval.c # End Source File + # End Group + # Begin Group "platf" + + # PROP Default_Filter "" # Begin Source File ! SOURCE=..\Stackless\platf\slp_platformselect.h # End Source File # Begin Source File ! SOURCE=..\Stackless\platf\switch_ppc_macosx.h # End Source File ! # Begin Source File ! SOURCE=..\Stackless\platf\switch_ppc_unix.h ! # End Source File # Begin Source File ! SOURCE=..\Stackless\platf\switch_s390_unix.h # End Source File # Begin Source File ! SOURCE=..\Stackless\platf\switch_sparc_sun_gcc.h # End Source File # Begin Source File ! SOURCE=..\Stackless\platf\switch_x86_msvc.h # End Source File # Begin Source File ! SOURCE=..\Stackless\platf\switch_x86_unix.h # End Source File + # End Group + # Begin Group "pickling" + + # PROP Default_Filter "" # Begin Source File ! SOURCE=..\Stackless\pickling\prickelpit.c # End Source File # Begin Source File ! SOURCE=..\Stackless\pickling\prickelpit.h # End Source File # Begin Source File ! SOURCE=..\Stackless\pickling\safe_pickle.c # End Source File # End Group _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 19 18:14:48 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 19 Apr 2004 18:14:48 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless scheduling.c, 1.88, 1.89 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv18674/dev/Stackless Modified Files: scheduling.c Log Message: cleanup warnings Index: scheduling.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/scheduling.c,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** scheduling.c 19 Apr 2004 16:08:56 -0000 1.88 --- scheduling.c 19 Apr 2004 16:14:46 -0000 1.89 *************** *** 63,67 **** if (args != NULL) { PyObject *type, *value, *traceback, *ret; - PyThreadState *ts = PyThreadState_GET(); PyErr_Fetch(&type, &value, &traceback); ret = PyObject_Call(_slp_schedule_hook, args, NULL); --- 63,66 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 16 00:31:44 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 16 Apr 2004 00:31:44 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.2/src/Stackless/testbench testbench.cpp, 1.3, 1.4 Message-ID: Update of /home/cvs/slpdev/src/2.2/src/Stackless/testbench In directory centera.de:/tmp/cvs-serv27791/src/2.3/dev/Stackless/testbench Modified Files: testbench.cpp Log Message: a current, very wrong approach to embedding. Doesn't work, need rewrite, sorry. Index: testbench.cpp =================================================================== RCS file: /home/cvs/slpdev/src/2.2/src/Stackless/testbench/testbench.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testbench.cpp 6 Jan 2004 02:40:23 -0000 1.3 --- testbench.cpp 15 Apr 2004 22:31:42 -0000 1.4 *************** *** 7,25 **** ! // Dummy class ! class rFoo ! { ! public: ! rFoo() {} ! ! }; ! typedef struct { PyObject_HEAD ! rFoo *m_foo; } PyPythonScriptObject; ! static PyObject *PyPythonScript_NewScript(rFoo *script); static void PyPythonScript_DeallocScript(PyPythonScriptObject *pso); static PyObject *PyPythonScript_GetAttr(PyPythonScriptObject *self, char *name); --- 7,18 ---- ! class rTasklet; typedef struct { PyObject_HEAD ! rTasklet *m_foo; } PyPythonScriptObject; ! static PyObject *PyPythonScript_NewScript(rTasklet *script); static void PyPythonScript_DeallocScript(PyPythonScriptObject *pso); static PyObject *PyPythonScript_GetAttr(PyPythonScriptObject *self, char *name); *************** *** 48,52 **** static PyObject * ! PyPythonScript_NewScript(rFoo *foo) { PyPythonScriptObject *pso; --- 41,45 ---- static PyObject * ! PyPythonScript_NewScript(rTasklet *foo) { PyPythonScriptObject *pso; *************** *** 140,144 **** /* note: to switch back to windows mode, change * /subsystem:console back to ! * /subsystem:windows in the cofiguration window. */ --- 133,137 ---- /* note: to switch back to windows mode, change * /subsystem:console back to ! * /subsystem:windows in the configuration window. */ *************** *** 157,207 **** } ! #if 0 ! int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) ! #else ! int ! main(int argc, char **argv) ! #endif { ! char *msg = NULL; ! // 1. Init python and stackless ! Py_Initialize(); ! int code = Py_IsInitialized(); ! /* no threads needed */ ! // 2. Init execution wrapper ! PySW_InitWrapper(); ! // 3. Store this instances threadstate ! PyThreadState *m_interp = PyEval_SaveThread(); ! // 4. Each script will have its own interpreter ! PyEval_AcquireLock(); ! m_interp = Py_NewInterpreter(); ! PyThreadState_Swap(m_interp); ! // 5. Add extension module to test script execution ! rFoo foobar; ! PyPythonScript_Type.ob_type = &PyType_Type; ! PyObject *iface_class = PyPythonScript_NewScript(&foobar); ! PyImport_AddModule("simscript"); ! Py_InitModule4("simscript", PyPythonScript_methods, NULL, iface_class, PYTHON_API_VERSION); ! // 6. Use main ! PyObject *pName, *pModule, *pDict; ! pName = PyString_FromString("__main__"); ! pModule = PyImport_Import(pName); ! if (pModule != NULL) ! { - PySW_SetPath("C:\\codebase\\main\\development\\3rdparty\\stackless_wrapper\\testbench"); ! PyObject *stacklessmodule = PyImport_AddModule("stackless"); ! pDict = PyModule_GetDict(pModule); ! // 7. Compile code (below) ! char sourcecode[] = " \n\ \n\ import simscript \n\ --- 150,279 ---- } ! ! // Wrapper tasklet class ! class rTasklet { ! public: ! PyThreadState *m_interp; ! PyObject *m_script_code; ! PyObject *m_tasklet; ! public: ! rTasklet() ! { ! m_interp = Py_NewInterpreter(); ! PyThreadState_Swap(m_interp); ! PyPythonScript_Type.ob_type = &PyType_Type; ! PyObject *iface_class = PyPythonScript_NewScript(this); ! PyImport_AddModule("simscript"); ! Py_InitModule4("simscript", PyPythonScript_methods, NULL, iface_class, PYTHON_API_VERSION); ! PyObject *pName, *pModule, *pDict; ! pName = PyString_FromString("__main__"); ! pModule = PyImport_Import(pName); ! PySW_SetPath("C:\\codebase\\main\\development\\3rdparty\\stackless_wrapper\\testbench"); ! PyObject *stacklessmodule = PyImport_AddModule("stackless"); ! pDict = PyModule_GetDict(pModule); ! } ! void CompileAndExecuteMain( char* code ) ! { ! PyThreadState_Swap(m_interp); ! m_script_code = Py_CompileString(code, "pythoncode", Py_file_input); ! Py_INCREF(m_script_code); ! PyObject *mainobj = PyImport_ExecCodeModule("__main__", m_script_code); ! if( !mainobj ) ! PyErr_Print(); ! } ! PyObject *CreateTask(char* func_name ) ! { ! PyThreadState_Swap(m_interp); ! PyObject *pName, *pModule, *pDict; ! pName = PyString_FromString("__main__"); ! pModule = PyImport_Import(pName); ! pDict = PyModule_GetDict(pModule); ! m_tasklet = NULL; ! PyObject *func = PyDict_GetItemString(pDict, func_name); ! if (func && PyCallable_Check(func)) ! m_tasklet = PySW_CreateTasklet( func ); ! Py_XINCREF(m_tasklet); ! return m_tasklet; ! } ! void RunTask( char* msg ) ! { ! PyThreadState_Swap(m_interp); ! CPCE(PySW_RunTasklet(m_tasklet), msg); ! } ! ! void ContinueTask(char* msg ) ! { ! PyThreadState_Swap(m_interp); ! CPCE(PySW_ContinueTasklet(m_tasklet), msg); ! } ! ! void ResetTask(char* msg ) ! { ! PyThreadState_Swap(m_interp); ! CPCE(PySW_ResetTasklet(m_tasklet), msg); ! } ! ! ! void DeleteTask( char* msg ) ! { ! if( m_tasklet ) ! { ! PyThreadState_Swap(m_interp); ! CPCE(PySW_CleanupTasklet( m_tasklet ), msg); ! // Py_XDECREF(m_tasklet); ! m_tasklet = NULL; ! } ! } ! ! PyObject *GetTask() ! { ! return m_tasklet; ! } ! ! PyObject *GetFunction(char *func_name) ! { ! PyThreadState_Swap(m_interp); ! PyObject *pName, *pModule, *pDict; ! pName = PyString_FromString("__main__"); ! pModule = PyImport_Import(pName); ! pDict = PyModule_GetDict(pModule); ! return PyDict_GetItemString(pDict, func_name); ! } ! ! ! void Destroy( char* msg ) ! { ! ! PyThreadState *old_state = PyThreadState_Swap(m_interp); ! ! PyThreadState_Clear(m_interp); ! // Interpreter deletion deos not work yet! And it leakes now memory ... ! // PyThreadState_Swap(NULL); // Should not be required ... nobody has tested these python calls together ! // PyThreadState_Delete(m_interp); ! // PyThreadState_Swap(NULL); ! // PyThreadState_Swap(m_interp); ! // CPCE( true, msg); ! Py_EndInterpreter( m_interp ); ! ! } ! ! }; ! ! ! ! ! ! char sourcecode[] = " \n\ \n\ import simscript \n\ *************** *** 233,321 **** "; - PyObject *m_script_code = Py_CompileString(sourcecode, "pythoncode", Py_file_input); - Py_INCREF(m_script_code); - - if( m_script_code ) - { int *argll = (int*)_alloca(10000); - - for(int i=0; i<10; i++) - { ! // 8. And reload it as current main module for execution ! PyObject *mainobj = PyImport_ExecCodeModule("__main__", m_script_code); ! if( !mainobj ) ! PyErr_Print(); ! ! // 9. Init main tasklet ! /* this is done automatically */ ! // 10. Extract tasklet 1 method from script and create tasklet ! PyObject *task1 = NULL; ! PyObject *func = PyDict_GetItemString(pDict, "run1"); ! if (func && PyCallable_Check(func)) ! task1 = PySW_CreateTasklet( func ); ! // 11. Extract tasklet 2 method from script and create tasklet ! PyObject *task2 = NULL; ! func = PyDict_GetItemString(pDict, "run2"); ! if (func && PyCallable_Check(func)) ! task2 = PySW_CreateTasklet( func ); ! // 12. Execute tasklet 1 & 2 code till defined execution points ! if( task1 && task2 ) ! { ! msg = "13. Execute tasklet 1 till point \"A\""; ! CPCE(PySW_RunTasklet(task1), msg); ! msg = "14. Execute tasklet 2 till point \"C\""; ! CPCE(PySW_RunTasklet(task2), msg); ! msg = "15. Execute tasklet 1 till point \"B\""; ! CPCE(PySW_ContinueTasklet( task1 ), msg); ! ! msg = "16. Emulate interpreter switch"; ! /* CT dropped */ ! msg = "17. Call condition func in a middle of tasklet 1 execution"; ! PyObject *condf = PyDict_GetItemString(pDict, "condition_func"); ! printf("%s returns %d\n", msg, TestConditionFunction( condf )); ! ! msg = "18. Execute tasklet 2 till point \"D\""; ! CPCE(PySW_ContinueTasklet( task2 ), msg); ! msg = "19. Execute tasklet 1 till end"; ! CPCE(PySW_ContinueTasklet( task1 ), msg); ! msg = "20. Reset tasklet 1 execution"; ! CPCE(PySW_ResetTasklet( task1 ), msg); ! msg = "21. Cleanup tasklet 1 execution"; ! CPCE(PySW_CleanupTasklet( task1 ), msg); ! msg = "22. Cleanup tasklet 2 execution (suspended)"; ! CPCE(PySW_CleanupTasklet( task2 ), msg); ! } ! Py_XDECREF(task1); ! Py_XDECREF(task2); - } ! } ! else ! { ! // 21. Syntax error at script code ! PyErr_Print(); ! } } - // 22. Release execution context - /* CT dropped */ - - Py_Finalize(); return 0; } --- 305,380 ---- "; ! #if 0 ! int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) ! #else ! int ! main(int argc, char **argv) ! #endif ! { ! char *msg = NULL; ! // 1. Init python and stackless ! PyEval_InitThreads(); ! Py_Initialize(); ! int code = Py_IsInitialized(); ! /* no threads needed */ ! // 2. Init execution wrapper ! PySW_InitWrapper(); ! /* ! // 3. Store this instances threadstate ! PyThreadState *m_interp = PyEval_SaveThread(); ! // 4. Each script will have its own interpreter ! PyEval_AcquireLock(); ! m_interp = Py_NewInterpreter(); ! PyThreadState_Swap(m_interp); ! */ ! for( int loops = 0; loops<100; loops++) ! { ! // 5. Create two task objects (both contain independent interpreter and tasklet defs) ! rTasklet *task1 = new rTasklet(); ! rTasklet *task2 = new rTasklet(); ! // 6. Assign source code and execute main level for both tasklets objects ! task1->CompileAndExecuteMain( sourcecode ); ! task2->CompileAndExecuteMain( sourcecode ); ! // 7. Create new tasklet for both tasklet objects ! task1->CreateTask( "run1" ); ! task2->CreateTask( "run2" ); ! // 8. Start executing tasks in sequence ! task1->RunTask("8. Execute tasklet 1 till point \"A\""); ! task2->RunTask("9. Execute tasklet 2 till point \"C\""); ! task1->ContinueTask("10. Continue tasklet 1 till point \"B\""); ! /* CT dropped */ ! msg = "11. Call condition func in a middle of tasklet 1 execution"; ! PyObject *condf = task1->GetFunction("condition_func"); ! printf("%s returns %d\n", msg, TestConditionFunction( condf )); ! ! task2->ContinueTask("12. Continue tasklet 2 till point \"D\""); ! task1->ContinueTask("13. Continue tasklet 1 till end"); ! task1->ResetTask("14. Reset tasklet 1"); ! task1->DeleteTask("15. Delete tasklet 1"); + task2->DeleteTask("16. Delete tasklet 2 (suspended)"); ! task1->Destroy( "17. Destroy tasklet 1 internals (interpreter etc.)"); ! task2->Destroy( "18. Destroy tasklet 2 internals (interpreter etc.)"); + delete task1; + delete task2; } return 0; } _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 23:02:37 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 23:02:37 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/PCbuild pythoncore.dsp, 1.59, 1.60 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/PCbuild In directory centera.de:/tmp/cvs-serv12423/PCbuild Modified Files: pythoncore.dsp Log Message: making the Stackless folder version independent Index: pythoncore.dsp =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/PCbuild/pythoncore.dsp,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** pythoncore.dsp 29 Apr 2004 19:01:08 -0000 1.59 --- pythoncore.dsp 29 Apr 2004 21:02:34 -0000 1.60 *************** *** 133,136 **** --- 133,140 ---- # Begin Source File + SOURCE=..\Stackless\core\backwardcompat.h + # End Source File + # Begin Source File + SOURCE=..\Stackless\module\channelobject.c # End Source File _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 04:18:42 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 04:18:42 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless.h, 1.37, 1.38 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv16658/Stackless Modified Files: stackless.h Log Message: added a new Windows target for speed tests: STACKLESS_OFF is a new variable to build Python without stackless. ReleaseOff will compile with STACKLESS undefined. XXX add an option to the configure script! Index: stackless.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** stackless.h 7 Oct 2002 21:42:33 -0000 1.37 --- stackless.h 29 Apr 2004 02:18:40 -0000 1.38 *************** *** 36,40 **** */ #define STACKLESS ! #if defined(MS_WIN32) && !defined(MS_WIN64) && defined(_M_IX86) /* MS Visual Studio on X86 */ #elif defined(__GNUC__) && defined(__i386__) --- 36,44 ---- */ #define STACKLESS ! ! #ifdef STACKLESS_OFF ! #undef STACKLESS ! /* an option to switch it off */ ! #elif defined(MS_WIN32) && !defined(MS_WIN64) && defined(_M_IX86) /* MS Visual Studio on X86 */ #elif defined(__GNUC__) && defined(__i386__) _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 23 04:09:24 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 23 Apr 2004 04:09:24 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless prickelpit.c, 1.63, 1.64 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv7847/dev/Stackless Modified Files: prickelpit.c Log Message: small Linux probs... Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** prickelpit.c 23 Apr 2004 00:34:37 -0000 1.63 --- prickelpit.c 23 Apr 2004 02:09:22 -0000 1.64 *************** *** 94,98 **** PyObject_HEAD_INIT(&PyType_Type) \ 0, \ ! "stackless._wrap."##name, \ 0, \ 0, \ --- 94,98 ---- PyObject_HEAD_INIT(&PyType_Type) \ 0, \ ! "stackless._wrap." name, \ 0, \ 0, \ *************** *** 404,408 **** #define codetuplefmt "iiiiSOOOSSiSOO" ! static PyTypeObject wrap_PyCode_Type; static PyObject * --- 404,408 ---- #define codetuplefmt "iiiiSOOOSSiSOO" ! static struct _typeobject wrap_PyCode_Type; static PyObject * *************** *** 1775,1778 **** --- 1775,1782 ---- if (PyObject_SetAttrString(pickler, "module_dict_ids", modict)) goto finally; } + if (!PyDict_Check(modict)) { + PyErr_SetString(PyExc_TypeError, "pickler: module_dict_ids is not a dictionary"); + goto finally; + } { PyObject *thisid = PyLong_FromVoidPtr(self); _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 19 18:08:58 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 19 Apr 2004 18:08:58 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless cframeobject.c, 1.64, 1.65 safe_pickle.c, 1.1, 1.2 scheduling.c, 1.87, 1.88 slp_transfer.c, 1.17, 1.18 stackless_impl.h, 1.80, 1.81 taskletobject.c, 1.106, 1.107 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv18125/dev/Stackless Modified Files: cframeobject.c safe_pickle.c scheduling.c slp_transfer.c stackless_impl.h taskletobject.c Log Message: safe unpickling is complete, now, even in the case that Stackless was not initialized. I also implemented safe unpickling, but how bad, this was not needed since the unpickling engine is non-recursive :-) Index: cframeobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/cframeobject.c,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** cframeobject.c 18 Apr 2004 14:07:33 -0000 1.64 --- cframeobject.c 19 Apr 2004 16:08:56 -0000 1.65 *************** *** 25,28 **** --- 25,31 ---- * the extract_stack function, there is a couple of * computed attributes provided. + * + * XXX this is no longer true, baseframes don't show up in frame + * chains any longer. Future target: use thunks, instead. */ Index: safe_pickle.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/safe_pickle.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** safe_pickle.c 18 Apr 2004 19:51:27 -0000 1.1 --- safe_pickle.c 19 Apr 2004 16:08:56 -0000 1.2 *************** *** 6,9 **** --- 6,11 ---- #include "stackless_impl.h" + /* safe pickling */ + static int(*cPickle_save)(PyObject *, PyObject *, int) = NULL; *************** *** 23,46 **** ts->frame = f->f_back; Py_DECREF(f); ! slp_transfer(NULL, cst, NULL); /* never come here */ return NULL; } ! int slp_safe_pickling(int(*save)(PyObject *, PyObject *, int), ! PyObject *self, PyObject *args, int pers_save) { PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *cur = ts->st.current; - PyCStackObject *cst = cur->cstate; PyCStackObject *stub = ts->st.initial_stub; PyObject *retval = NULL; int ret = -1; ! PyObject *cb_args = Py_BuildValue("OOi", self, args, pers_save); PyBaseFrameObject *bf = NULL; if (cb_args == NULL) goto finally; ! cPickle_save = save; cur->tempval = cb_args; bf = slp_baseframe_new(pickle_callback, 1, 0); --- 25,58 ---- ts->frame = f->f_back; Py_DECREF(f); ! slp_transfer_return(cst); /* never come here */ return NULL; } ! static int pickle_M(PyObject *self, PyObject *args, int pers_save); ! ! int ! slp_safe_pickling(int(*save)(PyObject *, PyObject *, int), ! PyObject *self, PyObject *args, int pers_save) { PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *cur = ts->st.current; PyCStackObject *stub = ts->st.initial_stub; PyObject *retval = NULL; int ret = -1; ! PyObject *cb_args = NULL; PyBaseFrameObject *bf = NULL; + PyCStackObject *cst; + + cPickle_save = save; + + if (ts->st.main == NULL) + return pickle_M(self, args, pers_save); + + cb_args = Py_BuildValue("OOi", self, args, pers_save); if (cb_args == NULL) goto finally; ! cur->tempval = cb_args; bf = slp_baseframe_new(pickle_callback, 1, 0); *************** *** 48,54 **** goto finally; ts->frame = (PyFrameObject *) bf; cur->cstate = NULL; if (slp_transfer(&cur->cstate, stub, cur)) ! goto finally; Py_XDECREF(cur->cstate); cur->cstate = cst; --- 60,67 ---- goto finally; ts->frame = (PyFrameObject *) bf; + cst = cur->cstate; cur->cstate = NULL; if (slp_transfer(&cur->cstate, stub, cur)) ! return -1; /* fatal */ Py_XDECREF(cur->cstate); cur->cstate = cst; *************** *** 65,67 **** --- 78,113 ---- } + /* safe unpickling is not needed */ + + + /* + * the following stuff is only needed in the rare case that we are + * run without any initialisation. In this case, we don't save stack + * but use slp_eval_frame, which initializes everything. + */ + + static PyObject *_self, *_args; + static int _pers_save; + + static PyObject * + pickle_runmain(PyFrameObject *f, PyObject *retval) + { + PyThreadState *ts = PyThreadState_GET(); + Py_XDECREF(retval); + ts->frame = f->f_back; + Py_DECREF(f); + return PyInt_FromLong(cPickle_save(_self, _args, _pers_save)); + } + + static int + pickle_M(PyObject *self, PyObject *args, int pers_save) + { + PyBaseFrameObject *bf = slp_baseframe_new(pickle_runmain, 0, 0); + if (bf == NULL) return -1; + _self = self; + _args = args; + _pers_save = pers_save; + return slp_int_wrapper(slp_eval_frame((PyFrameObject *)bf)); + } + #endif Index: scheduling.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/scheduling.c,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** scheduling.c 18 Apr 2004 14:07:33 -0000 1.87 --- scheduling.c 19 Apr 2004 16:08:56 -0000 1.88 *************** *** 416,420 **** if (ts->st.serial_last_jump != ts->st.serial) { task->tempval = retval; ! slp_transfer(NULL, ts->st.current->cstate, NULL); } /* this hack can attach us to ourselves :( */ --- 416,420 ---- if (ts->st.serial_last_jump != ts->st.serial) { task->tempval = retval; ! slp_transfer_return(ts->st.current->cstate); } /* this hack can attach us to ourselves :( */ Index: slp_transfer.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/slp_transfer.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** slp_transfer.c 29 Mar 2004 00:04:45 -0000 1.17 --- slp_transfer.c 19 Apr 2004 16:08:56 -0000 1.18 *************** *** 106,108 **** --- 106,113 ---- } + int + slp_transfer_return(PyCStackObject *cst) + { + return slp_transfer(NULL, cst, NULL); + } #endif Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** stackless_impl.h 18 Apr 2004 19:51:27 -0000 1.80 --- stackless_impl.h 19 Apr 2004 16:08:56 -0000 1.81 *************** *** 48,51 **** --- 48,58 ---- PyAPI_FUNC(int) slp_transfer(PyCStackObject **cstprev, PyCStackObject *cst, PyTaskletObject *prev); + #ifdef Py_DEBUG + PyAPI_FUNC(int) slp_transfer_return(PyCStackObject *cst); + #else + #define slp_transfer_return(cst) \ + slp_transfer(NULL, (cst), NULL) + #endif + PyAPI_FUNC(int) _PyStackless_InitTypes(void); PyAPI_FUNC(void) _PyStackless_Init(void); Index: taskletobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/taskletobject.c,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** taskletobject.c 18 Apr 2004 14:07:33 -0000 1.106 --- taskletobject.c 19 Apr 2004 16:08:56 -0000 1.107 *************** *** 197,205 **** PyTaskletObject * PyTasklet_New(PyTypeObject *type, PyObject *func) { PyTaskletObject *t; ! if (func != NULL && !PyCallable_Check(func)) return TYPE_ERROR("tasklet function must be a callable", NULL); --- 197,215 ---- + static PyTaskletObject * + PyTasklet_New_M(PyTypeObject *type, PyObject *func) + { + char *fmt = "(O)"; + if (func == NULL) fmt = NULL; + return (PyTaskletObject *) PyStackless_CallMethod_Main((PyObject*)type, "__call__", fmt, func); + } + PyTaskletObject * PyTasklet_New(PyTypeObject *type, PyObject *func) { + PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *t; ! /* we always need a cstate, so be sure to initialize */ ! if (ts->st.initial_stub == NULL) return PyTasklet_New_M(type, func); if (func != NULL && !PyCallable_Check(func)) return TYPE_ERROR("tasklet function must be a callable", NULL); *************** *** 220,224 **** } Py_XINCREF(func); ! t->cstate = PyThreadState_GET()->st.initial_stub; Py_INCREF(t->cstate); return t; --- 230,234 ---- } Py_XINCREF(func); ! t->cstate = ts->st.initial_stub; Py_INCREF(t->cstate); return t; _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From gherman at centera.de Thu Apr 22 08:24:31 2004 From: gherman at centera.de (Dinu Gherman) Date: Thu, 22 Apr 2004 08:24:31 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/unittests test_tasklet_become.py, 1.2, 1.3 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/unittests In directory centera.de:/tmp/cvs-serv11342 Modified Files: test_tasklet_become.py Log Message: Made kind of working in silent mode. Replaced tabs. Index: test_tasklet_become.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/unittests/test_tasklet_become.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_tasklet_become.py 18 Apr 2004 14:00:30 -0000 1.2 --- test_tasklet_become.py 22 Apr 2004 06:24:29 -0000 1.3 *************** *** 1,36 **** import unittest ! """Unsure, if an explicit tasklet.become(tasklet()) should be tested. """ - from sys import stdout - from stackless import * class TestTaskletBecome(unittest.TestCase): ! def testSimpleTaskletBecome(self): ! def f(ch): ! print "\tBecoming a tasklet inside f(ch)" ! #become_tasklet() ! got = tasklet().capture(42) ! yum = repr(got) ! print "\tCaptured inside f(ch):", yum ! print "message received: " + ch.receive() ! print "\tFunction f(ch) finished" ! ch = channel() ! print ! print "First in main(TestTaskletBecome):", ! foo = getcurrent() ! print foo ! print "Now calling a function f(ch)" ! bar = f(ch) ! print "Back in main(TestTaskletBecome):",bar ! ch.send("Did it work out right?") ! self.assertEquals(42,bar) if __name__ == '__main__': ! import sys ! if not sys.argv[1:]: ! sys.argv.append('-v') ! unittest.main() ! ! --- 1,39 ---- + """Unsure, if an explicit tasklet.become(tasklet()) should be tested.""" + import unittest ! import sys ! from stackless import tasklet, channel, getcurrent ! ! VERBOSE = False class TestTaskletBecome(unittest.TestCase): ! def testSimpleTaskletBecome(self): ! def f(ch): ! if VERBOSE: print "\tBecoming a tasklet inside f(ch)" ! #become_tasklet() ! got = tasklet().capture(42) ! yum = repr(got) ! res = ch.receive() ! if VERBOSE: ! print "\tCaptured inside f(ch):", yum ! print "message received: " + res ! print "\tFunction f(ch) finished" ! ch = channel() ! if VERBOSE: ! print ! print "First in main(TestTaskletBecome):", ! foo = getcurrent() ! if VERBOSE: ! print foo ! print "Now calling a function f(ch)" ! bar = f(ch) ! if VERBOSE: print "Back in main(TestTaskletBecome):", bar ! ch.send("Did it work out right?") ! self.assertEquals(42, bar) if __name__ == '__main__': ! if not sys.argv[1:]: sys.argv.append('-v') ! unittest.main() _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 04:27:25 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 04:27:25 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/src/Stackless scheduling.c, 1.86, 1.87 Message-ID: Update of /home/cvs/slpdev/src/2.3/src/Stackless In directory centera.de:/tmp/cvs-serv17049/src/Stackless Modified Files: scheduling.c Log Message: small patch to make non-rec trivial scheduling work. Index: scheduling.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/src/Stackless/scheduling.c,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** scheduling.c 7 Apr 2004 17:32:19 -0000 1.86 --- scheduling.c 29 Apr 2004 02:27:23 -0000 1.87 *************** *** 229,232 **** --- 229,234 ---- PyThreadState *ts = PyThreadState_GET(); + if (prev == next) + return 0; if (!slp_enable_softswitch) return 0; _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From gherman at centera.de Thu Apr 22 09:05:01 2004 From: gherman at centera.de (Dinu Gherman) Date: Thu, 22 Apr 2004 09:05:01 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/unittests test_sched_cb.py, NONE, 1.1 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/unittests In directory centera.de:/tmp/cvs-serv12418 Added Files: test_sched_cb.py Log Message: Initial checkin, mostly like test/test_set_schedule_callback.py. --- NEW FILE: test_sched_cb.py --- import unittest import stackless class SchedulingMonitor: "A scheduling monitor acting as a callback for set_schedule_callback()." def __init__(self): self.count = 0 def __call__(self, prevTasklet, nextTasklet): self.count += 1 class SchedulingCallbackTestCase(unittest.TestCase): "A collection of scheduling callback tests." def test0(self): "Test #callbacks before and after running isolated monitor." mon1 = SchedulingMonitor() stackless.set_schedule_callback(mon1) stackless.tasklet(stackless.test_cframe)(3) stackless.tasklet(stackless.test_cframe)(3) # precondition self.failUnless( mon1.count == 0, "No callbacks before running") # running stackless.run() # postcondition self.failUnless( mon1.count >= 2*3, "At least as may callbacks as many test_cframe calls") def test1(self): "Test multiple monitors, from test/test_set_schedule_callback.py" fu = self.failUnless n = 2 mon1 = SchedulingMonitor() stackless.set_schedule_callback(mon1) v = 3 for i in range(n): stackless.tasklet(stackless.test_cframe)(v) c1 = mon1.count fu(c1 == 0, "No callbacks before running") stackless.run() c1 = mon1.count fu(c1 >= n*v, "At least as may callbacks as many test_cframe calls") mon2 = SchedulingMonitor() stackless.set_schedule_callback(mon2) v = 5 for i in range(n): stackless.tasklet(stackless.test_cframe)(v) stackless.run() c2 = mon2.count fu(c2 >= n*v, "At least as may callbacks as many test_cframe calls") fu(mon1.count == c1, "No calls to previous callback") fu(c2 > c1, "More test_cframe calls => more callbacks on second run") stackless.set_schedule_callback(None) v = 7 for i in range(n): stackless.tasklet(stackless.test_cframe)(v) stackless.run() c1p = mon1.count c2p = mon2.count fu(c1p == c1, "No calls to previous callback after setting it to None") fu(c2p == c2, "No calls to previous callback after setting it to None") if __name__ == "__main__": unittest.main() _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:59:01 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:59:01 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/module channelobject.c, 1.43, 1.44 scheduling.c, 1.91, 1.92 stacklessmodule.c, 1.167, 1.168 taskletobject.c, 1.109, 1.110 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/module In directory centera.de:/tmp/cvs-serv5382/Stackless/module Modified Files: channelobject.c scheduling.c stacklessmodule.c taskletobject.c Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: channelobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/module/channelobject.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** channelobject.c 29 Apr 2004 02:41:22 -0000 1.43 --- channelobject.c 29 Apr 2004 17:58:59 -0000 1.44 *************** *** 8,12 **** #ifdef STACKLESS ! #include "stackless_impl.h" #include "channelobject.h" --- 8,12 ---- #ifdef STACKLESS ! #include "core/stackless_impl.h" #include "channelobject.h" Index: scheduling.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/module/scheduling.c,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** scheduling.c 29 Apr 2004 02:41:22 -0000 1.91 --- scheduling.c 29 Apr 2004 17:58:59 -0000 1.92 *************** *** 2,6 **** #ifdef STACKLESS ! #include "stackless_impl.h" /******************************************************************* --- 2,6 ---- #ifdef STACKLESS ! #include "core/stackless_impl.h" /******************************************************************* Index: stacklessmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/module/stacklessmodule.c,v retrieving revision 1.167 retrieving revision 1.168 diff -C2 -d -r1.167 -r1.168 *** stacklessmodule.c 29 Apr 2004 02:41:22 -0000 1.167 --- stacklessmodule.c 29 Apr 2004 17:58:59 -0000 1.168 *************** *** 4,15 **** #ifdef STACKLESS ! #include "stackless_impl.h" #define IMPLEMENT_STACKLESSMODULE ! #include "slp_platformselect.h" ! #include "cframeobject.h" #include "taskletobject.h" #include "channelobject.h" ! #include "prickelpit.h" /****************************************************** --- 4,15 ---- #ifdef STACKLESS ! #include "core/stackless_impl.h" #define IMPLEMENT_STACKLESSMODULE ! #include "platf/slp_platformselect.h" ! #include "core/cframeobject.h" #include "taskletobject.h" #include "channelobject.h" ! #include "pickling/prickelpit.h" /****************************************************** Index: taskletobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/module/taskletobject.c,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** taskletobject.c 29 Apr 2004 02:41:22 -0000 1.109 --- taskletobject.c 29 Apr 2004 17:58:59 -0000 1.110 *************** *** 8,13 **** #ifdef STACKLESS ! #include "stackless_impl.h" ! #include "taskletobject.h" void --- 8,13 ---- #ifdef STACKLESS ! #include "core/stackless_impl.h" ! #include "module/taskletobject.h" void _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 5 21:09:20 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 05 Apr 2004 21:09:20 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python ceval.c, 1.77, 1.78 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv6874/Python Modified Files: ceval.c Log Message: still trying to convince gcc not to blather... Index: ceval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/ceval.c,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** ceval.c 5 Apr 2004 17:17:36 -0000 1.77 --- ceval.c 5 Apr 2004 19:09:18 -0000 1.78 *************** *** 2680,2684 **** --- 2680,2686 ---- PyObject **defs, int defcount, PyObject *closure) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif register PyFrameObject *f; register PyObject *retval = NULL; _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From gherman at centera.de Thu Apr 22 08:47:45 2004 From: gherman at centera.de (Dinu Gherman) Date: Thu, 22 Apr 2004 08:47:45 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/unittests test_pickle.py, 1.8, 1.9 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/unittests In directory centera.de:/tmp/cvs-serv11761 Modified Files: test_pickle.py Log Message: Added abstract base class plus verbosity option. Index: test_pickle.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/unittests/test_pickle.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_pickle.py 24 Mar 2004 16:27:08 -0000 1.8 --- test_pickle.py 22 Apr 2004 06:47:43 -0000 1.9 *************** *** 1,9 **** import unittest import cPickle as pickle - import types ! from stackless import * glist = [] def accumulate(ident, func, *args): rval = (ident, func(*args)) --- 1,13 ---- + import sys + import types import unittest import cPickle as pickle ! from stackless import schedule, tasklet ! + VERBOSE = False glist = [] + def accumulate(ident, func, *args): rval = (ident, func(*args)) *************** *** 17,21 **** def reset(): ! glist[:] =[] def rectest(nrec, lev=0, lst=None): --- 21,25 ---- def reset(): ! glist[:] = [] def rectest(nrec, lev=0, lst=None): *************** *** 31,35 **** def listtest(n, when): for i in range(n): ! if i==when: schedule() return i --- 35,39 ---- def listtest(n, when): for i in range(n): ! if i == when: schedule() return i *************** *** 42,46 **** def enumeratetest(n, when): ! for i,ig in enumerate([None] * n): if i == when: schedule() --- 46,50 ---- def enumeratetest(n, when): ! for i, ig in enumerate([None] * n): if i == when: schedule() *************** *** 80,84 **** return i ! class TestTasklets(unittest.TestCase): def testGenerator(self): self.run_pickled(genoutertest, 20, 13) --- 84,132 ---- return i ! ! class TestPickledTasklets(unittest.TestCase): ! def setUp(self): ! self.verbose = VERBOSE ! ! def tearDown(self): ! del self.verbose ! ! def run_pickled(self, func, *args): ! ident = object() ! t = tasklet(accumulate)(ident, func, *args) ! ! # clear out old errors ! reset() ! ! if self.verbose: print "starting tasklet" ! t.run() ! ! self.assertEquals(is_empty(), True) ! ! # do we want to do this?? ! #t.tempval = None ! ! if self.verbose: print "pickling" ! pi = pickle.dumps(t) ! ! # if self.verbose: print repr(pi) ! # why do we want to remove it? ! # t.remove() ! ! if self.verbose: print "unpickling" ! ip = pickle.loads(pi) ! ! if self.verbose: print "starting unpickled tasklet" ! ip.run() ! new_ident, new_rval = get_result() ! t.run() ! old_ident, old_rval = get_result() ! self.assertEquals(old_ident, ident) ! self.assertEquals(new_rval, old_rval) ! self.assertNotEquals(new_ident, old_ident) ! self.assertEquals(is_empty(), True) ! ! ! class TestConcretePickledTasklets(TestPickledTasklets): def testGenerator(self): self.run_pickled(genoutertest, 20, 13) *************** *** 106,117 **** def testRecursiveLambda(self): ! recurse = lambda self, next: next-1 and self(self, next-1) or (schedule(),42)[1] pickle.loads(pickle.dumps(recurse)) self.run_pickled(recurse, recurse, 13) def testRecursiveEmbedded(self): - def rectest(nrec, lev=0): ! print nrec, lev if lev < nrec: rectest(nrec, lev+1) --- 154,165 ---- def testRecursiveLambda(self): ! recurse = lambda self, next: \ ! next-1 and self(self, next-1) or (schedule(), 42)[1] pickle.loads(pickle.dumps(recurse)) self.run_pickled(recurse, recurse, 13) def testRecursiveEmbedded(self): def rectest(nrec, lev=0): ! if self.verbose: print nrec, lev if lev < nrec: rectest(nrec, lev+1) *************** *** 122,163 **** def testFakeModules(self): types.ModuleType('fakemodule!') - - def run_pickled(self, func, *args): - ident = object() - t = tasklet(accumulate)(ident, func, *args) - - # clear out old errors - reset() - - print "starting tasklet" - t.run() - self.assertEquals(is_empty(), True) - - # do we want to do this?? - #t.tempval = None - - print "pickling" - pi = pickle.dumps(t) - - # print repr(pi) - # why do we want to remove it? - # t.remove() - - print "unpickling" - ip = pickle.loads(pi) - - print "starting unpickled tasklet" - ip.run() - new_ident, new_rval = get_result() - t.run() - old_ident, old_rval = get_result() - self.assertEquals(old_ident, ident) - self.assertEquals(new_rval, old_rval) - self.assertNotEquals(new_ident, old_ident) - self.assertEquals(is_empty(), True) if __name__ == '__main__': - import sys if not sys.argv[1:]: sys.argv.append('-v') --- 170,176 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 17:14:39 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 17:14:39 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless prickelpit.c, 1.57, 1.58 stackless_impl.h, 1.78, 1.79 stacklessmodule.c, 1.161, 1.162 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv28229/src/2.3/dev/Stackless Modified Files: prickelpit.c stackless_impl.h stacklessmodule.c Log Message: small corrections to the release build. Added pickling of xrange objects as well. Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** prickelpit.c 18 Apr 2004 14:07:33 -0000 1.57 --- prickelpit.c 18 Apr 2004 15:14:37 -0000 1.58 *************** *** 1429,1432 **** --- 1429,1480 ---- /****************************************************** + pickling of rangeiter + + ******************************************************/ + + /* + * unfortunately we have to copy here. + * XXX automate checking such situations. + */ + + typedef struct { + PyObject_HEAD + long start; + long step; + long len; + } rangeobject; + + + static PyObject * + range_reduce(rangeobject *r) + { + PyObject *tup, *typ; + + assert(r != NULL); + typ = PyObject_Type((PyObject *)r); + tup = Py_BuildValue("(O(lll))", + typ, + r->start, + r->start + r->len * r->step, + r->step + ); + Py_DECREF(typ); + return tup; + } + + static struct PyMethodDef range_methods[] = { + {"__reduce__", (PyCFunction)range_reduce, METH_NOARGS, + "r.__reduce__() -- reduce xrange for pickling"}, + {NULL, NULL} /* Sentinel */ + }; + + static int init_rangetype(void) + { + return init_type(&PyRange_Type, range_methods, NULL); + } + + + /****************************************************** + source module initialization *************** *** 1451,1454 **** --- 1499,1503 ---- || init_rangeitertype() || init_tupleitertype() + || init_rangetype() ) return -1; return 0; Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** stackless_impl.h 18 Apr 2004 14:07:33 -0000 1.78 --- stackless_impl.h 18 Apr 2004 15:14:37 -0000 1.79 *************** *** 95,98 **** --- 95,100 ---- /* fast (release) and safe (debug) access to the unwind token and retval */ + #ifdef Py_DEBUG + #define STACKLESS_PACK(retval) \ (assert(Py_UnwindToken->tempval == NULL), \ *************** *** 100,112 **** (PyObject *) Py_UnwindToken) - #ifdef Py_DEBUG - #define STACKLESS_UNPACK(retval) \ (assert(STACKLESS_UNWINDING(retval)), \ retval = Py_UnwindToken->tempval, \ Py_UnwindToken->tempval = NULL, retval) #else ! #define STACKLESS_UNPACK(token, retval) \ ! (retval = (token)->tempval, retval) #endif --- 102,119 ---- (PyObject *) Py_UnwindToken) #define STACKLESS_UNPACK(retval) \ (assert(STACKLESS_UNWINDING(retval)), \ retval = Py_UnwindToken->tempval, \ Py_UnwindToken->tempval = NULL, retval) + #else ! ! #define STACKLESS_PACK(retval) \ ! (Py_UnwindToken->tempval = (retval), \ ! (PyObject *) Py_UnwindToken) ! ! #define STACKLESS_UNPACK(retval) \ ! (retval = Py_UnwindToken->tempval, retval) ! #endif Index: stacklessmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklessmodule.c,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** stacklessmodule.c 18 Apr 2004 14:07:33 -0000 1.161 --- stacklessmodule.c 18 Apr 2004 15:14:37 -0000 1.162 *************** *** 931,934 **** --- 931,935 ---- INSERT("rangeiterator", &Pyrangeiter_Type); INSERT("tupleiterator", &PyTupleIter_Type); + INSERT("xrange", &PyRange_Type); /* module dicts */ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:36:48 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:36:48 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Objects classobject.c, 1.15, 1.16 descrobject.c, 1.11, 1.12 funcobject.c, 1.9, 1.10 methodobject.c, 1.7, 1.8 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Objects In directory centera.de:/tmp/cvs-serv11129/Objects Modified Files: classobject.c descrobject.c funcobject.c methodobject.c Log Message: some more refinements according to PEP 7 Index: classobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/classobject.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** classobject.c 24 Apr 2004 03:42:41 -0000 1.15 --- classobject.c 24 Apr 2004 23:36:46 -0000 1.16 *************** *** 2488,2494 **** 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL,/* tp_flags */ #else ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ #endif instancemethod_doc, /* tp_doc */ --- 2488,2495 ---- 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | ! Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ #endif instancemethod_doc, /* tp_doc */ Index: descrobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/descrobject.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** descrobject.c 24 Apr 2004 23:29:39 -0000 1.11 --- descrobject.c 24 Apr 2004 23:36:46 -0000 1.12 *************** *** 424,428 **** 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ --- 424,429 ---- 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | ! Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ *************** *** 467,471 **** 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ --- 468,473 ---- 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | ! Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ *************** *** 585,589 **** 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ --- 587,592 ---- 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | ! Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ *************** *** 972,977 **** #define WRAP_RETURN(call) { \ PyObject * retval; \ ! STACKLESS_PROMOTE_FLAG(wp->descr->d_base->flags & PyWrapperFlag_STACKLESS \ ! && wp->descr->d_type->tp_flags & Py_TPFLAGS_HAVE_STACKLESS_CALL); \ retval = (call); \ STACKLESS_ASSERT(); \ --- 975,981 ---- #define WRAP_RETURN(call) { \ PyObject * retval; \ ! STACKLESS_PROMOTE_FLAG( \ ! wp->descr->d_base->flags & PyWrapperFlag_STACKLESS && \ ! wp->descr->d_type->tp_flags & Py_TPFLAGS_HAVE_STACKLESS_CALL); \ retval = (call); \ STACKLESS_ASSERT(); \ *************** *** 1052,1056 **** 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ --- 1056,1061 ---- 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | ! Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ Index: funcobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/funcobject.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** funcobject.c 24 Apr 2004 23:29:39 -0000 1.9 --- funcobject.c 24 Apr 2004 23:36:46 -0000 1.10 *************** *** 550,554 **** 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL,/* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ --- 550,555 ---- 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | ! Py_TPFLAGS_HAVE_STACKLESS_CALL,/* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ Index: methodobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/methodobject.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** methodobject.c 5 Apr 2004 14:47:13 -0000 1.7 --- methodobject.c 24 Apr 2004 23:36:46 -0000 1.8 *************** *** 282,286 **** 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL,/* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ --- 282,287 ---- 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | ! Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 23 02:34:39 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 23 Apr 2004 02:34:39 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Modules cPickle.c, 1.9, 1.10 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Modules In directory centera.de:/tmp/cvs-serv4949/dev/Modules Modified Files: cPickle.c Log Message: I did a complete rewrite of Stackless pickling. There is *no longer* any patched type. All post-pickled builtin types are now installed into copy_reg. This is done through a module _wrap in stackless. The implementation use sshadow type objects which act like the real types, but they have __reduce__, __new__, __setstate__. This works just great now. One missing spot is pickleing of def f():yield 42 pickle.dumps(type(f()).next) This needs a slot wrapper which is missing. Besides that, I have thought out a second rewrite of pickling which uses a simple special object, which is much smaller and can serve the same service. This will generalize pickling even much more and will make it easier to adopt to all those many new types in Zope, for instance. Stay tuned! Index: cPickle.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Modules/cPickle.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** cPickle.c 20 Apr 2004 00:30:42 -0000 1.9 --- cPickle.c 23 Apr 2004 00:34:37 -0000 1.10 *************** *** 347,350 **** --- 347,353 ---- int fast_container; /* count nested container dumps */ PyObject *fast_memo; + #ifdef STACKLESS + PyObject *module_dict_ids; + #endif } Picklerobject; *************** *** 1731,1734 **** --- 1734,1751 ---- PyObject *iter; + #ifdef STACKLESS + { + static int + save_reduce(Picklerobject *self, PyObject *args, PyObject *ob); + PyObject *ret = PyStackless_Pickle_ModuleDict((PyObject *) self, args); + if (ret == NULL) return -1; + if (ret != Py_None) { + res = save_reduce(self, ret, args); + Py_DECREF(ret); + return res; + } + Py_DECREF(ret); + } + #endif if (self->fast && !fast_save_enter(self, args)) goto finally; *************** *** 2783,2786 **** --- 2800,2806 ---- self->buf_size = 0; self->dispatch_table = NULL; + #ifdef STACKLESS + self->module_dict_ids = NULL; + #endif self->file = NULL; *************** *** 2894,2897 **** --- 2914,2920 ---- Py_XDECREF(self->dispatch_table); PyMem_Free(self->write_buf); + #ifdef STACKLESS + Py_XDECREF(self->module_dict_ids); + #endif self->ob_type->tp_free((PyObject *)self); } *************** *** 2915,2918 **** --- 2938,2944 ---- VISIT(self->inst_pers_func); VISIT(self->dispatch_table); + #ifdef STACKLESS + VISIT(self->module_dict_ids); + #endif #undef VISIT return 0; *************** *** 2931,2934 **** --- 2957,2963 ---- CLEAR(self->inst_pers_func); CLEAR(self->dispatch_table); + #ifdef STACKLESS + CLEAR(self->module_dict_ids); + #endif #undef CLEAR return 0; *************** *** 3001,3004 **** --- 3030,3063 ---- } + #ifdef STACKLESS + static PyObject * + Pickler_get_module_dict_ids(Picklerobject *p) + { + if (p->module_dict_ids == NULL) + PyErr_SetString(PyExc_AttributeError, "module_dict_ids"); + else + Py_INCREF(p->module_dict_ids); + return p->module_dict_ids; + } + + static int + Pickler_set_module_dict_ids(Picklerobject *p, PyObject *v) + { + if (v == NULL) { + PyErr_SetString(PyExc_TypeError, + "attribute deletion is not supported"); + return -1; + } + if (!PyDict_Check(v)) { + PyErr_SetString(PyExc_TypeError, "module-dict-ids must be a dictionary"); + return -1; + } + Py_XDECREF(p->module_dict_ids); + Py_INCREF(v); + p->module_dict_ids = v; + return 0; + } + #endif + static PyObject * Pickler_get_error(Picklerobject *p) *************** *** 3021,3024 **** --- 3080,3086 ---- {"memo", (getter)Pickler_get_memo, (setter)Pickler_set_memo}, {"PicklingError", (getter)Pickler_get_error, NULL}, + #ifdef STACKLESS + {"module_dict_ids", (getter)Pickler_get_module_dict_ids, (setter)Pickler_set_module_dict_ids}, + #endif {NULL} }; _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 04:22:17 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 04:22:17 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless cframeobject.c, 1.66, 1.67 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv16822/Stackless Modified Files: cframeobject.c Log Message: make sure to consume the retval Index: cframeobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/cframeobject.c,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** cframeobject.c 24 Apr 2004 23:29:39 -0000 1.66 --- cframeobject.c 29 Apr 2004 02:22:15 -0000 1.67 *************** *** 198,205 **** if (retval == NULL) goto exit_run_cframe; ! if (c->callable == NULL) { /* we were left by a soft call */ } else { STACKLESS_PROPOSE_ALL(); retval = PyObject_Call(c->callable, c->args, c->kwds); --- 198,206 ---- if (retval == NULL) goto exit_run_cframe; ! if (c->callable == NULL) { /* we were left by a soft call */ } else { + Py_DECREF(retval); STACKLESS_PROPOSE_ALL(); retval = PyObject_Call(c->callable, c->args, c->kwds); _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Wed Apr 7 19:32:21 2004 From: tismer at centera.de (Christian Tismer) Date: Wed, 07 Apr 2004 19:32:21 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/src/Python exceptions.c, 1.3, 1.4 Message-ID: Update of /home/cvs/slpdev/src/2.3/src/Python In directory centera.de:/tmp/cvs-serv16188/src/2.3/src/Python Modified Files: exceptions.c Log Message: cured a really bad bug in the Windows stack switching code. This turned up, after I de-virtualized the cstack operations, and less registers were used. Also clarified a possibly dangling pointer from cstack to tasklet. And TaskletExit inherits from SystemExit, now. Index: exceptions.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/src/Python/exceptions.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** exceptions.c 14 Jan 2004 19:11:08 -0000 1.3 --- exceptions.c 7 Apr 2004 17:32:19 -0000 1.4 *************** *** 1676,1683 **** {"StopIteration", &PyExc_StopIteration, &PyExc_Exception, StopIteration__doc__}, - #ifdef STACKLESS - {"TaskletExit", &PyExc_TaskletExit, &PyExc_Exception, - TaskletExit__doc__}, - #endif {"StandardError", &PyExc_StandardError, &PyExc_Exception, StandardError__doc__}, --- 1676,1679 ---- *************** *** 1688,1691 **** --- 1684,1691 ---- {"SystemExit", &PyExc_SystemExit, &PyExc_Exception, SystemExit__doc__, SystemExit_methods}, + #ifdef STACKLESS + {"TaskletExit", &PyExc_TaskletExit, &PyExc_SystemExit, + TaskletExit__doc__}, + #endif {"KeyboardInterrupt", &PyExc_KeyboardInterrupt, 0, KeyboardInterrupt__doc__}, {"ImportError", &PyExc_ImportError, 0, ImportError__doc__}, _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 18:45:27 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 18:45:27 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python traceback.c, 1.8, 1.9 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv31818/Python Modified Files: traceback.c Log Message: simplified pickling of tracebacks. They are recursive, again. I will try to make cPickle stackless, instead. Removed all patches from tracebackobject.c Index: traceback.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/traceback.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** traceback.c 14 Jan 2004 19:11:08 -0000 1.8 --- traceback.c 18 Apr 2004 16:45:25 -0000 1.9 *************** *** 15,119 **** int tb_lasti; int tb_lineno; - #ifdef STACKLESS - int tb_is_head; /* helper for pickling */ - #endif } tracebackobject; #define OFF(x) offsetof(tracebackobject, x) - #ifdef STACKLESS - - static PyMemberDef tb_memberlist[] = { - {"tb_next", T_OBJECT, OFF(tb_next), RO}, - {"tb_frame", T_OBJECT, OFF(tb_frame), RO}, - {"tb_lasti", T_INT, OFF(tb_lasti), RO}, - {"tb_lineno", T_INT, OFF(tb_lineno), RO}, - {NULL} /* Sentinel */ - }; - - static PyObject * - tb_reduce(tracebackobject * tb) - { - PyObject *tup = NULL, *lis; - tracebackobject *tb_next; - if (!tb->tb_is_head) { - tup = Py_BuildValue("(O(Oii))", - &PyTraceBack_Type, - tb->tb_frame, tb->tb_lasti, tb->tb_lineno); - if (tup == NULL) return NULL; - return tup; - } - lis = PyList_New(0); - if (lis == NULL) return NULL; - tb_next = tb->tb_next; - while (tb_next != NULL) { - if (PyList_Append(lis, (PyObject *) tb_next)) - goto err_exit; - tb_next = tb_next->tb_next; - } - - tup = Py_BuildValue("(O(OiiO))", - &PyTraceBack_Type, - tb->tb_frame, tb->tb_lasti, tb->tb_lineno, - lis); - - err_exit: - Py_XDECREF(lis); - return tup; - } - - static PyMethodDef tb_methodlist[] = { - {"__reduce__", (PyCFunction)tb_reduce, METH_NOARGS, NULL}, - {NULL, NULL} - }; - - static tracebackobject * - newtracebackobject(tracebackobject *next, PyFrameObject *frame); - - static - PyObject * - traceback_new(PyTypeObject *type, PyObject *args, PyObject *kwds) - { - tracebackobject *tb; - PyFrameObject *frame; - int lasti, lineno; - PyObject *lis = NULL; - - if (kwds != NULL) { - PyErr_SetString(PyExc_ValueError, "Keyword parameters not supported for traceback_new"); - return NULL; - } - if (!PyArg_ParseTuple(args, "O!ii|O!:traceback", - PyBaseFrame_Type, &frame, - &lasti, &lineno, - &PyList_Type, &lis)) - return NULL; - - tb = newtracebackobject(NULL, frame); - if (tb == NULL) - return NULL; - - if (lis != NULL) { - int i; - tracebackobject *tb_curr = tb, *tb_next; - for (i=0; i < PyList_GET_SIZE(lis); ++i) { - tb_next = (tracebackobject *) PyList_GET_ITEM(lis, i); - if (!PyTraceBack_Check(tb_next)) { - PyErr_SetString(PyExc_TypeError, - "list of tracebacks expected in traceback()"); - Py_DECREF(tb); - return NULL; - } - tb_curr->tb_next = tb_next; - tb_curr = tb_next; - Py_INCREF(tb_next); - } - tb->tb_is_head = 1; - } - return (PyObject *) tb; - } - - #else - static struct memberlist tb_memberlist[] = { {"tb_next", T_OBJECT, OFF(tb_next)}, --- 15,22 ---- *************** *** 129,133 **** return PyMember_Get((char *)tb, tb_memberlist, name); } - #endif static void --- 32,35 ---- *************** *** 173,181 **** (destructor)tb_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ - #ifdef STACKLESS - 0, - #else (getattrfunc)tb_getattr, /*tp_getattr*/ - #endif 0, /*tp_setattr*/ 0, /*tp_compare*/ --- 75,79 ---- *************** *** 187,195 **** 0, /* tp_call */ 0, /* tp_str */ - #ifdef STACKLESS - PyObject_GenericGetAttr, - #else 0, /* tp_getattro */ - #endif 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 85,89 ---- *************** *** 202,223 **** 0, /* tp_iter */ 0, /* tp_iternext */ - #ifdef STACKLESS - tb_methodlist, /* tp_methods */ - tb_memberlist, /* tp_members */ - #else 0, /* tp_methods */ 0, /* tp_members */ - #endif 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ - #ifdef STACKLESS - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - traceback_new, /* tp_new */ - #endif }; --- 96,104 ---- *************** *** 240,246 **** tb->tb_lineno = PyCode_Addr2Line(frame->f_code, frame->f_lasti); - #ifdef STACKLESS - tb->tb_is_head = 0; - #endif PyObject_GC_Track(tb); } --- 121,124 ---- *************** *** 261,273 **** return -1; tstate->curexc_traceback = (PyObject *)tb; - #ifdef STACKLESS - if (oldtb != NULL) { - oldtb->tb_is_head = 0; - tb->tb_is_head = 1; - Py_DECREF(oldtb); - } - #else Py_XDECREF(oldtb); - #endif return 0; } --- 139,143 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 19 21:46:23 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 19 Apr 2004 21:46:23 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless prickelpit.c, 1.61, 1.62 prickelpit.h, 1.8, 1.9 stacklessmodule.c, 1.163, 1.164 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv24147/dev/Stackless Modified Files: prickelpit.c prickelpit.h stacklessmodule.c Log Message: moved the patched types for pickling into builtins. This should generate less incompatibilites. I tried to use copy_reg, but this still requires some location for the global types, and still would mean to change the type names. I had a problem with initialisation order. Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** prickelpit.c 19 Apr 2004 19:15:18 -0000 1.61 --- prickelpit.c 19 Apr 2004 19:46:21 -0000 1.62 *************** *** 16,20 **** *******************************************************/ ! static PyObject *_builtin_dict = NULL; static int meth_table_len(PyMethodDef *ml) --- 16,20 ---- *******************************************************/ ! static PyObject *_patched_types = NULL; static int meth_table_len(PyMethodDef *ml) *************** *** 47,53 **** static int init_type(PyTypeObject *t, PyMethodDef *ml, newfunc _new) { ! if (PyDict_GetItemString(_builtin_dict, t->tp_name) == NULL) { ! if (PyDict_SetItemString(_builtin_dict, t->tp_name, (PyObject *)t)) return -1; ! } if (_new) --- 47,53 ---- static int init_type(PyTypeObject *t, PyMethodDef *ml, newfunc _new) { ! ! if (_patched_types == NULL && (_patched_types = PyList_New(0)) == NULL) return -1; ! if (PyList_Append(_patched_types, (PyObject *) t)) return -1; if (_new) *************** *** 1563,1570 **** int init_prickelpit(void) { - PyObject *builtin = PyImport_ImportModule("__builtin__"); - PyObject *dict; - if (builtin == NULL) return -1; - dict = PyModule_GetDict(builtin); if (0 || init_codetype() --- 1563,1566 ---- *************** *** 1585,1592 **** || init_rangetype() ) return -1; - Py_DECREF(builtin); return 0; } #endif --- 1581,1608 ---- || init_rangetype() ) return -1; return 0; } + int init_prickelpit_post(void) + { + PyObject *builtin = PyImport_ImportModule("__builtin__"); + PyObject *dict, *t; + int i, n; + char *name; + if (builtin == NULL) return -1; + dict = PyModule_GetDict(builtin); + n = PyList_Size(_patched_types); + for (i=0; i < n; ++i) { + t = PyList_GET_ITEM(_patched_types, i); + name = ((PyTypeObject*)t)->tp_name; + if (PyDict_GetItemString(dict, name) == NULL) { + if (PyDict_SetItemString(dict, name, t)) return -1; + } + } + Py_DECREF(builtin); + Py_DECREF(_patched_types); + return 0; + } + #endif Index: prickelpit.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** prickelpit.h 18 Apr 2004 14:07:33 -0000 1.8 --- prickelpit.h 19 Apr 2004 19:46:21 -0000 1.9 *************** *** 49,52 **** --- 49,53 ---- int init_prickelpit(void); + int init_prickelpit_post(void); #ifdef __cplusplus Index: stacklessmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklessmodule.c,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** stacklessmodule.c 19 Apr 2004 19:15:18 -0000 1.163 --- stacklessmodule.c 19 Apr 2004 19:46:21 -0000 1.164 *************** *** 897,900 **** --- 897,902 ---- return; /* errors handled by caller */ + if (init_prickelpit_post()) return; + dict = PyModule_GetDict(slp_module); _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:29:44 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:29:44 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless cframeobject.c, 1.65, 1.66 channelobject.c, 1.41, 1.42 flextype.c, 1.8, 1.9 flextype.h, 1.9, 1.10 prickelpit.c, 1.68, 1.69 prickelpit.h, 1.10, 1.11 safe_pickle.c, 1.2, 1.3 scheduling.c, 1.89, 1.90 slp_transfer.c, 1.19, 1.20 stackless_api.h, 1.28, 1.29 stackless_impl.h, 1.82, 1.83 stackless_structs.h, 1.60, 1.61 stackless_tstate.h, 1.48, 1.49 stackless_util.c, 1.16, 1.17 stacklesseval.c, 1.140, 1.141 stacklessmodule.c, 1.165, 1.166 switch_ppc_macosx.h, 1.13, 1.14 switch_ppc_unix.h, 1.5, 1.6 switch_s390_unix.h, 1.4, 1.5 switch_sparc_sun_gcc.h, 1.5, 1.6 switch_x86_msvc.h, 1.31, 1.32 switch_x86_unix.h, 1.15, 1.16 taskletobject.c, 1.107, 1.108 stackless_frame.h, 1.42, NONE stacklesseval.h, 1.11, NONE Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv10482/Stackless Modified Files: cframeobject.c channelobject.c flextype.c flextype.h prickelpit.c prickelpit.h safe_pickle.c scheduling.c slp_transfer.c stackless_api.h stackless_impl.h stackless_structs.h stackless_tstate.h stackless_util.c stacklesseval.c stacklessmodule.c switch_ppc_macosx.h switch_ppc_unix.h switch_s390_unix.h switch_sparc_sun_gcc.h switch_x86_msvc.h switch_x86_unix.h taskletobject.c Removed Files: stackless_frame.h stacklesseval.h Log Message: I did a big cleanup. Tried to reformat everything using 8-tabs, roemoved dead code, and tried to make all Python source file whitespace compatible with the Stackless' version. I hope I didn't make too many mistakes... Index: cframeobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/cframeobject.c,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** cframeobject.c 19 Apr 2004 16:08:56 -0000 1.65 --- cframeobject.c 24 Apr 2004 23:29:39 -0000 1.66 *************** *** 45,55 **** { int i; ! PyObject ** f_params = PyBaseFrame_GET_MEMBERS(c); PyObject_GC_UnTrack(c); ! Py_XDECREF(c->f_back); for (i=0; i < c->ob_size; ++i) { Py_XDECREF(f_params[i]); } ! PyObject_GC_Del(c); } --- 45,56 ---- { int i; ! PyObject ** f_params = PyBaseFrame_GET_MEMBERS(c); ! PyObject_GC_UnTrack(c); ! Py_XDECREF(c->f_back); for (i=0; i < c->ob_size; ++i) { Py_XDECREF(f_params[i]); } ! PyObject_GC_Del(c); } *************** *** 58,62 **** { int i, err; ! PyObject ** f_params = PyBaseFrame_GET_MEMBERS(c); #define VISIT(o) if (o) {if ((err = visit((PyObject *)(o), arg))) return err;} --- 59,64 ---- { int i, err; ! PyObject ** f_params = PyBaseFrame_GET_MEMBERS(c); ! #define VISIT(o) if (o) {if ((err = visit((PyObject *)(o), arg))) return err;} *************** *** 74,78 **** { int i; ! PyObject ** f_params = PyBaseFrame_GET_MEMBERS(c); for (i=0; i < c->ob_size; ++i) { PyObject *hold = f_params[i]; --- 76,81 ---- { int i; ! PyObject ** f_params = PyBaseFrame_GET_MEMBERS(c); ! for (i=0; i < c->ob_size; ++i) { PyObject *hold = f_params[i]; *************** *** 82,86 **** } } ! /* note that the object is still alive, and ready for normal destruction without side effects */ } --- 85,89 ---- } } ! /* note that the object is still alive, and ready for normal destruction without side effects */ } *************** *** 89,114 **** slp_baseframe_new(PyFrame_ExecFunc *exec, unsigned int linked, unsigned int extra) { ! PyThreadState *ts = PyThreadState_GET(); ! PyBaseFrameObject *c; ! PyFrameObject *back; int i; ! c = PyObject_GC_NewVar(PyBaseFrameObject, &PyBaseFrame_Type, extra); ! if (c == NULL) ! return NULL; ! back = ts->frame; ! if (!linked) ! back = NULL; ! Py_XINCREF(back); ! c->f_back = back; for (i=0; i < c->ob_size; ++i) { ! PyObject ** f_params = PyBaseFrame_GET_MEMBERS(c); f_params[i] = NULL; } c->f_execute = exec; _PyObject_GC_TRACK(c); ! return c; } --- 92,117 ---- slp_baseframe_new(PyFrame_ExecFunc *exec, unsigned int linked, unsigned int extra) { ! PyThreadState *ts = PyThreadState_GET(); ! PyBaseFrameObject *c; ! PyFrameObject *back; int i; ! c = PyObject_GC_NewVar(PyBaseFrameObject, &PyBaseFrame_Type, extra); ! if (c == NULL) ! return NULL; ! back = ts->frame; ! if (!linked) ! back = NULL; ! Py_XINCREF(back); ! c->f_back = back; for (i=0; i < c->ob_size; ++i) { ! PyObject ** f_params = PyBaseFrame_GET_MEMBERS(c); f_params[i] = NULL; } c->f_execute = exec; _PyObject_GC_TRACK(c); ! return c; } *************** *** 125,129 **** if ((exec_name = slp_find_execname((PyFrameObject *) f, &valid)) == NULL) ! return NULL; extra = f->ob_size; --- 128,132 ---- if ((exec_name = slp_find_execname((PyFrameObject *) f, &valid)) == NULL) ! return NULL; extra = f->ob_size; *************** *** 132,140 **** res = Py_BuildValue ("(O(" baseframetuplefmt "))", ! f->ob_type, ! valid, ! exec_name, ! params ! ); err_exit: --- 135,142 ---- res = Py_BuildValue ("(O(" baseframetuplefmt "))", ! f->ob_type, ! valid, ! exec_name, ! params); err_exit: *************** *** 155,219 **** baseframe_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! PyBaseFrameObject *f; ! int valid; ! PyObject *exec_name = NULL; ! PyFrame_ExecFunc *good_func, *bad_func; ! PyObject *params; ! int extra; ! if (kwds != NULL) { ! PyErr_SetString(PyExc_ValueError, "Keyword parameters not supported for baseframe unpickling"); ! return NULL; ! } ! if (!PyArg_ParseTuple (args, baseframetuplenewfmt, ! &valid, ! &exec_name, ! &PyTuple_Type, ¶ms ! )) ! return NULL; if (slp_find_execfuncs(type, exec_name, &good_func, &bad_func)) return NULL; ! extra = PyTuple_GET_SIZE(params)-1; ! f = slp_baseframe_new(valid ? good_func : bad_func, 0, extra); /* mark as from unpickling */ Py_INCREF(Py_None); f->f_back = (PyFrameObject *) Py_None; ! f->ob_type = type; slp_from_tuple_with_nulls(PyBaseFrame_GET_MEMBERS(f), params); ! return (PyObject *) f; } static PyObject * run_cframe(PyFrameObject *f, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ! PyCFrameObject *c = (PyCFrameObject*) f; ! ts->frame = f; ! if (retval == NULL) ! goto exit_run_cframe; ! if (c->callable == NULL) { ! /* we were left by a soft call */ } else { ! /* ! * try to save stack space by inlining PyCFunction with METH_KEYWORDS. ! * These are simple to handle, and also most suitable for tasklets, ! * which should try to look like any other Python function. ! */ ! Py_DECREF(retval); ! if (PyCFunction_Check(c->callable) && ! PyCFunction_GET_FLAGS(c->callable) & METH_KEYWORDS && ! PyCFunction_GET_FUNCTION(c->callable) != NULL) { ! STACKLESS_PROPOSE_FLAG(PyCFunction_GET_FLAGS(c->callable) & METH_STACKLESS); ! retval = (*(PyCFunctionWithKeywords)PyCFunction_GET_FUNCTION(c->callable))( ! PyCFunction_GET_SELF(c->callable), c->args, c->kwds); ! } ! else { ! STACKLESS_PROPOSE_ALL(); ! retval = PyObject_Call(c->callable, c->args, c->kwds); ! } STACKLESS_ASSERT(); --- 157,207 ---- baseframe_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! PyBaseFrameObject *f; ! int valid; ! PyObject *exec_name = NULL; ! PyFrame_ExecFunc *good_func, *bad_func; ! PyObject *params; ! int extra; ! if (kwds != NULL) { ! PyErr_SetString(PyExc_ValueError, ! "Keyword parameters not supported" ! "for baseframe unpickling"); ! return NULL; ! } ! if (!PyArg_ParseTuple (args, baseframetuplenewfmt, ! &valid, ! &exec_name, ! &PyTuple_Type, ¶ms)) ! return NULL; if (slp_find_execfuncs(type, exec_name, &good_func, &bad_func)) return NULL; ! extra = PyTuple_GET_SIZE(params)-1; ! f = slp_baseframe_new(valid ? good_func : bad_func, 0, extra); /* mark as from unpickling */ Py_INCREF(Py_None); f->f_back = (PyFrameObject *) Py_None; ! f->ob_type = type; slp_from_tuple_with_nulls(PyBaseFrame_GET_MEMBERS(f), params); ! return (PyObject *) f; } static PyObject * run_cframe(PyFrameObject *f, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ! PyCFrameObject *c = (PyCFrameObject*) f; ! ts->frame = f; ! if (retval == NULL) ! goto exit_run_cframe; ! if (c->callable == NULL) { ! /* we were left by a soft call */ } else { ! STACKLESS_PROPOSE_ALL(); ! retval = PyObject_Call(c->callable, c->args, c->kwds); STACKLESS_ASSERT(); *************** *** 236,370 **** slp_cframe_new(PyObject *func, PyObject *args, PyObject *kwds, unsigned int linked) { ! PyCFrameObject *c; ! if (func == NULL || !PyCallable_Check(func)) ! return TYPE_ERROR("cframe function must be a callable", NULL); c = (PyCFrameObject *)slp_baseframe_new(run_cframe, linked, 3); ! if (c == NULL) ! return NULL; c->bf.ob_type = &PyCFrame_Type; ! Py_INCREF(func); ! c->callable = func; ! Py_INCREF(args); ! c->args = args; ! Py_XINCREF(kwds); ! c->kwds = kwds; ! return c; } static PyMemberDef baseframe_memberlist[] = { ! {"f_back", T_OBJECT, offsetof(PyCFrameObject, bf.f_back), RO}, ! {"_exec_adr", T_INT, offsetof(PyCFrameObject, bf.f_execute), RO, "The address of the execute function of this frame.\n" "use f._exec_map[adr] to find its pickling name."}, ! {NULL} /* Sentinel */ }; static PyMemberDef cframe_memberlist[] = { ! {"f_back", T_OBJECT, offsetof(PyCFrameObject, bf.f_back), RO}, ! {"callable", T_OBJECT, offsetof(PyCFrameObject, callable), RO}, ! {"args", T_OBJECT, offsetof(PyCFrameObject, args), RO}, ! {"kwds", T_OBJECT, offsetof(PyCFrameObject, kwds),RO}, ! {"_exec_adr", T_INT, offsetof(PyCFrameObject, bf.f_execute), RO, "The address of the execute function of this frame.\n" "use f._exec_map[adr] to find its pickling name."}, ! {NULL} /* Sentinel */ }; PyTypeObject PyBaseFrame_Type = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, ! "stackless.baseframe", ! sizeof(PyBaseFrameObject), ! sizeof(PyObject *), ! (destructor)baseframe_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! PyObject_GenericSetAttr, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)baseframe_traverse, /* tp_traverse */ ! (inquiry) baseframe_clear, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! baseframe_methods, /* tp_methods */ ! baseframe_memberlist, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! baseframe_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; PyTypeObject PyCFrame_Type = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, ! "stackless.cframe", ! sizeof(PyBaseFrameObject), ! sizeof(PyObject *), ! (destructor)baseframe_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! PyObject_GenericSetAttr, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)baseframe_traverse, /* tp_traverse */ ! (inquiry) baseframe_clear, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* tp_methods */ ! cframe_memberlist, /* tp_members */ ! 0, /* tp_getset */ ! &PyBaseFrame_Type, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! baseframe_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; int init_cframetype(void) { ! /* register the cframe exec func */ ! slp_register_execute(&PyCFrame_Type, "run_frame", ! run_cframe, REF_INVALID_EXEC(run_cframe)); ! return 0; } #endif --- 224,358 ---- slp_cframe_new(PyObject *func, PyObject *args, PyObject *kwds, unsigned int linked) { ! PyCFrameObject *c; ! if (func == NULL || !PyCallable_Check(func)) ! return TYPE_ERROR("cframe function must be a callable", NULL); c = (PyCFrameObject *)slp_baseframe_new(run_cframe, linked, 3); ! if (c == NULL) ! return NULL; c->bf.ob_type = &PyCFrame_Type; ! Py_INCREF(func); ! c->callable = func; ! Py_INCREF(args); ! c->args = args; ! Py_XINCREF(kwds); ! c->kwds = kwds; ! return c; } static PyMemberDef baseframe_memberlist[] = { ! {"f_back", T_OBJECT, offsetof(PyCFrameObject, bf.f_back), RO}, ! {"_exec_adr", T_INT, offsetof(PyCFrameObject, bf.f_execute), RO, "The address of the execute function of this frame.\n" "use f._exec_map[adr] to find its pickling name."}, ! {NULL} /* Sentinel */ }; static PyMemberDef cframe_memberlist[] = { ! {"f_back", T_OBJECT, offsetof(PyCFrameObject, bf.f_back), RO}, ! {"callable", T_OBJECT, offsetof(PyCFrameObject, callable), RO}, ! {"args", T_OBJECT, offsetof(PyCFrameObject, args), RO}, ! {"kwds", T_OBJECT, offsetof(PyCFrameObject, kwds), RO}, ! {"_exec_adr", T_INT, offsetof(PyCFrameObject, bf.f_execute), RO, "The address of the execute function of this frame.\n" "use f._exec_map[adr] to find its pickling name."}, ! {NULL} /* Sentinel */ }; PyTypeObject PyBaseFrame_Type = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, ! "stackless.baseframe", ! sizeof(PyBaseFrameObject), ! sizeof(PyObject *), ! (destructor)baseframe_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! PyObject_GenericSetAttr, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)baseframe_traverse, /* tp_traverse */ ! (inquiry) baseframe_clear, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! baseframe_methods, /* tp_methods */ ! baseframe_memberlist, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! baseframe_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; PyTypeObject PyCFrame_Type = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, ! "stackless.cframe", ! sizeof(PyBaseFrameObject), ! sizeof(PyObject *), ! (destructor)baseframe_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! PyObject_GenericSetAttr, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)baseframe_traverse, /* tp_traverse */ ! (inquiry) baseframe_clear, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* tp_methods */ ! cframe_memberlist, /* tp_members */ ! 0, /* tp_getset */ ! &PyBaseFrame_Type, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! baseframe_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; int init_cframetype(void) { ! /* register the cframe exec func */ ! slp_register_execute(&PyCFrame_Type, "run_frame", ! run_cframe, REF_INVALID_EXEC(run_cframe)); ! return 0; } #endif Index: channelobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/channelobject.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** channelobject.c 18 Apr 2004 14:07:33 -0000 1.41 --- channelobject.c 24 Apr 2004 23:29:39 -0000 1.42 *************** *** 16,26 **** channel_dealloc(PyObject *op) { ! PyChannelObject *c = (PyChannelObject *) op; ! if (c->chan_weakreflist != NULL) ! PyObject_ClearWeakRefs((PyObject *)c); ! while (c->queue != NULL) { ! PyTasklet_Kill( (PyTaskletObject *) c->queue); ! } ! op->ob_type->tp_free(op); } [...1568 lines suppressed...] ! t, sizeof(PyChannel_HeapType), channel_cmethods) ) == NULL) return -1; ! PyChannel_TypePtr = t; ! ! return 0; } #endif --- 973,984 ---- int init_channeltype(void) { ! PyTypeObject *t = &_PyChannel_Type; if ( (t = PyFlexType_Build("stackless", "channel", t->tp_doc, "", ! t, sizeof(PyChannel_HeapType), ! channel_cmethods) ) == NULL) return -1; ! PyChannel_TypePtr = t; ! return 0; } #endif Index: flextype.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/flextype.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** flextype.c 25 Mar 2004 22:59:07 -0000 1.8 --- flextype.c 24 Apr 2004 23:29:39 -0000 1.9 *************** *** 16,28 **** reset_gc(PyTypeObject *type) { ! PyTypeObject *base = type->tp_base; ! /* convince the type *not* to use GC unless intended */ ! if (type->tp_flags & Py_TPFLAGS_HAVE_GC && !(base->tp_flags & Py_TPFLAGS_HAVE_GC)) { ! type->tp_free = base->tp_free; ! type->tp_traverse = base->tp_traverse; ! type->tp_clear = base->tp_clear; ! type->tp_is_gc = base->tp_is_gc; ! type->tp_flags &= ~Py_TPFLAGS_HAVE_GC; ! } } --- 16,28 ---- reset_gc(PyTypeObject *type) { ! PyTypeObject *base = type->tp_base; ! /* convince the type *not* to use GC unless intended */ ! if (type->tp_flags & Py_TPFLAGS_HAVE_GC && !(base->tp_flags & Py_TPFLAGS_HAVE_GC)) { ! type->tp_free = base->tp_free; ! type->tp_traverse = base->tp_traverse; ! type->tp_clear = base->tp_clear; ! type->tp_is_gc = base->tp_is_gc; ! type->tp_flags &= ~Py_TPFLAGS_HAVE_GC; ! } } *************** *** 30,41 **** find_size(PyObject * bases, int size) { ! int i, n = PyTuple_GET_SIZE(bases); ! for (i=0; iob_type->tp_basicsize; if (sz > size) size = sz; ! } ! return size; } --- 30,42 ---- find_size(PyObject * bases, int size) { ! int i, n = PyTuple_GET_SIZE(bases); ! ! for (i=0; iob_type->tp_basicsize; if (sz > size) size = sz; ! } ! return size; } *************** *** 43,51 **** builddict(char *modulename, char *doc, PyObject *slots) { ! char * fmt = slots == NULL ? "{s:s,s:s}" : "{s:s,s:s,s:O}"; ! return Py_BuildValue(fmt, ! "__module__", modulename, ! "__doc__", doc, ! "__slots__", slots); } --- 44,52 ---- builddict(char *modulename, char *doc, PyObject *slots) { ! char * fmt = slots == NULL ? "{s:s,s:s}" : "{s:s,s:s,s:O}"; ! return Py_BuildValue(fmt, ! "__module__", modulename, ! "__doc__", doc, ! "__slots__", slots); } *************** *** 53,62 **** buildslots(char *slotstr) { ! PyObject *ret; ! PyObject *s = PyString_FromString(slotstr); ! if (s == NULL) return NULL; ! ret = PyObject_CallMethod(s, "split", NULL); ! Py_DECREF(s); ! return ret; } --- 54,64 ---- buildslots(char *slotstr) { ! PyObject *ret; ! PyObject *s = PyString_FromString(slotstr); ! ! if (s == NULL) return NULL; ! ret = PyObject_CallMethod(s, "split", NULL); ! Py_DECREF(s); ! return ret; } *************** *** 65,97 **** static int bind_last_to_first( PyTypeObject *type, PyTypeObject *current) { ! PyCMethodDef *ml; ! if (current->tp_base != NULL && PyType_IsSubtype(current->tp_base->ob_type, &PyFlexType_Type)) ! if (bind_last_to_first(type, current->tp_base)) ! return -1; ! ml = ((PyFlexTypeObject *) current)->tp_cmethods; ! while (ml && ml->name) { ! char *p = (char*) type; ! void **fp = (void*) (p+ml->offset); ! int use_fast = 0; ! if (ml->match != NULL) { ! /* public Python method, see if it is overridden */ ! PyObject *op = PyObject_GetAttrString((PyObject *) type, ml->name); ! if (op == NULL) ! return -1; /* this may never happen */ ! if (PyType_IsSubtype(op->ob_type, methdescr_type)) { ! PyMethodDescrObject *descr = (PyMethodDescrObject *) op; ! if (descr->d_method->ml_meth == ml->match) ! use_fast = 1; ! } ! Py_DECREF(op); ! } ! else { ! /* private C only method, always use fast */ ! use_fast = 1; ! } ! *fp = use_fast ? ml->fast : ml->wrap; ! ++ml; ! } ! return 0; } --- 67,104 ---- static int bind_last_to_first( PyTypeObject *type, PyTypeObject *current) { ! PyCMethodDef *ml; ! if (current->tp_base != NULL && ! PyType_IsSubtype(current->tp_base->ob_type, &PyFlexType_Type)) ! if (bind_last_to_first(type, current->tp_base)) ! return -1; ! ml = ((PyFlexTypeObject *) current)->tp_cmethods; ! while (ml && ml->name) { ! char *p = (char*) type; ! void **fp = (void*) (p+ml->offset); ! int use_fast = 0; ! ! if (ml->match != NULL) { ! /* public Python method, see if it is overridden */ ! PyObject *op = PyObject_GetAttrString( ! (PyObject *) type, ml->name); ! if (op == NULL) ! return -1; /* this may never happen */ ! if (PyType_IsSubtype(op->ob_type, methdescr_type)) { ! PyMethodDescrObject *descr; ! ! descr = (PyMethodDescrObject *) op; ! if (descr->d_method->ml_meth == ml->match) ! use_fast = 1; ! } ! Py_DECREF(op); ! } ! else { ! /* private C only method, always use fast */ ! use_fast = 1; ! } ! *fp = use_fast ? ml->fast : ml->wrap; ! ++ml; ! } ! return 0; } *************** *** 99,111 **** bindmethods( PyTypeObject *type ) { ! if (methdescr_type == NULL) { ! /* PyMethodDescr_Type is not published. We retrieve a known method. */ ! PyObject *mro_descr = PyObject_GetAttrString((PyObject *)&PyType_Type, "mro"); ! if (mro_descr == NULL) return -1; ! methdescr_type = mro_descr->ob_type; ! Py_DECREF(mro_descr); ! } ! /* walk down through the bases and resolve methods */ ! return bind_last_to_first(type, type); } --- 106,122 ---- bindmethods( PyTypeObject *type ) { ! if (methdescr_type == NULL) { ! /* ! * PyMethodDescr_Type is not published. We retrieve a ! * known method. ! */ ! PyObject *mro_descr = PyObject_GetAttrString( ! (PyObject *)&PyType_Type, "mro"); ! if (mro_descr == NULL) return -1; ! methdescr_type = mro_descr->ob_type; ! Py_DECREF(mro_descr); ! } ! /* walk down through the bases and resolve methods */ ! return bind_last_to_first(type, type); } *************** *** 114,144 **** flextype_new(PyTypeObject *meta, PyObject *args, PyObject *kwds) { ! PyObject *name, *bases, *dict; ! static char *kwlist[] = {"name", "bases", "dict", 0}; ! PyFlexTypeObject *type; ! int basicsize = meta->tp_basicsize; ! int type_size = basicsize; ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "SO!O!:type", kwlist, ! &name, ! &PyTuple_Type, &bases, ! &PyDict_Type, &dict)) ! return NULL; ! assert(PyType_IsSubtype(meta, &PyFlexType_Type)); ! type_size = find_size(bases, type_size); ! meta->tp_basicsize = type_size; ! type = (PyFlexTypeObject *) PyType_Type.tp_new(meta, args, kwds); ! meta->tp_basicsize = basicsize; ! if (type == NULL) ! return NULL; /* we can't do that in 2.3, it would break */ #if 0 ! reset_gc( (PyTypeObject *) type); #endif ! if (bindmethods(&type->type.type)) { ! Py_DECREF((PyObject *) type); ! return NULL; ! } ! return (PyObject *) type; } --- 125,155 ---- flextype_new(PyTypeObject *meta, PyObject *args, PyObject *kwds) { ! PyObject *name, *bases, *dict; ! static char *kwlist[] = {"name", "bases", "dict", 0}; ! PyFlexTypeObject *type; ! int basicsize = meta->tp_basicsize; ! int type_size = basicsize; ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "SO!O!:type", kwlist, ! &name, ! &PyTuple_Type, &bases, ! &PyDict_Type, &dict)) ! return NULL; ! assert(PyType_IsSubtype(meta, &PyFlexType_Type)); ! type_size = find_size(bases, type_size); ! meta->tp_basicsize = type_size; ! type = (PyFlexTypeObject *) PyType_Type.tp_new(meta, args, kwds); ! meta->tp_basicsize = basicsize; ! if (type == NULL) ! return NULL; /* we can't do that in 2.3, it would break */ #if 0 ! reset_gc( (PyTypeObject *) type); #endif ! if (bindmethods(&type->type.type)) { ! Py_DECREF((PyObject *) type); ! return NULL; ! } ! return (PyObject *) type; } *************** *** 147,169 **** type_clone(PyTypeObject *meta, PyTypeObject *base, char *typename, PyObject *dict, size_t type_size, PyCMethodDef *ml) { ! PyObject *args = Py_BuildValue("(s(O)O)", typename, base, dict); ! int basicsize = meta->tp_basicsize; ! PyFlexTypeObject *type; ! assert(type_size >= (size_t) meta->tp_basicsize); ! if (args == NULL) ! return NULL; ! meta->tp_basicsize = type_size; ! type = (PyFlexTypeObject *) meta->tp_new(meta, args, NULL); ! meta->tp_basicsize = basicsize; ! Py_DECREF(args); ! if (type == NULL) ! return NULL; ! reset_gc( (PyTypeObject *) type); ! type->tp_cmethods = ml; ! if (bindmethods( (PyTypeObject *) type) ) { ! Py_DECREF( (PyObject *) type); ! return NULL; ! } ! return (PyTypeObject *) type; } --- 158,181 ---- type_clone(PyTypeObject *meta, PyTypeObject *base, char *typename, PyObject *dict, size_t type_size, PyCMethodDef *ml) { ! PyObject *args = Py_BuildValue("(s(O)O)", typename, base, dict); ! int basicsize = meta->tp_basicsize; ! PyFlexTypeObject *type; ! ! assert(type_size >= (size_t) meta->tp_basicsize); ! if (args == NULL) ! return NULL; ! meta->tp_basicsize = type_size; ! type = (PyFlexTypeObject *) meta->tp_new(meta, args, NULL); ! meta->tp_basicsize = basicsize; ! Py_DECREF(args); ! if (type == NULL) ! return NULL; ! reset_gc( (PyTypeObject *) type); ! type->tp_cmethods = ml; ! if (bindmethods( (PyTypeObject *) type) ) { ! Py_DECREF( (PyObject *) type); ! return NULL; ! } ! return (PyTypeObject *) type; } *************** *** 177,182 **** int use_cache = nmethods < CACHED_META_MAX; char metaname[20]; ! PyObject *dict; PyTypeObject *meta, *ft = &PyFlexType_Type; if (use_cache && flextype_meta_cache[nmethods] != NULL) { meta = flextype_meta_cache[nmethods]; --- 189,195 ---- int use_cache = nmethods < CACHED_META_MAX; char metaname[20]; ! PyObject *dict; PyTypeObject *meta, *ft = &PyFlexType_Type; + if (use_cache && flextype_meta_cache[nmethods] != NULL) { meta = flextype_meta_cache[nmethods]; *************** *** 185,192 **** } sprintf(metaname, "flextype-meta %d", nmethods); ! if ( (dict = builddict(modulename, ft->tp_doc, NULL)) == NULL) ! return NULL; meta = type_clone( ft, ft, metaname, dict, type_size, NULL); ! if (meta == NULL) return NULL; meta->tp_new = flextype_new; Py_DECREF(dict); --- 198,206 ---- } sprintf(metaname, "flextype-meta %d", nmethods); ! if ( (dict = builddict(modulename, ft->tp_doc, NULL)) == NULL) ! return NULL; meta = type_clone( ft, ft, metaname, dict, type_size, NULL); ! if (meta == NULL) ! return NULL; meta->tp_new = flextype_new; Py_DECREF(dict); *************** *** 199,224 **** PyTypeObject * PyFlexType_Build( char *modulename, ! char *type_name, ! char *doc, ! char *slotstr, ! PyTypeObject *base, ! size_t type_size, ! PyCMethodDef *ml ) { ! PyObject *slots, *dict; ! PyTypeObject *t = NULL, *meta = NULL; ! if ( (slots = buildslots(slotstr)) == NULL) ! return NULL; ! if ( (dict = builddict(modulename, doc, slots)) == NULL) ! return NULL; if ((meta = make_meta_cached(modulename, type_size)) == NULL) return NULL; ! t = type_clone( meta, base, type_name, dict, type_size, ml); ! if (t == NULL) return NULL; Py_DECREF(meta); ! Py_DECREF(slots); ! Py_DECREF(dict); ! return t; } --- 213,238 ---- PyTypeObject * PyFlexType_Build( char *modulename, ! char *type_name, ! char *doc, ! char *slotstr, ! PyTypeObject *base, ! size_t type_size, ! PyCMethodDef *ml ) { ! PyObject *slots, *dict; ! PyTypeObject *t = NULL, *meta = NULL; ! if ( (slots = buildslots(slotstr)) == NULL) ! return NULL; ! if ( (dict = builddict(modulename, doc, slots)) == NULL) ! return NULL; if ((meta = make_meta_cached(modulename, type_size)) == NULL) return NULL; ! t = type_clone( meta, base, type_name, dict, type_size, ml); ! if (t == NULL) return NULL; Py_DECREF(meta); ! Py_DECREF(slots); ! Py_DECREF(dict); ! return t; } *************** *** 231,247 **** init_flextype(void) { ! PyObject *slots, *dict; ! PyTypeObject *type; ! if ( (slots = buildslots("")) == NULL) return -1; ! if ( (dict = builddict("stackless", pyflextype__doc__, slots)) == NULL) return -1; ! type = (PyTypeObject *) ! type_clone( &PyType_Type, &PyType_Type, "flextype", ! dict, sizeof(PyFlexTypeObject), NULL); ! if (type == NULL) return -1; ! type->tp_new = flextype_new; ! Py_DECREF(slots); ! Py_DECREF(dict); ! PyFlexType_TypePtr = type; ! return 0; } --- 245,263 ---- init_flextype(void) { ! PyObject *slots, *dict; ! PyTypeObject *type; ! ! if ( (slots = buildslots("")) == NULL) return -1; ! if ( (dict = builddict("stackless", pyflextype__doc__, ! slots)) == NULL) return -1; ! type = (PyTypeObject *) ! type_clone( &PyType_Type, &PyType_Type, "flextype", dict, ! sizeof(PyFlexTypeObject), NULL); ! if (type == NULL) return -1; ! type->tp_new = flextype_new; ! Py_DECREF(slots); ! Py_DECREF(dict); ! PyFlexType_TypePtr = type; ! return 0; } Index: flextype.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/flextype.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** flextype.h 25 Mar 2004 22:59:07 -0000 1.9 --- flextype.h 24 Apr 2004 23:29:39 -0000 1.10 *************** *** 6,14 **** typedef struct _pycmethoddef { ! char *name; /* name to lookup in __dict__ */ ! PyCFunction match; /* to be found if non-overridden */ ! void *fast; /* native C call */ ! void *wrap; /* wrapped call into Python */ ! int offset; /* slot offset in heap type */ } PyCMethodDef; --- 6,14 ---- typedef struct _pycmethoddef { ! char *name; /* name to lookup in __dict__ */ ! PyCFunction match; /* to be found if non-overridden */ ! void *fast; /* native C call */ ! void *wrap; /* wrapped call into Python */ ! int offset; /* slot offset in heap type */ } PyCMethodDef; *************** *** 22,40 **** * - the wrapper function wrap_class_name that calls back into a Python override. */ ! #ifdef STACKLESS ! #define CMETHOD_PUBLIC_ENTRY(type, prefix, name) \ ! { \ ! #name, (PyCFunction)prefix##_##name, \ ! &impl_##prefix##_##name, &wrap_##prefix##_##name, \ ! offsetof(type, name) \ ! } ! #else #define CMETHOD_PUBLIC_ENTRY(type, prefix, name) \ ! { \ ! #name, (PyCFunction)prefix##_##name, \ ! &impl_##prefix##_##name, &wrap_##prefix##_##name, \ ! offsetof(type, name) \ ! } ! #endif /* --- 22,32 ---- * - the wrapper function wrap_class_name that calls back into a Python override. */ ! #define CMETHOD_PUBLIC_ENTRY(type, prefix, name) \ ! { \ ! #name, (PyCFunction)prefix##_##name, \ ! &impl_##prefix##_##name, &wrap_##prefix##_##name, \ ! offsetof(type, name) \ ! } /* *************** *** 44,62 **** * this allows to do inheritance in C without publishing to Python. */ ! #ifdef STACKLESS ! #define CMETHOD_PRIVATE_ENTRY(type, prefix, name) \ ! {#name, NULL, \ ! &impl_##prefix##_##name, NULL, \ ! offsetof(type, name)} ! #else #define CMETHOD_PRIVATE_ENTRY(type, prefix, name) \ {#name, NULL, \ &impl_##prefix##_##name, NULL, \ offsetof(type, name)} - #endif typedef struct _flexheaptypeobject { ! PyHeapTypeObject type; ! PyCMethodDef *tp_cmethods; } PyFlexTypeObject; --- 36,48 ---- * this allows to do inheritance in C without publishing to Python. */ ! #define CMETHOD_PRIVATE_ENTRY(type, prefix, name) \ {#name, NULL, \ &impl_##prefix##_##name, NULL, \ offsetof(type, name)} typedef struct _flexheaptypeobject { ! PyHeapTypeObject type; ! PyCMethodDef *tp_cmethods; } PyFlexTypeObject; *************** *** 69,78 **** PyAPI_FUNC(PyTypeObject *) PyFlexType_Build( char *modulename, ! char *type_name, ! char *doc, ! char *slotstr, ! PyTypeObject *base, ! size_t type_size, ! PyCMethodDef *ml ); int init_flextype(void); --- 55,64 ---- PyAPI_FUNC(PyTypeObject *) PyFlexType_Build( char *modulename, ! char *type_name, ! char *doc, ! char *slotstr, ! PyTypeObject *base, ! size_t type_size, ! PyCMethodDef *ml ); int init_flextype(void); Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** prickelpit.c 23 Apr 2004 02:18:58 -0000 1.68 --- prickelpit.c 24 Apr 2004 23:29:39 -0000 1.69 *************** *** 20,24 **** static int is_wrong_type(PyTypeObject *type) { ! if (type->tp_base == NULL || strrchr(type->tp_name, '.')+1 != type->tp_base->tp_name) { PyErr_SetString(PyExc_TypeError, "incorrect wrapper type"); return -1; --- 20,25 ---- static int is_wrong_type(PyTypeObject *type) { ! if (type->tp_base == NULL || ! strrchr(type->tp_name, '.')+1 != type->tp_base->tp_name) { [...2312 lines suppressed...] ! || init_tracebacktype() ! || init_moduletype() ! || init_itertype() ! || init_methodtype() ! || init_dictitertype() ! || init_enumtype() ! || init_listitertype() ! || init_rangeitertype() ! || init_tupleitertype() ! || init_rangetype() ! || init_methodwrappertype() ! || init_generatortype() ! ) ! ret = -1; Py_XDECREF(pickle_reg); Py_XDECREF(copy_reg); ! return 0; } Index: prickelpit.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** prickelpit.h 23 Apr 2004 00:34:37 -0000 1.10 --- prickelpit.h 24 Apr 2004 23:29:39 -0000 1.11 *************** *** 11,22 **** *******************************************************/ ! PyAPI_FUNC(int) slp_register_execute(PyTypeObject *t, char *name, PyFrame_ExecFunc *good, PyFrame_ExecFunc *bad); ! PyAPI_FUNC(int) slp_find_execfuncs(PyTypeObject *type, PyObject *exec_name, ! PyFrame_ExecFunc **good, PyFrame_ExecFunc **bad); PyAPI_FUNC(PyObject *) slp_find_execname(PyFrameObject *f, int *valid); ! PyAPI_FUNC(PyObject *) slp_cannot_execute(PyFrameObject *f, char *exec_name, PyObject *retval); /* macros to define and use an invalid frame executor */ --- 11,26 ---- *******************************************************/ ! PyAPI_FUNC(int) slp_register_execute(PyTypeObject *t, char *name, ! PyFrame_ExecFunc *good, ! PyFrame_ExecFunc *bad); ! PyAPI_FUNC(int) slp_find_execfuncs(PyTypeObject *type, PyObject *exec_name, ! PyFrame_ExecFunc **good, ! PyFrame_ExecFunc **bad); PyAPI_FUNC(PyObject *) slp_find_execname(PyFrameObject *f, int *valid); ! PyAPI_FUNC(PyObject *) slp_cannot_execute(PyFrameObject *f, char *exec_name, ! PyObject *retval); /* macros to define and use an invalid frame executor */ *************** *** 35,42 **** PyAPI_FUNC(PyObject *) slp_into_tuple_with_nulls(PyObject **start, int length); ! /* creates a tuple of length+1 with the first element acting as a null marker */ PyAPI_FUNC(int) slp_from_tuple_with_nulls(PyObject **start, PyObject *tup); ! /* loads data from a tuple where the first element is a null marker. return value is the number of elements (length-1) */ --- 39,46 ---- PyAPI_FUNC(PyObject *) slp_into_tuple_with_nulls(PyObject **start, int length); ! /* creates a tuple of length+1 with the first element holding null markers */ PyAPI_FUNC(int) slp_from_tuple_with_nulls(PyObject **start, PyObject *tup); ! /* loads data from a tuple where the first element holds null markers. return value is the number of elements (length-1) */ *************** *** 44,48 **** /* helper functions for module dicts */ ! PyAPI_FUNC(PyObject *) PyStackless_Pickle_ModuleDict(PyObject *pickler, PyObject *self); PyAPI_FUNC(PyObject *) slp_pickle_moduledict(PyObject *self, PyObject *args); PyAPI_DATA(char slp_pickle_moduledict__doc__[]); --- 48,53 ---- /* helper functions for module dicts */ ! PyAPI_FUNC(PyObject *) PyStackless_Pickle_ModuleDict(PyObject *pickler, ! PyObject *self); PyAPI_FUNC(PyObject *) slp_pickle_moduledict(PyObject *self, PyObject *args); PyAPI_DATA(char slp_pickle_moduledict__doc__[]); Index: safe_pickle.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/safe_pickle.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** safe_pickle.c 19 Apr 2004 16:08:56 -0000 1.2 --- safe_pickle.c 24 Apr 2004 23:29:39 -0000 1.3 *************** *** 33,38 **** int ! slp_safe_pickling(int(*save)(PyObject *, PyObject *, int), ! PyObject *self, PyObject *args, int pers_save) { PyThreadState *ts = PyThreadState_GET(); --- 33,38 ---- int ! slp_safe_pickling(int(*save)(PyObject *, PyObject *, int), ! PyObject *self, PyObject *args, int pers_save) { PyThreadState *ts = PyThreadState_GET(); Index: scheduling.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/scheduling.c,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** scheduling.c 19 Apr 2004 16:14:46 -0000 1.89 --- scheduling.c 24 Apr 2004 23:29:39 -0000 1.90 *************** *** 39,53 **** transfer_with_exc(PyCStackObject **cstprev, PyCStackObject *cst, PyTaskletObject *prev) { ! PyThreadState *ts = PyThreadState_GET(); ! PyObject *exc_type = ts->exc_type; ! PyObject *exc_value = ts->exc_value; ! PyObject *exc_traceback = ts->exc_traceback; ! int ret; ! ts->exc_type = ts->exc_value = ts->exc_traceback = NULL; ! ret = slp_transfer(cstprev, cst, prev); ! ts->exc_type = exc_type; ! ts->exc_value = exc_value; ! ts->exc_traceback = exc_traceback; ! return ret; } --- 39,54 ---- transfer_with_exc(PyCStackObject **cstprev, PyCStackObject *cst, PyTaskletObject *prev) { ! PyThreadState *ts = PyThreadState_GET(); ! PyObject *exc_type = ts->exc_type; ! PyObject *exc_value = ts->exc_value; ! PyObject *exc_traceback = ts->exc_traceback; ! int ret; ! ! ts->exc_type = ts->exc_value = ts->exc_traceback = NULL; ! ret = slp_transfer(cstprev, cst, prev); ! ts->exc_type = exc_type; ! ts->exc_value = exc_value; ! ts->exc_traceback = exc_traceback; ! return ret; } *************** *** 57,68 **** slp_schedule_callback(PyTaskletObject *prev, PyTaskletObject *next) { ! PyObject *args; ! if (prev == NULL) prev = (PyTaskletObject *)Py_None; ! if (next == NULL) next = (PyTaskletObject *)Py_None; ! args = Py_BuildValue("(OO)", prev, next); ! if (args != NULL) { PyObject *type, *value, *traceback, *ret; PyErr_Fetch(&type, &value, &traceback); ! ret = PyObject_Call(_slp_schedule_hook, args, NULL); if (ret != NULL) PyErr_Restore(type, value, traceback); --- 58,71 ---- slp_schedule_callback(PyTaskletObject *prev, PyTaskletObject *next) { ! PyObject *args; ! ! if (prev == NULL) prev = (PyTaskletObject *)Py_None; ! if (next == NULL) next = (PyTaskletObject *)Py_None; ! args = Py_BuildValue("(OO)", prev, next); ! if (args != NULL) { PyObject *type, *value, *traceback, *ret; + PyErr_Fetch(&type, &value, &traceback); ! ret = PyObject_Call(_slp_schedule_hook, args, NULL); if (ret != NULL) PyErr_Restore(type, value, traceback); *************** *** 72,84 **** Py_XDECREF(traceback); } ! Py_XDECREF(ret); ! Py_DECREF(args); ! } } #define NOTIFY_SCHEDULE(prev, next, errflag) \ ! if (_slp_schedule_fasthook != NULL) { \ ! if (ts->st.schedlock) \ ! return RUNTIME_ERROR("Recursive scheduler call due to callbacks!", errflag); \ ts->st.schedlock = 1; \ _slp_schedule_fasthook(prev, next); \ --- 75,89 ---- Py_XDECREF(traceback); } ! Py_XDECREF(ret); ! Py_DECREF(args); ! } } #define NOTIFY_SCHEDULE(prev, next, errflag) \ ! if (_slp_schedule_fasthook != NULL) { \ ! if (ts->st.schedlock) \ ! return RUNTIME_ERROR( \ ! "Recursive scheduler call due to callbacks!", \ ! errflag); \ ts->st.schedlock = 1; \ _slp_schedule_fasthook(prev, next); \ *************** *** 89,125 **** kill_wrap_bad_guy(PyTaskletObject *prev, PyTaskletObject *bad_guy) { ! /* ! * just in case a transfer didn't work, we pack the bad ! * tasklet into the exception and remove it from the runnables. ! * ! */ ! PyThreadState *ts = PyThreadState_GET(); ! PyObject *newval = PyTuple_New(2); ! if (bad_guy->next != NULL) { ts->st.current = bad_guy; slp_current_remove(); } ! /* restore last tasklet */ if (prev->next == NULL) slp_current_insert(prev); ! ts->frame = prev->f.frame; ! ts->st.current = prev; ! if (newval != NULL) { ! /* merge bad guy into exception */ ! PyObject *exc, *val, *tb; ! PyErr_Fetch(&exc, &val, &tb); ! PyTuple_SET_ITEM(newval, 0, val); ! PyTuple_SET_ITEM(newval, 1, (PyObject*)bad_guy); Py_INCREF(bad_guy); ! PyErr_Restore(exc, newval, tb); ! } } ! static PyObject *slp_schedule_nr_maybe(PyTaskletObject *prev, PyTaskletObject *next, PyObject *retval); PyObject * ! slp_schedule_task(PyTaskletObject *prev, PyTaskletObject *next, int stackless, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); PyCStackObject **cstprev; --- 94,132 ---- kill_wrap_bad_guy(PyTaskletObject *prev, PyTaskletObject *bad_guy) { ! /* ! * just in case a transfer didn't work, we pack the bad ! * tasklet into the exception and remove it from the runnables. ! * ! */ ! PyThreadState *ts = PyThreadState_GET(); ! PyObject *newval = PyTuple_New(2); ! if (bad_guy->next != NULL) { ts->st.current = bad_guy; slp_current_remove(); } ! /* restore last tasklet */ if (prev->next == NULL) slp_current_insert(prev); ! ts->frame = prev->f.frame; ! ts->st.current = prev; ! if (newval != NULL) { ! /* merge bad guy into exception */ ! PyObject *exc, *val, *tb; ! PyErr_Fetch(&exc, &val, &tb); ! PyTuple_SET_ITEM(newval, 0, val); ! PyTuple_SET_ITEM(newval, 1, (PyObject*)bad_guy); Py_INCREF(bad_guy); ! PyErr_Restore(exc, newval, tb); ! } } ! static PyObject *slp_schedule_nr_maybe(PyTaskletObject *prev, ! PyTaskletObject *next, PyObject *retval); PyObject * ! slp_schedule_task(PyTaskletObject *prev, PyTaskletObject *next, int stackless, ! PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); PyCStackObject **cstprev; *************** *** 127,131 **** return retval; ! /* stackless != 0 => try stackless. stackless < 0 => don't hard switch */ if (stackless) { --- 134,138 ---- return retval; ! /* stackless != 0 => try soft. stackless < 0 => don't hard switch */ if (stackless) { *************** *** 138,164 **** STACKLESS_ASSERT(); ! ts->st.ticker = ts->st.interval; ! if (prev != NULL) { ! prev->recursion_depth = ts->recursion_depth; /* note: nesting_level is handled in cstack_new */ ! prev->flags = ts->st.flags; ! prev->f.frame = ts->frame; assert(prev->tempval == NULL); prev->tempval = retval; cstprev = &prev->cstate; ! } else cstprev = NULL; ! NOTIFY_SCHEDULE(prev, next, NULL); ! if (!next->flags.blocked) /* that must be done by the channel */ ! ts->st.current = next; ! if (ts->exc_type == Py_None) { ! Py_XDECREF(ts->exc_type); ! ts->exc_type = NULL; ! } ts->recursion_depth = next->recursion_depth; ts->st.flags = next->flags; --- 145,171 ---- STACKLESS_ASSERT(); ! ts->st.ticker = ts->st.interval; ! if (prev != NULL) { ! prev->recursion_depth = ts->recursion_depth; /* note: nesting_level is handled in cstack_new */ ! prev->flags = ts->st.flags; ! prev->f.frame = ts->frame; assert(prev->tempval == NULL); prev->tempval = retval; cstprev = &prev->cstate; ! } else cstprev = NULL; ! NOTIFY_SCHEDULE(prev, next, NULL); ! if (!next->flags.blocked) /* that must be done by the channel */ ! ts->st.current = next; ! if (ts->exc_type == Py_None) { ! Py_XDECREF(ts->exc_type); ! ts->exc_type = NULL; ! } ts->recursion_depth = next->recursion_depth; ts->st.flags = next->flags; *************** *** 166,181 **** next->f.frame = NULL; ! ++ts->st.nesting_level; ! if ((ts->exc_type != NULL ? transfer_with_exc : slp_transfer)(cstprev, next->cstate, prev) == 0) { ! --ts->st.nesting_level; retval = prev->tempval; prev->tempval = NULL; ! return retval; ! } ! else { ! --ts->st.nesting_level; ! kill_wrap_bad_guy(prev, next); ! return NULL; ! } } --- 173,189 ---- next->f.frame = NULL; ! ++ts->st.nesting_level; ! if ((ts->exc_type != NULL ? transfer_with_exc : slp_transfer)( ! cstprev, next->cstate, prev) == 0) { ! --ts->st.nesting_level; retval = prev->tempval; prev->tempval = NULL; ! return retval; ! } ! else { ! --ts->st.nesting_level; ! kill_wrap_bad_guy(prev, next); ! return NULL; ! } } *************** *** 183,192 **** typedef struct _exc_frame { ! PyBaseFrameObject bf; ! PyObject *exc_type; ! PyObject *exc_value; ! PyObject *exc_traceback; } exc_frame; ! #define EXC_FRAME_SIZE ((sizeof(exc_frame)-sizeof(PyBaseFrameObject))/sizeof(PyObject*)) --- 191,201 ---- typedef struct _exc_frame { ! PyBaseFrameObject bf; ! PyObject *exc_type; ! PyObject *exc_value; ! PyObject *exc_traceback; } exc_frame; ! #define EXC_FRAME_SIZE ((sizeof(exc_frame) - \ ! sizeof(PyBaseFrameObject))/sizeof(PyObject*)) *************** *** 194,207 **** restore_exception(PyFrameObject *f, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ! exc_frame *ef = (exc_frame *) f; ! f = ef->bf.f_back; ! ts->exc_type = ef->exc_type; ! ts->exc_value = ef->exc_value; ! ts->exc_traceback = ef->exc_traceback; ! ef->exc_type = ef->exc_traceback = ef->exc_value = NULL; ! Py_DECREF((PyFrameObject *)ef); ! ts->frame = f; ! return STACKLESS_PACK(retval); } --- 203,217 ---- restore_exception(PyFrameObject *f, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ! exc_frame *ef = (exc_frame *) f; ! ! f = ef->bf.f_back; ! ts->exc_type = ef->exc_type; ! ts->exc_value = ef->exc_value; ! ts->exc_traceback = ef->exc_traceback; ! ef->exc_type = ef->exc_traceback = ef->exc_value = NULL; ! Py_DECREF((PyFrameObject *)ef); ! ts->frame = f; ! return STACKLESS_PACK(retval); } *************** *** 211,219 **** jump_soft_to_hard(PyFrameObject *f, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ts->frame = f->f_back; Py_DECREF(f); ts->st.current->tempval = retval; ! slp_transfer(NULL, ts->st.current->cstate, NULL); /* we either have an error or don't come back, so: */ return NULL; --- 221,230 ---- jump_soft_to_hard(PyFrameObject *f, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ! ts->frame = f->f_back; Py_DECREF(f); ts->st.current->tempval = retval; ! slp_transfer(NULL, ts->st.current->cstate, NULL); /* we either have an error or don't come back, so: */ return NULL; *************** *** 223,240 **** slp_schedule_nr_maybe(PyTaskletObject *prev, PyTaskletObject *next, PyObject *retval) { /* * we check if we can do a non-recursive transfer. ! * ! * retval == 0 --> can't do it ! * retval == 1 --> ready to take off ! * retval == -1 --> exception occoured * * In order to save stack space, we don't call ! * the stack switch, but leave it to the caller. */ - PyThreadState *ts = PyThreadState_GET(); ! if (!slp_enable_softswitch) ! return retval; if (ts->st.nesting_level != 0) return retval; --- 234,252 ---- slp_schedule_nr_maybe(PyTaskletObject *prev, PyTaskletObject *next, PyObject *retval) { + PyThreadState *ts = PyThreadState_GET(); + /* * we check if we can do a non-recursive transfer. ! * ! * retval == 0 --> can't do it ! * retval == 1 --> ready to take off ! * retval == -1 --> exception occoured * * In order to save stack space, we don't call ! * the stack switch, but leave it to the caller. */ ! if (!slp_enable_softswitch) ! return retval; if (ts->st.nesting_level != 0) return retval; *************** *** 244,252 **** } ! ts->st.ticker = ts->st.interval; ! if (prev != NULL) { ! prev->recursion_depth = ts->recursion_depth; ! prev->flags = ts->st.flags; assert(prev->tempval == NULL); prev->tempval = retval; --- 256,264 ---- } ! ts->st.ticker = ts->st.interval; ! if (prev != NULL) { ! prev->recursion_depth = ts->recursion_depth; ! prev->flags = ts->st.flags; assert(prev->tempval == NULL); prev->tempval = retval; *************** *** 257,295 **** } ! /* handle exception */ ! if (ts->exc_type == Py_None) { ! Py_XDECREF(ts->exc_type); ! ts->exc_type = NULL; ! } ! else if (ts->exc_type != NULL) { ! /* build a shadow frame */ ! exc_frame *f = (exc_frame *) slp_baseframe_new(restore_exception, 1, EXC_FRAME_SIZE); ! if (f == NULL) ! return NULL; ! f->exc_type = ts->exc_type; ! f->exc_value = ts->exc_value; ! f->exc_traceback = ts->exc_traceback; ! ts->frame = (PyFrameObject *) f; ! ts->exc_type = ts->exc_value = ts->exc_traceback = NULL; ! } ! prev->f.frame = ts->frame; ! } ! if (next->topframe != NULL && next->topframe->f_back == NULL) { ! /* this is a new tasklet. Provide the runner */ ! PyFrameObject *f = next->f.frame; ! PyFrameObject *runner; ! assert(f->f_back == NULL); ! runner = ts->st.tasklet_runner; ! f->f_back = runner; Py_INCREF(runner); ! } ! ts->frame = next->f.frame; next->f.frame = NULL; ! assert(next->cstate != NULL); if (next->cstate->nesting_level != 0) { /* create a helper frame to restore the target stack */ ! ts->frame = (PyFrameObject *) slp_baseframe_new(jump_soft_to_hard, 1, 0); if (ts->frame == NULL) { ts->frame = prev->f.frame; --- 269,311 ---- } ! /* handle exception */ ! if (ts->exc_type == Py_None) { ! Py_XDECREF(ts->exc_type); ! ts->exc_type = NULL; ! } ! else if (ts->exc_type != NULL) { ! /* build a shadow frame */ ! exc_frame *f = (exc_frame *) slp_baseframe_new( ! restore_exception, 1, EXC_FRAME_SIZE); ! if (f == NULL) ! return NULL; ! f->exc_type = ts->exc_type; ! f->exc_value = ts->exc_value; ! f->exc_traceback = ts->exc_traceback; ! ts->frame = (PyFrameObject *) f; ! ts->exc_type = ts->exc_value = ! ts->exc_traceback = NULL; ! } ! prev->f.frame = ts->frame; ! } ! if (next->topframe != NULL && next->topframe->f_back == NULL) { ! /* this is a new tasklet. Provide the runner */ ! PyFrameObject *f = next->f.frame; ! PyFrameObject *runner; ! ! assert(f->f_back == NULL); ! runner = ts->st.tasklet_runner; ! f->f_back = runner; Py_INCREF(runner); ! } ! ts->frame = next->f.frame; next->f.frame = NULL; ! assert(next->cstate != NULL); if (next->cstate->nesting_level != 0) { /* create a helper frame to restore the target stack */ ! ts->frame = (PyFrameObject *) ! slp_baseframe_new(jump_soft_to_hard, 1, 0); if (ts->frame == NULL) { ts->frame = prev->f.frame; *************** *** 298,305 **** } ! ts->st.flags = next->flags; ! ts->recursion_depth = next->recursion_depth; ! NOTIFY_SCHEDULE(prev, next, NULL); ts->st.current = next; --- 314,321 ---- } ! ts->st.flags = next->flags; ! ts->recursion_depth = next->recursion_depth; ! NOTIFY_SCHEDULE(prev, next, NULL); ts->st.current = next; *************** *** 314,325 **** load_state_from_task(PyTaskletObject *task) { ! PyThreadState *ts = PyThreadState_GET(); ! assert(PyTasklet_Check(task)); ! ts->st.flags = task->flags; ! ts->recursion_depth = task->recursion_depth; ! assert(task->cstate != NULL); ! ts->st.nesting_level = task->cstate->nesting_level; ! ts->frame = task->f.frame; ! return task->f.frame; } --- 330,342 ---- load_state_from_task(PyTaskletObject *task) { ! PyThreadState *ts = PyThreadState_GET(); ! ! assert(PyTasklet_Check(task)); ! ts->st.flags = task->flags; ! ts->recursion_depth = task->recursion_depth; ! assert(task->cstate != NULL); ! ts->st.nesting_level = task->cstate->nesting_level; ! ts->frame = task->f.frame; ! return task->f.frame; } *************** *** 333,344 **** slp_revive_main(void) { ! PyThreadState *ts = PyThreadState_GET(); ! assert(ts->st.main->f.frame != NULL); ! if (ts->st.main->next == NULL) { ! Py_INCREF(ts->st.main); ! slp_current_insert(ts->st.main); ! return 0; ! } ! return -1; } --- 350,362 ---- slp_revive_main(void) { ! PyThreadState *ts = PyThreadState_GET(); ! ! assert(ts->st.main->f.frame != NULL); ! if (ts->st.main->next == NULL) { ! Py_INCREF(ts->st.main); ! slp_current_insert(ts->st.main); ! return 0; ! } ! return -1; } *************** *** 349,359 **** initialize_main_and_current(PyFrameObject *f) { ! PyThreadState *ts = PyThreadState_GET(); ! PyTaskletObject *task; ! PyObject *noargs; PyBaseFrameObject *runner; ! /* refuse executing main in an unhandled error context */ ! if (! (PyErr_Occurred() == NULL || PyErr_Occurred() == Py_None) ) { #ifdef _DEBUG PyObject *type, *value, *traceback; --- 367,377 ---- initialize_main_and_current(PyFrameObject *f) { ! PyThreadState *ts = PyThreadState_GET(); ! PyTaskletObject *task; ! PyObject *noargs; PyBaseFrameObject *runner; ! /* refuse executing main in an unhandled error context */ ! if (! (PyErr_Occurred() == NULL || PyErr_Occurred() == Py_None) ) { #ifdef _DEBUG PyObject *type, *value, *traceback; *************** *** 365,369 **** printf("Pending error while entering Stackless subsystem:\n"); PyErr_Print(); ! printf("Above exception is re-raised and passed to the caller.\n"); PyErr_Restore(type, value, traceback); #endif --- 383,387 ---- printf("Pending error while entering Stackless subsystem:\n"); PyErr_Print(); ! printf("Above exception is re-raised to the caller.\n"); PyErr_Restore(type, value, traceback); #endif *************** *** 377,403 **** return -1; ts->st.tasklet_runner = (PyFrameObject *) runner; ! Py_INCREF(runner); } ! noargs = PyTuple_New(0); ! task = (PyTaskletObject *) PyTasklet_Type.tp_new(&PyTasklet_Type, noargs, NULL); ! Py_DECREF(noargs); ! if (task == NULL) return -1; Py_INCREF(Py_None); task->tempval = Py_None; ! task->f.frame = f; ! task->topframe = f; Py_INCREF(f); ! assert(task->cstate != NULL); task->cstate->task = task; ! load_state_from_task(task); ! ts->st.main = task; ! Py_INCREF(task); ! slp_current_insert(task); ts->st.current = task; ! NOTIFY_SCHEDULE(NULL, task, -1); ! return 0; } --- 395,422 ---- return -1; ts->st.tasklet_runner = (PyFrameObject *) runner; ! Py_INCREF(runner); } ! noargs = PyTuple_New(0); ! task = (PyTaskletObject *) PyTasklet_Type.tp_new( ! &PyTasklet_Type, noargs, NULL); ! Py_DECREF(noargs); ! if (task == NULL) return -1; Py_INCREF(Py_None); task->tempval = Py_None; ! task->f.frame = f; ! task->topframe = f; Py_INCREF(f); ! assert(task->cstate != NULL); task->cstate->task = task; ! load_state_from_task(task); ! ts->st.main = task; ! Py_INCREF(task); ! slp_current_insert(task); ts->st.current = task; ! NOTIFY_SCHEDULE(NULL, task, -1); ! return 0; } *************** *** 406,420 **** tasklet_end(PyFrameObject *runner, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ! PyTaskletObject *task = ts->st.current; ! int ismain = task == ts->st.main; ! if (ismain) { ! /* See whether we need to adjust main's context before returning */ ! if (ts->st.serial_last_jump != ts->st.serial) { task->tempval = retval; ! slp_transfer_return(ts->st.current->cstate); ! } /* this hack can attach us to ourselves :( */ if (runner->f_back != NULL) { --- 425,442 ---- tasklet_end(PyFrameObject *runner, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ! PyTaskletObject *task = ts->st.current; ! int ismain = task == ts->st.main; ! if (ismain) { ! /* ! * See whether we need to adjust main's context before ! * returning ! */ ! if (ts->st.serial_last_jump != ts->st.serial) { task->tempval = retval; ! slp_transfer_return(ts->st.current->cstate); ! } /* this hack can attach us to ourselves :( */ if (runner->f_back != NULL) { *************** *** 423,431 **** runner->f_back = NULL; } ! } ! /* these may need to be updated */ ! task->f.frame = task->topframe; ! task->flags = ts->st.flags; task->recursion_depth = 0; --- 445,453 ---- runner->f_back = NULL; } ! } ! /* these may need to be updated */ ! task->f.frame = task->topframe; ! task->flags = ts->st.flags; task->recursion_depth = 0; *************** *** 441,445 **** if (retval == NULL && PyErr_Occurred() && ! PyErr_ExceptionMatches(PyExc_TaskletExit)) { PyErr_Clear(); Py_INCREF(Py_None); --- 463,467 ---- if (retval == NULL && PyErr_Occurred() && ! PyErr_ExceptionMatches(PyExc_TaskletExit)) { PyErr_Clear(); Py_INCREF(Py_None); *************** *** 448,482 **** /* notify before destroying anything */ ! NOTIFY_SCHEDULE(task, NULL, NULL); ! /* clear the tasklet, while leaving it in place */ task->f.frame = NULL; /* avoid decref */ task->topframe = NULL; /* avoid a kill() */ ! task->ob_type->tp_clear((PyObject *)task); /* also clear the frame but leave it in place */ ! ++ts->recursion_depth; ts->frame->ob_type->tp_clear((PyObject *)ts->frame); ! --ts->recursion_depth; ! /* let the task dealloc the frame. ! Note that the frame *could* have been assigned ! already due to a switch during dealloc, so we ! just enforce it. */ task->f.frame = ts->frame; ts->frame = NULL; /* safely clear again, now with frame */ ! task->ob_type->tp_clear((PyObject *)task); ! /* ! * clean up any current exception - this tasklet is dead. ! * This only happens if we are killing tasklets in the middle * of their execution. ! */ ! if (ts->exc_type != NULL && ts->exc_type != Py_None) { ! Py_DECREF(ts->exc_type); ! Py_XDECREF(ts->exc_value); ! Py_XDECREF(ts->exc_traceback); ! ts->exc_type = ts->exc_value = ts->exc_traceback = NULL; ! } /* --- 470,505 ---- /* notify before destroying anything */ ! NOTIFY_SCHEDULE(task, NULL, NULL); ! /* clear the tasklet, while leaving it in place */ task->f.frame = NULL; /* avoid decref */ task->topframe = NULL; /* avoid a kill() */ ! task->ob_type->tp_clear((PyObject *)task); /* also clear the frame but leave it in place */ ! ++ts->recursion_depth; ts->frame->ob_type->tp_clear((PyObject *)ts->frame); ! --ts->recursion_depth; ! /* ! * let the task dealloc the frame. ! * Note that the frame *could* have been assigned ! * already due to a switch during dealloc, so we ! * just enforce it. */ task->f.frame = ts->frame; ts->frame = NULL; /* safely clear again, now with frame */ ! task->ob_type->tp_clear((PyObject *)task); ! /* ! * clean up any current exception - this tasklet is dead. ! * This only happens if we are killing tasklets in the middle * of their execution. ! */ ! if (ts->exc_type != NULL && ts->exc_type != Py_None) { ! Py_DECREF(ts->exc_type); ! Py_XDECREF(ts->exc_value); ! Py_XDECREF(ts->exc_traceback); ! ts->exc_type = ts->exc_value = ts->exc_traceback = NULL; ! } /* *************** *** 490,513 **** Py_DECREF(task); ! /* capture all exceptions */ ! if (ismain) { ! /* ! * Main wants to exit. We clean up, but leave the ! * runnables chain intact. ! */ ts->st.main = NULL; retval = task->tempval; Py_XINCREF(retval); ! Py_DECREF(task); ! return retval; ! } ! if (ts->st.runcount == 0) { ! if (slp_revive_main()) { /* main is blocked and nobody can send */ if (ts->st.main->flags.blocked < 0) ! RUNTIME_ERROR("the main tasklet is receiving without a sender available.", NULL); else ! RUNTIME_ERROR("the main tasklet is sending without a receiver available.", NULL); /* fall through to error handling */ retval = NULL; --- 513,538 ---- Py_DECREF(task); ! /* capture all exceptions */ ! if (ismain) { ! /* ! * Main wants to exit. We clean up, but leave the ! * runnables chain intact. ! */ ts->st.main = NULL; retval = task->tempval; Py_XINCREF(retval); ! Py_DECREF(task); ! return retval; ! } ! if (ts->st.runcount == 0) { ! if (slp_revive_main()) { /* main is blocked and nobody can send */ if (ts->st.main->flags.blocked < 0) ! RUNTIME_ERROR("the main tasklet is receiving" ! " without a sender available.", NULL); else ! RUNTIME_ERROR("the main tasklet is sending" ! " without a receiver available.", NULL); /* fall through to error handling */ retval = NULL; *************** *** 515,525 **** } ! assert(ts->st.runcount > 0 || ts->st.main->flags.blocked); ! if (retval == NULL) { ! /* ! * error handling: continue in the context of the main tasklet. ! */ ! slp_revive_main(); /* propagate error */ if (ts->st.main->tempval != NULL) { --- 540,550 ---- } ! assert(ts->st.runcount > 0 || ts->st.main->flags.blocked); ! if (retval == NULL) { ! /* ! * error handling: continue in the context of the main tasklet. ! */ ! slp_revive_main(); /* propagate error */ if (ts->st.main->tempval != NULL) { *************** *** 528,536 **** } return slp_schedule_task(NULL, ts->st.main, 1, NULL); ! /* we do not come back here */ ! } ! assert(ts->st.current->f.frame != NULL); ! assert(ts->st.current->f.frame->ob_refcnt > 0); return slp_schedule_task(NULL, ts->st.current, 1, retval); --- 553,561 ---- } return slp_schedule_task(NULL, ts->st.main, 1, NULL); ! /* we do not come back here */ ! } ! assert(ts->st.current->f.frame != NULL); ! assert(ts->st.current->f.frame->ob_refcnt > 0); return slp_schedule_task(NULL, ts->st.current, 1, retval); *************** *** 547,554 **** slp_resume_tasklet(PyFrameObject *f) { ! PyThreadState *ts = PyThreadState_GET(); PyObject *retval = ts->st.current->tempval; ts->st.current->tempval = NULL; ! return slp_frame_dispatch_top(f, retval); } --- 572,580 ---- slp_resume_tasklet(PyFrameObject *f) { ! PyThreadState *ts = PyThreadState_GET(); ! PyObject *retval = ts->st.current->tempval; ts->st.current->tempval = NULL; ! return slp_frame_dispatch_top(f, retval); } *************** *** 556,564 **** slp_run_tasklet(PyFrameObject *f) { ! PyThreadState *ts = PyThreadState_GET(); PyFrameObject *runner; ! if ( (ts->st.main == NULL) && initialize_main_and_current(f)) { ts->frame = NULL; ! return NULL; } --- 582,591 ---- slp_run_tasklet(PyFrameObject *f) { ! PyThreadState *ts = PyThreadState_GET(); ! PyFrameObject *runner; ! if ( (ts->st.main == NULL) && initialize_main_and_current(f)) { ts->frame = NULL; ! return NULL; } *************** *** 569,573 **** Py_INCREF(runner); } ! return slp_resume_tasklet(f); } #endif --- 596,600 ---- Py_INCREF(runner); } ! return slp_resume_tasklet(f); } #endif Index: slp_transfer.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/slp_transfer.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** slp_transfer.c 19 Apr 2004 16:13:31 -0000 1.19 --- slp_transfer.c 24 Apr 2004 23:29:39 -0000 1.20 *************** *** 24,40 **** #define SLP_SAVE_STATE(stackref, stsizediff) \ ! int stsizeb; \ stackref += STACK_MAGIC; \ ! if (_cstprev != NULL) { \ ! if (slp_cstack_new(_cstprev, stackref, _prev) == NULL) return -1; \ ! stsizeb = slp_cstack_save(*_cstprev); \ ! } \ ! else \ ! stsizeb = (_cst->startaddr - stackref) * sizeof(int*); \ ! if (_cst == NULL) return 0; \ ! stsizediff = stsizeb - (_cst->ob_size * sizeof(int*)); #define SLP_RESTORE_STATE() \ ! if (_cst != NULL) { \ slp_cstack_restore(_cst); \ _cst->tstate->st.nesting_level = _cst->nesting_level; \ --- 24,42 ---- #define SLP_SAVE_STATE(stackref, stsizediff) \ ! int stsizeb; \ ! \ stackref += STACK_MAGIC; \ ! if (_cstprev != NULL) { \ ! if (slp_cstack_new(_cstprev, stackref, _prev) == NULL) \ ! return -1; \ ! stsizeb = slp_cstack_save(*_cstprev); \ ! } \ ! else \ ! stsizeb = (_cst->startaddr - stackref) * sizeof(int*); \ ! if (_cst == NULL) return 0; \ ! stsizediff = stsizeb - (_cst->ob_size * sizeof(int*)); #define SLP_RESTORE_STATE() \ ! if (_cst != NULL) { \ slp_cstack_restore(_cst); \ _cst->tstate->st.nesting_level = _cst->nesting_level; \ *************** *** 46,80 **** static int ! climb_stack_and_transfer(PyCStackObject **cstprev, PyCStackObject *cst, PyTaskletObject *prev) { ! /* ! * there are cases where we have been initialized ! * in some deep stack recursion, but later on we ! * need to switch from a higher stacklevel, and the ! * needed stack size becomes *negative* :-)) ! */ ! PyThreadState *ts = PyThreadState_GET(); ! int probe; ! int needed = &probe - ts->st.cstack_base; ! /* in rare cases, the need might have vanished due to the recursion */ ! int * goobledigoobs; ! if (needed > 0) { ! goobledigoobs = alloca(needed * sizeof(int)); ! if (goobledigoobs == NULL) ! return -1; ! } ! return slp_transfer(cstprev, cst, prev); } int ! slp_transfer(PyCStackObject **cstprev, PyCStackObject *cst, PyTaskletObject *prev) { ! PyThreadState *ts = PyThreadState_GET(); /* since we change the stack we must assure that the protocol was met */ STACKLESS_ASSERT(); ! if ((int*) &ts > ts->st.cstack_base) ! return climb_stack_and_transfer(cstprev, cst, prev); if (cst == NULL) cst = ts->st.initial_stub; --- 48,85 ---- static int ! climb_stack_and_transfer(PyCStackObject **cstprev, PyCStackObject *cst, ! PyTaskletObject *prev) { ! /* ! * there are cases where we have been initialized ! * in some deep stack recursion, but later on we ! * need to switch from a higher stacklevel, and the ! * needed stack size becomes *negative* :-)) ! */ ! PyThreadState *ts = PyThreadState_GET(); ! int probe; ! int needed = &probe - ts->st.cstack_base; ! ! /* in rare cases, the need might have vanished due to the recursion */ ! int * goobledigoobs; ! if (needed > 0) { ! goobledigoobs = alloca(needed * sizeof(int)); ! if (goobledigoobs == NULL) ! return -1; ! } ! return slp_transfer(cstprev, cst, prev); } int ! slp_transfer(PyCStackObject **cstprev, PyCStackObject *cst, ! PyTaskletObject *prev) { ! PyThreadState *ts = PyThreadState_GET(); /* since we change the stack we must assure that the protocol was met */ STACKLESS_ASSERT(); ! if ((int*) &ts > ts->st.cstack_base) ! return climb_stack_and_transfer(cstprev, cst, prev); if (cst == NULL) cst = ts->st.initial_stub; *************** *** 90,99 **** return -1; } ! /* record the context of the target stack */ ! ts->st.serial_last_jump = cst->serial; /* * if stacks are same and refcount==1, it must be the same ! * task. In this case, we would destroy the target before switching. ! * Therefore, we simply don't switch, just save. */ if (cstprev && *cstprev == cst && cst->ob_refcnt == 1) --- 95,104 ---- return -1; } ! /* record the context of the target stack */ ! ts->st.serial_last_jump = cst->serial; /* * if stacks are same and refcount==1, it must be the same ! * task. In this case, we would destroy the target before ! * switching. Therefore, we simply don't switch, just save. */ if (cstprev && *cstprev == cst && cst->ob_refcnt == 1) *************** *** 102,107 **** _cstprev = cstprev; _cst = cst; ! _prev = prev; ! return slp_switch(); } --- 107,112 ---- _cstprev = cstprev; _cst = cst; ! _prev = prev; ! return slp_switch(); } Index: stackless_api.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_api.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** stackless_api.h 18 Apr 2004 12:43:09 -0000 1.28 --- stackless_api.h 24 Apr 2004 23:29:39 -0000 1.29 *************** *** 20,33 **** Ternary return from an integer function: ! value meaning action ! -1 failure return NULL ! 1 soft switched return Py_UnwindToken ! 0 hard switched return Py_None Ternary return from a PyObject * function: ! value meaning action ! NULL failure return NULL Py_UnwindToken soft switched return Py_UnwindToken ! other hard switched return value Note: Py_UnwindToken is *never* inc/decref'ed. --- 20,33 ---- Ternary return from an integer function: ! value meaning action ! -1 failure return NULL ! 1 soft switched return Py_UnwindToken ! 0 hard switched return Py_None Ternary return from a PyObject * function: ! value meaning action ! NULL failure return NULL Py_UnwindToken soft switched return Py_UnwindToken ! other hard switched return value Note: Py_UnwindToken is *never* inc/decref'ed. *************** *** 44,48 **** */ PyAPI_FUNC(PyTaskletObject *) PyTasklet_New(PyTypeObject *type, PyObject *func); ! /* 0 = success -1 = failure */ /* --- 44,48 ---- */ PyAPI_FUNC(PyTaskletObject *) PyTasklet_New(PyTypeObject *type, PyObject *func); ! /* 0 = success -1 = failure */ /* *************** *** 56,60 **** */ PyAPI_FUNC(int) PyTasklet_Run(PyTaskletObject *task); ! /* 0 = success -1 = failure */ PyAPI_FUNC(int) PyTasklet_Run_nr(PyTaskletObject *task); /* 1 = soft switched 0 = hard switched -1 = failure */ --- 56,60 ---- */ PyAPI_FUNC(int) PyTasklet_Run(PyTaskletObject *task); ! /* 0 = success -1 = failure */ PyAPI_FUNC(int) PyTasklet_Run_nr(PyTaskletObject *task); /* 1 = soft switched 0 = hard switched -1 = failure */ *************** *** 67,71 **** */ PyAPI_FUNC(int) PyTasklet_Remove(PyTaskletObject *task); ! /* 0 = success -1 = failure */ /* --- 67,71 ---- */ PyAPI_FUNC(int) PyTasklet_Remove(PyTaskletObject *task); ! /* 0 = success -1 = failure */ /* *************** *** 75,79 **** */ PyAPI_FUNC(int) PyTasklet_Insert(PyTaskletObject *task); ! /* 0 = success -1 = failure */ /* --- 75,79 ---- */ PyAPI_FUNC(int) PyTasklet_Insert(PyTaskletObject *task); ! /* 0 = success -1 = failure */ /* *************** *** 85,89 **** * It is either NULL, or Py_UnwindToken, and we leave eval_code. */ ! PyAPI_FUNC(PyObject *) PyTasklet_Become(PyTaskletObject *self, PyObject *retval); /* PyUnwindToken = success NULL = failure */ --- 85,90 ---- * It is either NULL, or Py_UnwindToken, and we leave eval_code. */ ! PyAPI_FUNC(PyObject *) PyTasklet_Become(PyTaskletObject *self, ! PyObject *retval); /* PyUnwindToken = success NULL = failure */ *************** *** 95,99 **** * It is either NULL, or Py_UnwindToken, and we leave eval_code. */ ! PyAPI_FUNC(PyObject *) PyTasklet_Capture(PyTaskletObject *self, PyObject *retval); /* PyUnwindToken = success NULL = failure */ --- 96,101 ---- * It is either NULL, or Py_UnwindToken, and we leave eval_code. */ ! PyAPI_FUNC(PyObject *) PyTasklet_Capture(PyTaskletObject *self, ! PyObject *retval); /* PyUnwindToken = success NULL = failure */ *************** *** 108,113 **** PyAPI_FUNC(int) PyTasklet_RaiseException(PyTaskletObject *self, ! PyObject *klass, PyObject *args); ! /* 0 = success -1 = failure. * Note that this call always ends in some exception, so the * caller always should return NULL. --- 110,115 ---- PyAPI_FUNC(int) PyTasklet_RaiseException(PyTaskletObject *self, ! PyObject *klass, PyObject *args); ! /* 0 = success -1 = failure. * Note that this call always ends in some exception, so the * caller always should return NULL. *************** *** 122,126 **** PyAPI_FUNC(int) PyTasklet_Kill(PyTaskletObject *self); ! /* 0 = success -1 = failure. * Note that this call always ends in some exception, so the * caller always should return NULL. --- 124,128 ---- PyAPI_FUNC(int) PyTasklet_Kill(PyTaskletObject *self); ! /* 0 = success -1 = failure. * Note that this call always ends in some exception, so the * caller always should return NULL. *************** *** 207,211 **** */ PyAPI_FUNC(int) PyChannel_Send(PyChannelObject *self, PyObject *arg); ! /* 0 = success -1 = failure */ PyAPI_FUNC(int) PyChannel_Send_nr(PyChannelObject *self, PyObject *arg); --- 209,213 ---- */ PyAPI_FUNC(int) PyChannel_Send(PyChannelObject *self, PyObject *arg); ! /* 0 = success -1 = failure */ PyAPI_FUNC(int) PyChannel_Send_nr(PyChannelObject *self, PyObject *arg); *************** *** 226,232 **** * if nobody is listening, you will get blocked and scheduled. */ ! PyAPI_FUNC(int) PyChannel_SendException(PyChannelObject *self, PyObject *klass, PyObject *value); ! /* 0 = success -1 = failure */ ! PyAPI_FUNC(int) PyChannel_SendException_nr(PyChannelObject *self, PyObject *klass, PyObject *value); /* 1 = soft switched 0 = hard switched -1 = failure */ --- 228,236 ---- * if nobody is listening, you will get blocked and scheduled. */ ! PyAPI_FUNC(int) PyChannel_SendException(PyChannelObject *self, ! PyObject *klass, PyObject *value); ! /* 0 = success -1 = failure */ ! PyAPI_FUNC(int) PyChannel_SendException_nr(PyChannelObject *self, ! PyObject *klass, PyObject *value); /* 1 = soft switched 0 = hard switched -1 = failure */ *************** *** 335,344 **** * Run any callable as the "main" Python function. */ ! PyAPI_FUNC(PyObject *) PyStackless_Call_Main(PyObject *func, PyObject *args, PyObject *kwds); /* * Convenience: Run any method as the "main" Python function. */ ! PyAPI_FUNC(PyObject *) PyStackless_CallMethod_Main(PyObject *o, char *name, char *format, ...); --- 339,350 ---- * Run any callable as the "main" Python function. */ ! PyAPI_FUNC(PyObject *) PyStackless_Call_Main(PyObject *func, ! PyObject *args, PyObject *kwds); /* * Convenience: Run any method as the "main" Python function. */ ! PyAPI_FUNC(PyObject *) PyStackless_CallMethod_Main(PyObject *o, char *name, ! char *format, ...); Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** stackless_impl.h 23 Apr 2004 00:34:37 -0000 1.82 --- stackless_impl.h 24 Apr 2004 23:29:39 -0000 1.83 *************** *** 15,19 **** #include "flextype.h" - #include "stackless_frame.h" #include "stackless_structs.h" #include "prickelpit.h" --- 15,18 ---- *************** *** 30,34 **** #define Py_TPFLAGS_HAVE_STACKLESS_CALL \ ! (Py_TPFLAGS_HAVE_STACKLESS_EXTENSION & (Py_TPFLAGS_HAVE_STACKLESS_EXTENSION >> 1)) /******************************************************************** --- 29,48 ---- #define Py_TPFLAGS_HAVE_STACKLESS_CALL \ ! (Py_TPFLAGS_HAVE_STACKLESS_EXTENSION & \ ! (Py_TPFLAGS_HAVE_STACKLESS_EXTENSION >> 1)) ! ! /******************************************************************** ! * ! * This section defines/references stuff from cframeobject.c ! * ! ********************************************************************/ ! ! PyAPI_DATA(PyTypeObject) PyCFrame_Type; ! PyAPI_DATA(PyTypeObject) PyBaseFrame_Type; ! ! #define PyBaseFrame_Check(op) PyObject_TypeCheck(op, &PyBaseFrame_Type) ! #define PyBaseFrame_CheckExact(op) ((op)->ob_type == &PyBaseFrame_Type) ! #define PyCFrame_Check(op) PyObject_TypeCheck(op, &PyCFrame_Type) ! #define PyCFrame_CheckExact(op) ((op)->ob_type == &PyCFrame_Type) /******************************************************************** *************** *** 43,51 **** PyAPI_DATA(int) slp_try_stackless; ! PyAPI_FUNC(PyCStackObject *) slp_cstack_new(PyCStackObject **cst, int *stackref, PyTaskletObject *task); PyAPI_FUNC(int) slp_cstack_save(PyCStackObject *cstprev); PyAPI_FUNC(void) slp_cstack_restore(PyCStackObject *cst); ! PyAPI_FUNC(int) slp_transfer(PyCStackObject **cstprev, PyCStackObject *cst, PyTaskletObject *prev); #ifdef Py_DEBUG --- 57,68 ---- PyAPI_DATA(int) slp_try_stackless; ! PyAPI_FUNC(PyCStackObject *) slp_cstack_new(PyCStackObject **cst, ! int *stackref, ! PyTaskletObject *task); PyAPI_FUNC(int) slp_cstack_save(PyCStackObject *cstprev); PyAPI_FUNC(void) slp_cstack_restore(PyCStackObject *cst); ! PyAPI_FUNC(int) slp_transfer(PyCStackObject **cstprev, PyCStackObject *cst, ! PyTaskletObject *prev); #ifdef Py_DEBUG *************** *** 53,57 **** #else #define slp_transfer_return(cst) \ ! slp_transfer(NULL, (cst), NULL) #endif --- 70,74 ---- #else #define slp_transfer_return(cst) \ ! slp_transfer(NULL, (cst), NULL) #endif *************** *** 69,90 **** /* the frame dispatcher */ ! PyAPI_FUNC(PyObject *) slp_frame_dispatch(PyFrameObject *f, PyFrameObject *stopframe, PyObject *retval); /* the frame dispatcher for toplevel tasklets */ ! PyAPI_FUNC(PyObject *) slp_frame_dispatch_top(PyFrameObject *f, PyObject *retval); /* the now exported eval_frame */ ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *f, PyObject *retval); /* the new eval_frame loop with or without value or resuming an iterator */ ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_value(struct _frame *f, PyObject *retval); ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_noval(struct _frame *f, PyObject *retval); ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_iter(struct _frame *f, PyObject *retval); /* rebirth of software stack avoidance */ typedef struct { ! PyObject_HEAD ! PyObject *tempval; } PyUnwindObject; --- 86,114 ---- /* the frame dispatcher */ ! PyAPI_FUNC(PyObject *) slp_frame_dispatch(PyFrameObject *f, ! PyFrameObject *stopframe, ! PyObject *retval); /* the frame dispatcher for toplevel tasklets */ ! PyAPI_FUNC(PyObject *) slp_frame_dispatch_top(PyFrameObject *f, ! PyObject *retval); /* the now exported eval_frame */ ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *f, ! PyObject *retval); /* the new eval_frame loop with or without value or resuming an iterator */ ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_value(struct _frame *f, ! PyObject *retval); ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_noval(struct _frame *f, ! PyObject *retval); ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_iter(struct _frame *f, ! PyObject *retval); /* rebirth of software stack avoidance */ typedef struct { ! PyObject_HEAD ! PyObject *tempval; } PyUnwindObject; *************** *** 113,117 **** #define STACKLESS_PACK(retval) \ (assert(Py_UnwindToken->tempval == NULL), \ ! Py_UnwindToken->tempval = (retval), \ (PyObject *) Py_UnwindToken) --- 137,141 ---- #define STACKLESS_PACK(retval) \ (assert(Py_UnwindToken->tempval == NULL), \ ! Py_UnwindToken->tempval = (retval), \ (PyObject *) Py_UnwindToken) *************** *** 124,128 **** #define STACKLESS_PACK(retval) \ ! (Py_UnwindToken->tempval = (retval), \ (PyObject *) Py_UnwindToken) --- 148,152 ---- #define STACKLESS_PACK(retval) \ ! (Py_UnwindToken->tempval = (retval), \ (PyObject *) Py_UnwindToken) *************** *** 137,145 **** /* macros for setting/resetting the stackless flag */ ! #define STACKLESS_GETARG() int stackless = (stackless = slp_try_stackless, slp_try_stackless = 0, stackless) #define STACKLESS_PROMOTE(func) \ ! (stackless ? slp_try_stackless = \ ! (func)->ob_type->tp_flags & Py_TPFLAGS_HAVE_STACKLESS_CALL : 0) #define STACKLESS_PROMOTE_FLAG(flag) \ --- 161,170 ---- /* macros for setting/resetting the stackless flag */ ! #define STACKLESS_GETARG() int stackless = (stackless = slp_try_stackless, \ ! slp_try_stackless = 0, stackless) #define STACKLESS_PROMOTE(func) \ ! (stackless ? slp_try_stackless = \ ! (func)->ob_type->tp_flags & Py_TPFLAGS_HAVE_STACKLESS_CALL : 0) #define STACKLESS_PROMOTE_FLAG(flag) \ *************** *** 150,154 **** #define STACKLESS_PROPOSE(func) {int stackless = 1; STACKLESS_PROMOTE(func);} ! #define STACKLESS_PROPOSE_FLAG(flag) {int stackless = 1; STACKLESS_PROMOTE_FLAG(flag);} #define STACKLESS_PROPOSE_ALL() slp_try_stackless = 1; --- 175,180 ---- #define STACKLESS_PROPOSE(func) {int stackless = 1; STACKLESS_PROMOTE(func);} ! #define STACKLESS_PROPOSE_FLAG(flag) {int stackless = 1; \ ! STACKLESS_PROMOTE_FLAG(flag);} #define STACKLESS_PROPOSE_ALL() slp_try_stackless = 1; *************** *** 237,276 **** #define SLP_CHAIN_INSERT(__objtype, __chain, __task, __next, __prev) \ { \ ! __objtype *l, *r; \ ! assert((__task)->__next == NULL); \ ! assert((__task)->__prev == NULL); \ ! if (*(__chain) == NULL) { \ ! (__task)->__next = (__task)->__prev = (__task); \ ! *(__chain) = (__task); \ ! } \ ! else { \ ! /* insert at end */ \ ! r = *(__chain); \ ! l = r->__prev; \ ! l->__next = r->__prev = (__task); \ ! (__task)->__prev = l; \ ! (__task)->__next = r; \ ! } \ } #define SLP_CHAIN_REMOVE(__objtype, __chain, __task, __next, __prev) \ { \ ! __objtype *l, *r; \ ! if (*(__chain) == NULL) { \ ! (__task) = NULL; \ ! } \ ! else { \ ! /* remove current */ \ ! (__task) = *(__chain); \ ! l = (__task)->__prev; \ ! r = (__task)->__next; \ ! l->__next = r; \ ! r->__prev = l; \ ! *(__chain) = r; \ ! if (*(__chain)==(__task)) \ ! *(__chain) = NULL; /* short circuit */ \ ! (__task)->__prev = NULL; \ ! (__task)->__next = NULL; \ ! } \ } --- 263,302 ---- #define SLP_CHAIN_INSERT(__objtype, __chain, __task, __next, __prev) \ { \ ! __objtype *l, *r; \ ! assert((__task)->__next == NULL); \ ! assert((__task)->__prev == NULL); \ ! if (*(__chain) == NULL) { \ ! (__task)->__next = (__task)->__prev = (__task); \ ! *(__chain) = (__task); \ ! } \ ! else { \ ! /* insert at end */ \ ! r = *(__chain); \ ! l = r->__prev; \ ! l->__next = r->__prev = (__task); \ ! (__task)->__prev = l; \ ! (__task)->__next = r; \ ! } \ } #define SLP_CHAIN_REMOVE(__objtype, __chain, __task, __next, __prev) \ { \ ! __objtype *l, *r; \ ! if (*(__chain) == NULL) { \ ! (__task) = NULL; \ ! } \ ! else { \ ! /* remove current */ \ ! (__task) = *(__chain); \ ! l = (__task)->__prev; \ ! r = (__task)->__next; \ ! l->__next = r; \ ! r->__prev = l; \ ! *(__chain) = r; \ ! if (*(__chain)==(__task)) \ ! *(__chain) = NULL; /* short circuit */ \ ! (__task)->__prev = NULL; \ ! (__task)->__next = NULL; \ ! } \ } *************** *** 280,291 **** PyAPI_FUNC(void) slp_current_insert_after(PyTaskletObject *task); PyAPI_FUNC(PyTaskletObject *) slp_current_remove(void); ! PyAPI_FUNC(void) slp_channel_insert(PyChannelObject *channel, PyTaskletObject *task, int dir); ! PyAPI_FUNC(PyTaskletObject) * slp_channel_remove(PyChannelObject *channel, int dir); ! PyAPI_FUNC(PyTaskletObject) * slp_channel_remove_specific(PyChannelObject *channel, int dir, PyTaskletObject *task); /* tasklet operations */ ! PyAPI_FUNC(PyObject *) slp_tasklet_new(PyTypeObject *type, PyObject *args, PyObject *kwds); ! PyAPI_FUNC(PyObject *) slp_schedule_task(PyTaskletObject *prev, PyTaskletObject *next, int stackless, PyObject *retval); PyAPI_FUNC(PyObject *) slp_run_tasklet(PyFrameObject *f); --- 306,324 ---- PyAPI_FUNC(void) slp_current_insert_after(PyTaskletObject *task); PyAPI_FUNC(PyTaskletObject *) slp_current_remove(void); ! PyAPI_FUNC(void) slp_channel_insert(PyChannelObject *channel, ! PyTaskletObject *task, int dir); ! PyAPI_FUNC(PyTaskletObject) * slp_channel_remove(PyChannelObject *channel, ! int dir); ! PyAPI_FUNC(PyTaskletObject) * slp_channel_remove_specific( ! PyChannelObject *channel, ! int dir, PyTaskletObject *task); /* tasklet operations */ ! PyAPI_FUNC(PyObject *) slp_tasklet_new(PyTypeObject *type, PyObject *args, ! PyObject *kwds); ! PyAPI_FUNC(PyObject *) slp_schedule_task(PyTaskletObject *prev, ! PyTaskletObject *next, ! int stackless, PyObject *retval); PyAPI_FUNC(PyObject *) slp_run_tasklet(PyFrameObject *f); *************** *** 315,321 **** #define VALUE_ERROR(str, ret) (slp_value_error(str), ret) ! PyAPI_FUNC(PyBaseFrameObject *) slp_baseframe_new(PyFrame_ExecFunc *exec, unsigned int linked, unsigned int extra); ! PyAPI_FUNC(PyCFrameObject *) slp_cframe_new(PyObject *func, PyObject *args, PyObject *kwds, unsigned int linked); PyAPI_FUNC(PyFrameObject *) slp_get_frame(PyTaskletObject *task); --- 348,358 ---- #define VALUE_ERROR(str, ret) (slp_value_error(str), ret) ! PyAPI_FUNC(PyBaseFrameObject *) slp_baseframe_new(PyFrame_ExecFunc *exec, ! unsigned int linked, unsigned int extra); ! PyAPI_FUNC(PyCFrameObject *) slp_cframe_new(PyObject *func, ! PyObject *args, ! PyObject *kwds, ! unsigned int linked); PyAPI_FUNC(PyFrameObject *) slp_get_frame(PyTaskletObject *task); *************** *** 324,328 **** PyAPI_FUNC(int) slp_return_wrapper(PyObject *retval); PyAPI_FUNC(int) slp_int_wrapper(PyObject *retval); ! PyAPI_FUNC(int) slp_current_wrapper( int(*func)(PyTaskletObject*), PyTaskletObject *task); PyAPI_FUNC(int) slp_revive_main(void); --- 361,366 ---- PyAPI_FUNC(int) slp_return_wrapper(PyObject *retval); PyAPI_FUNC(int) slp_int_wrapper(PyObject *retval); ! PyAPI_FUNC(int) slp_current_wrapper(int(*func)(PyTaskletObject*), ! PyTaskletObject *task); PyAPI_FUNC(int) slp_revive_main(void); *************** *** 330,338 **** PyAPI_FUNC(int) slp_safe_pickling(int(*save)(PyObject *, PyObject *, int), ! PyObject *self, PyObject *args, int pers_save); /* debugging/monitoring */ ! typedef void (slp_schedule_hook_func) (PyTaskletObject *from, PyTaskletObject *to); PyAPI_DATA(slp_schedule_hook_func) *_slp_schedule_fasthook; PyAPI_DATA(PyObject* ) _slp_schedule_hook; --- 368,378 ---- PyAPI_FUNC(int) slp_safe_pickling(int(*save)(PyObject *, PyObject *, int), ! PyObject *self, PyObject *args, ! int pers_save); /* debugging/monitoring */ ! typedef void (slp_schedule_hook_func) (PyTaskletObject *from, ! PyTaskletObject *to); PyAPI_DATA(slp_schedule_hook_func) *_slp_schedule_fasthook; PyAPI_DATA(PyObject* ) _slp_schedule_hook; Index: stackless_structs.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_structs.h,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** stackless_structs.h 23 Apr 2004 00:34:37 -0000 1.60 --- stackless_structs.h 24 Apr 2004 23:29:39 -0000 1.61 *************** *** 13,68 **** /*************************************************************************** ! Tasklet Flag Definition ! ----------------------- ! active: This tasklets is currently running. The frame ! and flags attributes of the tasklet are invalid ! and mapped to tstate. Maintenance of these fields ! is done during switching. ! This is now a computed attribute. ! atomic: If true, schedulers will never switch. Driven by ! the code object or dynamically, see below. ! scheduled: The tasklet likes to be auto-scheduled. User driven. ! blocked: The tasklet is either waiting in a channel for ! writing (1) or reading (-1) or not blocked(0). ! Maintained by the channel logic. Do not change. ! block_trap: Debugging aid. Whenever the tasklet would be ! blocked by a channel, an exception is raised. ! is_zombie: This tasklet is almost dead, its deallocation has ! started. The tasklet *must* die at some time, or the ! process can never end. Policy for atomic/schedule and switching: ! ----------------------------------------- ! A tasklet switch can always be done explicitly by calling schedule(). ! Atomic and schedule are concerned with automatic features. ! atomic scheduled ! 1 any Neither a scheduler nor a watchdog will ! try to switch this tasklet. ! 0 0 The tasklet can be stopped on desire, or it ! can be killed by an exception. ! 0 1 Like above, plus auto-scheduling is enabled. ! Default settings: ! ----------------- ! The default value of scheduled is taken from the global variable ! enable_scheduling in stacklessmodule. It can be set or cleared ! for every tasklet at any time. ! The value of atomic is normally calculated from the executed code ! object. Unless the code object has a special flag set, atomic ! will be saved on entry of the code object, set to true, and reset ! on exit. This protects you from crashing any unknown Python code. ! For known code objects, this mechanism can be turned off, and the ! atomic flag is under your control. ***************************************************************************/ --- 13,68 ---- /*************************************************************************** ! Tasklet Flag Definition ! ----------------------- ! active: This tasklets is currently running. The frame ! and flags attributes of the tasklet are invalid ! and mapped to tstate. Maintenance of these fields ! is done during switching. ! This is now a computed attribute. ! atomic: If true, schedulers will never switch. Driven by ! the code object or dynamically, see below. ! scheduled: The tasklet likes to be auto-scheduled. User driven. ! blocked: The tasklet is either waiting in a channel for ! writing (1) or reading (-1) or not blocked(0). ! Maintained by the channel logic. Do not change. ! block_trap: Debugging aid. Whenever the tasklet would be ! blocked by a channel, an exception is raised. ! is_zombie: This tasklet is almost dead, its deallocation has ! started. The tasklet *must* die at some time, or the ! process can never end. Policy for atomic/schedule and switching: ! ----------------------------------------- ! A tasklet switch can always be done explicitly by calling schedule(). ! Atomic and schedule are concerned with automatic features. ! atomic scheduled ! 1 any Neither a scheduler nor a watchdog will ! try to switch this tasklet. ! 0 0 The tasklet can be stopped on desire, or it ! can be killed by an exception. ! 0 1 Like above, plus auto-scheduling is enabled. ! Default settings: ! ----------------- ! The default value of scheduled is taken from the global variable ! enable_scheduling in stacklessmodule. It can be set or cleared ! for every tasklet at any time. ! The value of atomic is normally calculated from the executed code ! object. Unless the code object has a special flag set, atomic ! will be saved on entry of the code object, set to true, and reset ! on exit. This protects you from crashing any unknown Python code. ! For known code objects, this mechanism can be turned off, and the ! atomic flag is under your control. ***************************************************************************/ *************** *** 82,86 **** /* PyObject *channel; ! */ PyFrameObject *topframe; PyObject *tempval; --- 82,86 ---- /* PyObject *channel; ! */ PyFrameObject *topframe; PyObject *tempval; *************** *** 89,93 **** int recursion_depth; struct _cstack *cstate; ! PyObject *tsk_weakreflist; } PyTaskletObject; --- 89,93 ---- int recursion_depth; struct _cstack *cstate; ! PyObject *tsk_weakreflist; } PyTaskletObject; *************** *** 96,106 **** typedef struct _cstack { ! PyObject_VAR_HEAD struct _cstack *next; struct _cstack *prev; #ifdef have_long_long ! long_long serial; #else ! long serial; #endif struct _tasklet *task; --- 96,106 ---- typedef struct _cstack { ! PyObject_VAR_HEAD struct _cstack *next; struct _cstack *prev; #ifdef have_long_long ! long_long serial; #else ! long serial; #endif struct _tasklet *task; *************** *** 108,112 **** PyThreadState *tstate; int *startaddr; ! int *stack[1]; } PyCStackObject; --- 108,112 ---- PyThreadState *tstate; int *startaddr; ! int *stack[1]; } PyCStackObject; *************** *** 118,122 **** struct _tasklet *queue; int balance; ! PyObject *chan_weakreflist; } PyChannelObject; --- 118,122 ---- struct _tasklet *queue; int balance; ! PyObject *chan_weakreflist; } PyChannelObject; *************** *** 125,131 **** typedef struct _baseframe { ! PyObject_VAR_HEAD ! struct _frame *f_back; /* previous frame, or NULL */ ! PyFrame_ExecFunc *f_execute; /* --- 125,131 ---- typedef struct _baseframe { ! PyObject_VAR_HEAD ! struct _frame *f_back; /* previous frame, or NULL */ ! PyFrame_ExecFunc *f_execute; /* *************** *** 141,145 **** typedef struct _cframe { ! PyBaseFrameObject bf; PyObject *callable; PyObject *args; --- 141,145 ---- typedef struct _cframe { ! PyBaseFrameObject bf; PyObject *callable; PyObject *args; *************** *** 178,182 **** PyAPI_DATA(PyTypeObject) PyDictIter_Type; PyAPI_DATA(PyTypeObject) PyListIter_Type; ! PyAPI_DATA(PyTypeObject) Pyrangeiter_Type; PyAPI_DATA(PyTypeObject) PyTupleIter_Type; PyAPI_DATA(PyTypeObject) PyEnum_Type; --- 178,182 ---- PyAPI_DATA(PyTypeObject) PyDictIter_Type; PyAPI_DATA(PyTypeObject) PyListIter_Type; ! PyAPI_DATA(PyTypeObject) PyRangeIter_Type; PyAPI_DATA(PyTypeObject) PyTupleIter_Type; PyAPI_DATA(PyTypeObject) PyEnum_Type; Index: stackless_tstate.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_tstate.h,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** stackless_tstate.h 18 Apr 2004 14:07:33 -0000 1.48 --- stackless_tstate.h 24 Apr 2004 23:29:39 -0000 1.49 *************** *** 2,9 **** typedef struct _tasklet_flags { ! unsigned int atomic: 1; unsigned int ignore_nesting: 1; ! int blocked: 2; ! unsigned int block_trap: 1; unsigned int is_zombie: 1; unsigned int pending_irq: 1; --- 2,9 ---- typedef struct _tasklet_flags { ! unsigned int atomic: 1; unsigned int ignore_nesting: 1; ! int blocked: 2; ! unsigned int block_trap: 1; unsigned int is_zombie: 1; unsigned int pending_irq: 1; *************** *** 11,48 **** typedef struct _sts { ! /* the blueprint for new stacks */ ! struct _cstack *initial_stub; ! /* the counter that ensures that we always switch to the most recent stub */ #ifdef have_long_long ! long_long serial; ! long_long serial_last_jump; #else ! long serial; ! long serial_last_jump; #endif ! /* the list of all stacks of this thread */ ! struct _cstack *cstack_chain; ! /* the base address for hijacking stacks */ ! int *cstack_base; ! /* flags of the running tasklet */ ! struct _tasklet_flags flags; ! /* main tasklet */ ! struct _tasklet *main; ! /* runnable tasklets */ ! struct _tasklet *current; ! int runcount; ! /* scheduling */ ! int ticker; ! int interval; ! PyObject * (*interrupt) (void); /* the fast scheduler */ ! /* trap recursive scheduling via callbacks */ ! int schedlock; ! /* number of nested interpreters (1.0/2.0 merge) */ ! int nesting_level; ! /* common return frame for all tasklets (3.0) */ ! /* XXX this is about to be removed, since we always hacve cframes on top now */ ! struct _frame *tasklet_runner; } PyStacklessState; --- 11,49 ---- typedef struct _sts { ! /* the blueprint for new stacks */ ! struct _cstack *initial_stub; ! /* the counter that ensures that we always switch to the most recent stub */ #ifdef have_long_long ! long_long serial; ! long_long serial_last_jump; #else ! long serial; ! long serial_last_jump; #endif ! /* the list of all stacks of this thread */ ! struct _cstack *cstack_chain; ! /* the base address for hijacking stacks */ ! int *cstack_base; ! /* flags of the running tasklet */ ! struct _tasklet_flags flags; ! /* main tasklet */ ! struct _tasklet *main; ! /* runnable tasklets */ ! struct _tasklet *current; ! int runcount; ! /* scheduling */ ! int ticker; ! int interval; ! PyObject * (*interrupt) (void); /* the fast scheduler */ ! /* trap recursive scheduling via callbacks */ ! int schedlock; ! /* number of nested interpreters (1.0/2.0 merge) */ ! int nesting_level; ! /* common return frame for all tasklets (3.0) */ ! /* XXX this is about to be removed, since we always ! have cframes on top now */ ! struct _frame *tasklet_runner; } PyStacklessState; *************** *** 50,68 **** /* these macros go into pystate.c */ #define STACKLESS_PYSTATE_NEW \ ! tstate->st.initial_stub = NULL; \ ! tstate->st.serial = 0; \ ! tstate->st.serial_last_jump = 0; \ ! tstate->st.cstack_chain = NULL; \ ! tstate->st.cstack_base = NULL; \ ! *(int*)&tstate->st.flags = 0; \ ! tstate->st.ticker = 0; \ ! tstate->st.interval = 0; \ ! tstate->st.interrupt = NULL; \ ! tstate->st.schedlock = 0; \ ! tstate->st.main = NULL; \ ! tstate->st.current = NULL; \ ! tstate->st.runcount = 0; \ ! tstate->st.nesting_level = 0; \ ! tstate->st.tasklet_runner = NULL; /* note that the scheduler knows how to zap. It checks if it is in charge --- 51,69 ---- /* these macros go into pystate.c */ #define STACKLESS_PYSTATE_NEW \ ! tstate->st.initial_stub = NULL; \ ! tstate->st.serial = 0; \ ! tstate->st.serial_last_jump = 0; \ ! tstate->st.cstack_chain = NULL; \ ! tstate->st.cstack_base = NULL; \ ! *(int*)&tstate->st.flags = 0; \ ! tstate->st.ticker = 0; \ ! tstate->st.interval = 0; \ ! tstate->st.interrupt = NULL; \ ! tstate->st.schedlock = 0; \ ! tstate->st.main = NULL; \ ! tstate->st.current = NULL; \ ! tstate->st.runcount = 0; \ ! tstate->st.nesting_level = 0; \ ! tstate->st.tasklet_runner = NULL; /* note that the scheduler knows how to zap. It checks if it is in charge *************** *** 76,80 **** #define STACKLESS_PYSTATE_ZAP \ ! slp_kill_tasks_with_stacks(tstate); \ ! ZAP(tstate->st.initial_stub); \ ! ZAP(tstate->st.tasklet_runner); --- 77,81 ---- #define STACKLESS_PYSTATE_ZAP \ ! slp_kill_tasks_with_stacks(tstate); \ ! ZAP(tstate->st.initial_stub); \ ! ZAP(tstate->st.tasklet_runner); Index: stackless_util.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_util.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** stackless_util.c 18 Apr 2004 14:07:33 -0000 1.16 --- stackless_util.c 24 Apr 2004 23:29:39 -0000 1.17 *************** *** 9,14 **** slp_type_error(const char *msg) { ! PyErr_SetString(PyExc_TypeError, msg); ! return NULL; } --- 9,14 ---- slp_type_error(const char *msg) { ! PyErr_SetString(PyExc_TypeError, msg); ! return NULL; } *************** *** 16,21 **** slp_runtime_error(const char *msg) { ! PyErr_SetString(PyExc_RuntimeError, msg); ! return NULL; } --- 16,21 ---- slp_runtime_error(const char *msg) { ! PyErr_SetString(PyExc_RuntimeError, msg); ! return NULL; } *************** *** 23,28 **** slp_value_error(const char *msg) { ! PyErr_SetString(PyExc_ValueError, msg); ! return NULL; } --- 23,28 ---- slp_value_error(const char *msg) { ! PyErr_SetString(PyExc_ValueError, msg); ! return NULL; } *************** *** 30,37 **** slp_null_error(void) { ! if (!PyErr_Occurred()) ! PyErr_SetString(PyExc_SystemError, ! "null argument to internal routine"); ! return NULL; } --- 30,37 ---- slp_null_error(void) { ! if (!PyErr_Occurred()) ! PyErr_SetString(PyExc_SystemError, ! "null argument to internal routine"); ! return NULL; } *************** *** 42,49 **** { PyThreadState *ts; if (task->topframe == NULL || task->cstate == NULL) return NULL; ! ts = task->cstate->tstate; ! return ts->st.current == task ? ts->frame : task->f.frame; } --- 42,50 ---- { PyThreadState *ts; + if (task->topframe == NULL || task->cstate == NULL) return NULL; ! ts = task->cstate->tstate; ! return ts->st.current == task ? ts->frame : task->f.frame; } *************** *** 52,58 **** { PyThreadState *ts; ! assert(task->cstate != NULL); ! ts = task->cstate->tstate; ! return ts->st.current == task ? &ts->st.flags : &task->flags; } --- 53,60 ---- { PyThreadState *ts; ! ! assert(task->cstate != NULL); ! ts = task->cstate->tstate; ! return ts->st.current == task ? &ts->st.flags : &task->flags; } *************** *** 60,63 **** --- 62,66 ---- { PyThreadState *ts = PyThreadState_GET(); + if (ts->st.flags.pending_irq) { if (ts->st.flags.atomic) *************** *** 77,89 **** { STACKLESS_ASSERT(); ! if (retval == NULL) ! return -1; ! if (STACKLESS_UNWINDING(retval)) { STACKLESS_UNPACK(retval); Py_XDECREF(retval); ! return 1; } ! Py_DECREF(retval); ! return 0; } --- 80,92 ---- { STACKLESS_ASSERT(); ! if (retval == NULL) ! return -1; ! if (STACKLESS_UNWINDING(retval)) { STACKLESS_UNPACK(retval); Py_XDECREF(retval); ! return 1; } ! Py_DECREF(retval); ! return 0; } *************** *** 91,101 **** slp_int_wrapper(PyObject *retval) { ! int ret = -909090; STACKLESS_ASSERT(); ! if (retval != NULL) { ! ret = PyInt_AsLong(retval); ! Py_DECREF(retval); ! } ! return ret; } --- 94,105 ---- slp_int_wrapper(PyObject *retval) { ! int ret = -909090; ! STACKLESS_ASSERT(); ! if (retval != NULL) { ! ret = PyInt_AsLong(retval); ! Py_DECREF(retval); ! } ! return ret; } *************** *** 103,112 **** slp_current_wrapper( int(*func)(PyTaskletObject*), PyTaskletObject *task ) { ! PyThreadState *ts = PyThreadState_GET(); ! int ret; ! ts->st.main = (PyTaskletObject*)Py_None; ! ret = func(task); ! ts->st.main = NULL; ! return ret; } --- 107,117 ---- slp_current_wrapper( int(*func)(PyTaskletObject*), PyTaskletObject *task ) { ! PyThreadState *ts = PyThreadState_GET(); ! ! int ret; ! ts->st.main = (PyTaskletObject*)Py_None; ! ret = func(task); ! ts->st.main = NULL; ! return ret; } Index: stacklesseval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklesseval.c,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** stacklesseval.c 23 Apr 2004 00:34:38 -0000 1.140 --- stacklesseval.c 24 Apr 2004 23:29:39 -0000 1.141 *************** *** 7,11 **** #include "stackless_impl.h" - #include "stacklesseval.h" #include "prickelpit.h" --- 7,10 ---- *************** *** 52,65 **** static void slp_cstack_cacheclear(void) { ! int i; ! PyCStackObject *stack; ! for (i=0; i < CSTACK_SLOTS; i++) { ! while (cstack_cache[i] != NULL) { ! stack = cstack_cache[i]; ! cstack_cache[i] = (PyCStackObject *) stack->startaddr; ! PyMem_Free(stack); ! } ! } ! cstack_cachecount = 0; } --- 51,65 ---- static void slp_cstack_cacheclear(void) { ! int i; ! PyCStackObject *stack; ! ! for (i=0; i < CSTACK_SLOTS; i++) { ! while (cstack_cache[i] != NULL) { ! stack = cstack_cache[i]; ! cstack_cache[i] = (PyCStackObject *) stack->startaddr; ! PyMem_Free(stack); ! } ! } ! cstack_cachecount = 0; } *************** *** 67,83 **** cstack_dealloc(PyCStackObject *cst) { ! PyThreadState *ts = PyThreadState_GET(); ts->st.cstack_chain = cst; ! SLP_CHAIN_REMOVE(PyCStackObject, &ts->st.cstack_chain, cst, next, prev); ! if (cst->ob_size >= CSTACK_SLOTS) { ! PyMem_Free(cst); ! } ! else { ! if (cstack_cachecount >= CSTACK_MAXCACHE) ! slp_cstack_cacheclear(); ! cst->startaddr = (int *) cstack_cache[cst->ob_size]; ! cstack_cache[cst->ob_size] = cst; ! ++cstack_cachecount; ! } } --- 67,85 ---- cstack_dealloc(PyCStackObject *cst) { ! PyThreadState *ts = PyThreadState_GET(); ! ts->st.cstack_chain = cst; ! SLP_CHAIN_REMOVE(PyCStackObject, &ts->st.cstack_chain, cst, next, ! prev); ! if (cst->ob_size >= CSTACK_SLOTS) { ! PyMem_Free(cst); ! } ! else { ! if (cstack_cachecount >= CSTACK_MAXCACHE) ! slp_cstack_cacheclear(); ! cst->startaddr = (int *) cstack_cache[cst->ob_size]; ! cstack_cache[cst->ob_size] = cst; ! ++cstack_cachecount; ! } } *************** *** 86,127 **** slp_cstack_new(PyCStackObject **cst, int *stackref, PyTaskletObject *task) { ! PyThreadState *ts = PyThreadState_GET(); ! int *stackbase = ts->st.cstack_base; ! int size = stackbase - stackref; ! if (size < 0) { ! PyErr_SetString(PyExc_RuntimeError, "negative stack size"); ! return NULL; ! } ! if (*cst && (*cst)->ob_size == size && (*cst)->ob_refcnt == 1) { ! /* reuse it */ return *cst; ! } ! ! if (*cst != NULL) { ! if ((*cst)->task == task) ! (*cst)->task = NULL; ! Py_DECREF(*cst); ! } ! if (size < CSTACK_SLOTS && ((*cst) = cstack_cache[size])) { ! /* take stack from cache */ ! cstack_cache[size] = (PyCStackObject *) (*cst)->startaddr; ! --cstack_cachecount; ! } ! else { ! /* PyObject_NewVar is inlined */ ! *cst = (PyCStackObject *) ! PyObject_MALLOC(sizeof(PyCStackObject) + (size-1) * sizeof(int*)); ! if (*cst == NULL) return NULL; ! } ! (void) PyObject_INIT_VAR(*cst, &PyCStack_Type, size); ! (*cst)->startaddr = stackbase; (*cst)->next = (*cst)->prev = NULL; SLP_CHAIN_INSERT(PyCStackObject, &ts->st.cstack_chain, *cst, next, prev); ! (*cst)->serial = ts->st.serial; (*cst)->task = task; (*cst)->tstate = ts; (*cst)->nesting_level = ts->st.nesting_level; ! return *cst; } --- 88,131 ---- slp_cstack_new(PyCStackObject **cst, int *stackref, PyTaskletObject *task) { ! PyThreadState *ts = PyThreadState_GET(); ! int *stackbase = ts->st.cstack_base; ! int size = stackbase - stackref; ! ! if (size < 0) { ! PyErr_SetString(PyExc_RuntimeError, "negative stack size"); ! return NULL; ! } ! if (*cst && (*cst)->ob_size == size && (*cst)->ob_refcnt == 1) { ! /* reuse it */ return *cst; ! } ! ! if (*cst != NULL) { ! if ((*cst)->task == task) ! (*cst)->task = NULL; ! Py_DECREF(*cst); ! } ! if (size < CSTACK_SLOTS && ((*cst) = cstack_cache[size])) { ! /* take stack from cache */ ! cstack_cache[size] = (PyCStackObject *) (*cst)->startaddr; ! --cstack_cachecount; ! } ! else { ! /* PyObject_NewVar is inlined */ ! *cst = (PyCStackObject *) ! PyObject_MALLOC(sizeof(PyCStackObject) + ! (size-1) * sizeof(int*)); ! if (*cst == NULL) return NULL; ! } ! PyObject_INIT_VAR(*cst, &PyCStack_Type, size); ! (*cst)->startaddr = stackbase; (*cst)->next = (*cst)->prev = NULL; SLP_CHAIN_INSERT(PyCStackObject, &ts->st.cstack_chain, *cst, next, prev); ! (*cst)->serial = ts->st.serial; (*cst)->task = task; (*cst)->tstate = ts; (*cst)->nesting_level = ts->st.nesting_level; ! return *cst; } *************** *** 129,134 **** slp_cstack_save(PyCStackObject *cstprev) { ! int stsizeb = (cstprev)->ob_size * sizeof(int*); ! memcpy((cstprev)->stack, (cstprev)->startaddr - (cstprev)->ob_size, stsizeb); return stsizeb; } --- 133,140 ---- slp_cstack_save(PyCStackObject *cstprev) { ! int stsizeb = (cstprev)->ob_size * sizeof(int*); ! ! memcpy((cstprev)->stack, (cstprev)->startaddr - ! (cstprev)->ob_size, stsizeb); return stsizeb; } *************** *** 139,143 **** /* mark task as no longer responsible for cstack instance */ cst->task = NULL; ! memcpy(cst->startaddr - cst->ob_size, &cst->stack, (cst->ob_size) * sizeof(int*)); } --- 145,150 ---- /* mark task as no longer responsible for cstack instance */ cst->task = NULL; ! memcpy(cst->startaddr - cst->ob_size, &cst->stack, ! (cst->ob_size) * sizeof(int*)); } *************** *** 158,167 **** static PyMemberDef cstack_members[] = { ! {"size", T_INT, offsetof(PyCStackObject, ob_size), READONLY}, {"next", T_OBJECT, offsetof(PyCStackObject, next), READONLY}, {"prev", T_OBJECT, offsetof(PyCStackObject, prev), READONLY}, {"task", T_OBJECT, offsetof(PyCStackObject, task), READONLY}, ! {"startaddr", T_ADDR, offsetof(PyCStackObject, startaddr), READONLY}, ! {0} }; --- 165,174 ---- static PyMemberDef cstack_members[] = { ! {"size", T_INT, offsetof(PyCStackObject, ob_size), READONLY}, {"next", T_OBJECT, offsetof(PyCStackObject, next), READONLY}, {"prev", T_OBJECT, offsetof(PyCStackObject, prev), READONLY}, {"task", T_OBJECT, offsetof(PyCStackObject, task), READONLY}, ! {"startaddr", T_ADDR, offsetof(PyCStackObject, startaddr), READONLY}, ! {0} }; *************** *** 171,176 **** cstack_str(PyObject *o) { ! PyCStackObject *cst = (PyCStackObject*)o; ! return PyString_FromStringAndSize((char*)&cst->stack, cst->ob_size*sizeof(cst->stack[0])); } --- 178,184 ---- cstack_str(PyObject *o) { ! PyCStackObject *cst = (PyCStackObject*)o; ! return PyString_FromStringAndSize((char*)&cst->stack, ! cst->ob_size*sizeof(cst->stack[0])); } *************** *** 181,219 **** sizeof(PyCStackObject), sizeof(PyObject *), ! (destructor)cstack_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! (reprfunc)cstack_str, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! PyObject_GenericSetAttr, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! cstack_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* tp_methods */ ! cstack_members, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! 0, /* tp_new */ ! 0, /* tp_free */ }; --- 189,227 ---- sizeof(PyCStackObject), sizeof(PyObject *), ! (destructor)cstack_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! (reprfunc)cstack_str, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! PyObject_GenericSetAttr, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! cstack_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* tp_methods */ ! cstack_members, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! 0, /* tp_new */ ! 0, /* tp_free */ }; *************** *** 222,233 **** make_initial_stub(void) { ! PyThreadState *ts = PyThreadState_GET(); if (ts->st.initial_stub != NULL) { Py_DECREF(ts->st.initial_stub); ts->st.initial_stub = NULL; } ! ++ts->st.serial; ! if (slp_transfer(&ts->st.initial_stub, NULL, NULL)) return -1; ! ts->st.initial_stub->serial = ts->st.serial; /* * from here, we always arrive with a compatible cstack --- 230,242 ---- make_initial_stub(void) { ! PyThreadState *ts = PyThreadState_GET(); ! if (ts->st.initial_stub != NULL) { Py_DECREF(ts->st.initial_stub); ts->st.initial_stub = NULL; } ! ++ts->st.serial; ! if (slp_transfer(&ts->st.initial_stub, NULL, NULL)) return -1; ! ts->st.initial_stub->serial = ts->st.serial; /* * from here, we always arrive with a compatible cstack *************** *** 238,242 **** */ ! return 0; } --- 247,251 ---- */ ! return 0; } *************** *** 244,265 **** climb_stack_and_eval_frame(PyFrameObject *f) { ! /* ! * a similar case to climb_stack_and_transfer, * but here we need to incorporate a gap in the * stack into main and keep this gap on the stack. * This way, initial_stub is always valid to be * used to return to the main c stack. ! */ ! PyThreadState *ts = PyThreadState_GET(); ! int probe; ! int needed = &probe - ts->st.cstack_base; ! /* in rare cases, the need might have vanished due to the recursion */ ! int * goobledigoobs; ! if (needed > 0) { ! goobledigoobs = alloca(needed * sizeof(int)); ! if (goobledigoobs == NULL) ! return NULL; ! } ! return slp_eval_frame(f); } --- 253,275 ---- climb_stack_and_eval_frame(PyFrameObject *f) { ! /* ! * a similar case to climb_stack_and_transfer, * but here we need to incorporate a gap in the * stack into main and keep this gap on the stack. * This way, initial_stub is always valid to be * used to return to the main c stack. ! */ ! PyThreadState *ts = PyThreadState_GET(); ! int probe; ! int needed = &probe - ts->st.cstack_base; ! /* in rare cases, the need might have vanished due to the recursion */ ! int * goobledigoobs; ! ! if (needed > 0) { ! goobledigoobs = alloca(needed * sizeof(int)); ! if (goobledigoobs == NULL) ! return NULL; ! } ! return slp_eval_frame(f); } *************** *** 268,335 **** slp_eval_frame(PyFrameObject *f) { ! PyThreadState *ts = PyThreadState_GET(); ! PyFrameObject *fprev = f->f_back; ! int * stackref; ! if (fprev == NULL && ts->st.main == NULL) { ! /* this is the initial frame, so mark the stack base */ /* ! careful, this caused me a major headache. ! it is *not* sufficient to just check for fprev == NULL. ! Reason: (observed with wxPython): ! A toplevel frame is run as a tasklet. When its frame ! is deallocated (in slp_tasklet_end), a Python object ! with a __del__ method is destroyed. This __del__ ! will run as a toplevel frame, with fback == NULL! */ ! stackref = STACK_REFPLUS + (int*) &f; ! if (ts->st.cstack_base == NULL) ! ts->st.cstack_base = stackref-CSTACK_GOODGAP; /* XXX */ ! if (stackref > ts->st.cstack_base) ! return climb_stack_and_eval_frame(f); ! ts->frame = f; ! if (make_initial_stub()) ! return NULL; ! f = ts->frame; ! if (f == NULL) ! return NULL; ! if (f->f_back == NULL || f->f_back == ts->st.tasklet_runner) { ! /* this is really a new tasklet or main */ /* I hope very much to get rid of this hack, soon */ ! return slp_run_tasklet(f); ! } ! return slp_resume_tasklet(f); ! } Py_INCREF(Py_None); ! return slp_frame_dispatch(f, fprev, Py_None); } void slp_kill_tasks_with_stacks(struct _ts *tstate) { ! PyThreadState *ts = PyThreadState_GET(); PyObject *exception, *value, *tb; ! if (ts != tstate) { ! /* too bad, can't handle this, give up */ ! return; ! } ! PyErr_Fetch(&exception, &value, &tb); ! while (1) { ! PyCStackObject *csfirst = ts->st.cstack_chain, *cs = csfirst; ! PyTaskletObject *t; if (cs == NULL) break; ! while (cs->task == NULL && cs->next != csfirst) { ! cs = cs->next; ! } ! if (cs->task == NULL) ! return; ! t = cs->task; ! cs->task = NULL; ! PyTasklet_Kill(t); PyErr_Clear(); ! } PyErr_Restore(exception, value, tb); } --- 278,347 ---- slp_eval_frame(PyFrameObject *f) { ! PyThreadState *ts = PyThreadState_GET(); ! PyFrameObject *fprev = f->f_back; ! int * stackref; ! if (fprev == NULL && ts->st.main == NULL) { ! /* this is the initial frame, so mark the stack base */ /* ! * careful, this caused me a major headache. ! * it is *not* sufficient to just check for fprev == NULL. ! * Reason: (observed with wxPython): ! * A toplevel frame is run as a tasklet. When its frame ! * is deallocated (in slp_tasklet_end), a Python object ! * with a __del__ method is destroyed. This __del__ ! * will run as a toplevel frame, with fback == NULL! */ ! stackref = STACK_REFPLUS + (int*) &f; ! if (ts->st.cstack_base == NULL) ! ts->st.cstack_base = stackref-CSTACK_GOODGAP; ! if (stackref > ts->st.cstack_base) ! return climb_stack_and_eval_frame(f); ! ts->frame = f; ! if (make_initial_stub()) ! return NULL; ! f = ts->frame; ! if (f == NULL) ! return NULL; ! if (f->f_back == NULL || f->f_back == ts->st.tasklet_runner) { ! /* this is really a new tasklet or main */ /* I hope very much to get rid of this hack, soon */ ! return slp_run_tasklet(f); ! } ! return slp_resume_tasklet(f); ! } Py_INCREF(Py_None); ! return slp_frame_dispatch(f, fprev, Py_None); } void slp_kill_tasks_with_stacks(struct _ts *tstate) { ! PyThreadState *ts = PyThreadState_GET(); PyObject *exception, *value, *tb; ! ! if (ts != tstate) { ! /* too bad, can't handle this, give up */ ! return; ! } ! PyErr_Fetch(&exception, &value, &tb); ! while (1) { ! PyCStackObject *csfirst = ts->st.cstack_chain, *cs = csfirst; ! PyTaskletObject *t; ! if (cs == NULL) break; ! while (cs->task == NULL && cs->next != csfirst) { ! cs = cs->next; ! } ! if (cs->task == NULL) ! return; ! t = cs->task; ! cs->task = NULL; ! PyTasklet_Kill(t); PyErr_Clear(); ! } PyErr_Restore(exception, value, tb); } *************** *** 337,341 **** void PyStackless_kill_tasks_with_stacks(void) { ! slp_kill_tasks_with_stacks(PyThreadState_GET()); } --- 349,353 ---- void PyStackless_kill_tasks_with_stacks(void) { ! slp_kill_tasks_with_stacks(PyThreadState_GET()); } *************** *** 343,347 **** PyStacklessEval_Fini(void) { ! slp_cstack_cacheclear(); } --- 355,359 ---- PyStacklessEval_Fini(void) { ! slp_cstack_cacheclear(); } *************** *** 378,382 **** genobject *gen; } gen_callback_frame; ! #define GEN_CALLBACK_FRAME_SIZE ((sizeof(gen_callback_frame)-sizeof(PyBaseFrameObject))/sizeof(PyObject*)) static PyObject* gen_iternext_callback(PyFrameObject *f, PyObject *retval); --- 390,395 ---- genobject *gen; } gen_callback_frame; ! #define GEN_CALLBACK_FRAME_SIZE ((sizeof(gen_callback_frame) - \ ! sizeof(PyBaseFrameObject))/sizeof(PyObject*)) static PyObject* gen_iternext_callback(PyFrameObject *f, PyObject *retval); *************** *** 398,402 **** _PyObject_GC_TRACK(gen); ! f->f_back = (PyFrameObject *) slp_baseframe_new(gen_iternext_callback, 0, GEN_CALLBACK_FRAME_SIZE); if (f->f_back == NULL) { Py_DECREF(gen); --- 411,417 ---- _PyObject_GC_TRACK(gen); ! f->f_back = (PyFrameObject *) ! slp_baseframe_new(gen_iternext_callback, 0, ! GEN_CALLBACK_FRAME_SIZE); if (f->f_back == NULL) { Py_DECREF(gen); *************** *** 406,411 **** /* initialize pickling of running generators */ if (!initialized) { ! if (slp_register_execute(&PyBaseFrame_Type, "gen_iternext_callback", ! gen_iternext_callback, REF_INVALID_EXEC(gen_iternext_callback)) ) { /* ignore reference, this is a very bad error */ return NULL; --- 421,428 ---- /* initialize pickling of running generators */ if (!initialized) { ! if (slp_register_execute( ! &PyBaseFrame_Type, "gen_iternext_callback", ! gen_iternext_callback, ! REF_INVALID_EXEC(gen_iternext_callback)) ) { /* ignore reference, this is a very bad error */ return NULL; *************** *** 521,557 **** PyTypeObject PyGenerator_Type = { PyObject_HEAD_INIT(&PyType_Type) ! 0, /* ob_size */ ! "generator", /* tp_name */ ! sizeof(genobject), /* tp_basicsize */ ! 0, /* tp_itemsize */ /* methods */ ! (destructor)gen_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL,/* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)gen_traverse, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! offsetof(genobject, gi_weakreflist), /* tp_weaklistoffset */ ! (getiterfunc)gen_getiter, /* tp_iter */ ! (iternextfunc)gen_iternext, /* tp_iternext */ ! 0, /* tp_methods */ ! gen_memberlist, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ }; --- 538,575 ---- PyTypeObject PyGenerator_Type = { PyObject_HEAD_INIT(&PyType_Type) ! 0, /* ob_size */ ! "generator", /* tp_name */ ! sizeof(genobject), /* tp_basicsize */ ! 0, /* tp_itemsize */ /* methods */ ! (destructor)gen_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | ! Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)gen_traverse, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! offsetof(genobject, gi_weakreflist), /* tp_weaklistoffset */ ! (getiterfunc)gen_getiter, /* tp_iter */ ! (iternextfunc)gen_iternext, /* tp_iternext */ ! 0, /* tp_methods */ ! gen_memberlist, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ }; *************** *** 606,615 **** the frame stack until the "previous" frame reappears. The "Mario" code if you know that game :-) ! */ PyObject * slp_frame_dispatch(PyFrameObject *f, PyFrameObject *stopframe, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ++ts->st.nesting_level; --- 624,633 ---- the frame stack until the "previous" frame reappears. The "Mario" code if you know that game :-) ! */ PyObject * slp_frame_dispatch(PyFrameObject *f, PyFrameObject *stopframe, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ++ts->st.nesting_level; *************** *** 624,643 **** out when we see the frame that issued the originating dispatcher call (which may be a NULL frame). ! */ ! while (1) { ! retval = f->f_execute(f, retval); ! f = ts->frame; if (STACKLESS_UNWINDING(retval)) STACKLESS_UNPACK(retval); if (f == stopframe) break; ! } --ts->st.nesting_level; /* see whether we need to trigger a pending interrupt */ if (ts->st.flags.pending_irq) slp_check_pending_irq(); ! return retval; } --- 642,661 ---- out when we see the frame that issued the originating dispatcher call (which may be a NULL frame). ! */ ! while (1) { ! retval = f->f_execute(f, retval); ! f = ts->frame; if (STACKLESS_UNWINDING(retval)) STACKLESS_UNPACK(retval); if (f == stopframe) break; ! } --ts->st.nesting_level; /* see whether we need to trigger a pending interrupt */ if (ts->st.flags.pending_irq) slp_check_pending_irq(); ! return retval; } *************** *** 645,661 **** slp_frame_dispatch_top(PyFrameObject *f, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ! if (f==NULL) return NULL; ! while (1) { ! retval = f->f_execute(f, retval); ! f = ts->frame; if (STACKLESS_UNWINDING(retval)) STACKLESS_UNPACK(retval); if (f == NULL) break; ! } return retval; } --- 663,679 ---- slp_frame_dispatch_top(PyFrameObject *f, PyObject *retval) { ! PyThreadState *ts = PyThreadState_GET(); ! if (f==NULL) return NULL; ! while (1) { ! retval = f->f_execute(f, retval); ! f = ts->frame; if (STACKLESS_UNWINDING(retval)) STACKLESS_UNPACK(retval); if (f == NULL) break; ! } return retval; } Index: stacklessmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklessmodule.c,v retrieving revision 1.165 retrieving revision 1.166 diff -C2 -d -r1.165 -r1.166 *** stacklessmodule.c 23 Apr 2004 00:34:38 -0000 1.165 --- stacklessmodule.c 24 Apr 2004 23:29:39 -0000 1.166 *************** *** 30,36 **** PyStackless_Schedule_M(PyObject *retval, int remove) { ! return PyStackless_CallMethod_Main(slp_module, ! remove ? "schedule_remove" : "schedule", ! "O", retval); } --- 30,37 ---- PyStackless_Schedule_M(PyObject *retval, int remove) { [...1380 lines suppressed...] if (init_prickelpit()) return; ! dict = PyModule_GetDict(slp_module); #define INSERT(name, object) \ ! if (PyDict_SetItemString(dict, name, (PyObject*)object) < 0) return ! INSERT("slpmodule", PySlpModule_TypePtr); ! INSERT("cframe", &PyCFrame_Type); ! INSERT("baseframe", &PyBaseFrame_Type); ! INSERT("cstack", &PyCStack_Type); ! INSERT("tasklet", &PyTasklet_Type); ! INSERT("channel", &PyChannel_Type); ! INSERT("stackless", slp_module); ! m = (PySlpModuleObject *) slp_module; ! slpmodule_set__tasklet__(m, &PyTasklet_Type, NULL); ! slpmodule_set__channel__(m, &PyChannel_Type, NULL); } Index: switch_ppc_macosx.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_ppc_macosx.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** switch_ppc_macosx.h 17 Apr 2004 22:04:02 -0000 1.13 --- switch_ppc_macosx.h 24 Apr 2004 23:29:39 -0000 1.14 *************** *** 40,66 **** slp_switch(void) { ! static int x = 0; ! register int *stackref, stsizediff; ! __asm__ volatile ( ! "; asm block 1\n" ! : /* no outputs */ ! : "r" (x) ! : REGS_TO_SAVE ! ); ! __asm__ ("; asm block 2\n\tmr %0, r1" : "=g" (stackref) : ); ! { ! SLP_SAVE_STATE(stackref, stsizediff); ! __asm__ volatile ( ! "; asm block 3\n" ! "\tmr r11, %0\n" ! "\tadd r1, r1, r11\n" ! "\tadd r30, r30, r11\n" ! : /* no outputs */ ! : "g" (stsizediff) ! : "r11" ! ); ! SLP_RESTORE_STATE(); ! return 0; ! } } --- 40,66 ---- slp_switch(void) { ! static int x = 0; ! register int *stackref, stsizediff; ! __asm__ volatile ( ! "; asm block 1\n" ! : /* no outputs */ ! : "r" (x) ! : REGS_TO_SAVE ! ); ! __asm__ ("; asm block 2\n\tmr %0, r1" : "=g" (stackref) : ); ! { ! SLP_SAVE_STATE(stackref, stsizediff); ! __asm__ volatile ( ! "; asm block 3\n" ! "\tmr r11, %0\n" ! "\tadd r1, r1, r11\n" ! "\tadd r30, r30, r11\n" ! : /* no outputs */ ! : "g" (stsizediff) ! : "r11" ! ); ! SLP_RESTORE_STATE(); ! return 0; ! } } Index: switch_ppc_unix.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_ppc_unix.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** switch_ppc_unix.h 17 Apr 2004 22:04:02 -0000 1.5 --- switch_ppc_unix.h 24 Apr 2004 23:29:39 -0000 1.6 *************** *** 41,61 **** slp_switch(void) { ! register int *stackref, stsizediff; ! __asm__ volatile ("" : : : REGS_TO_SAVE); ! __asm__ ("mr %0, 1" : "=g" (stackref) : ); ! { ! SLP_SAVE_STATE(stackref, stsizediff); ! __asm__ volatile ( ! "mr 11, %0\n" ! "add 1, 1, 11\n" ! "add 30, 30, 11\n" ! : /* no outputs */ ! : "g" (stsizediff) ! : "11" ! ); ! SLP_RESTORE_STATE(); ! return 0; ! } ! __asm__ volatile ("" : : : REGS_TO_SAVE); } --- 41,61 ---- slp_switch(void) { ! register int *stackref, stsizediff; ! __asm__ volatile ("" : : : REGS_TO_SAVE); ! __asm__ ("mr %0, 1" : "=g" (stackref) : ); ! { ! SLP_SAVE_STATE(stackref, stsizediff); ! __asm__ volatile ( ! "mr 11, %0\n" ! "add 1, 1, 11\n" ! "add 30, 30, 11\n" ! : /* no outputs */ ! : "g" (stsizediff) ! : "11" ! ); ! SLP_RESTORE_STATE(); ! return 0; ! } ! __asm__ volatile ("" : : : REGS_TO_SAVE); } Index: switch_s390_unix.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_s390_unix.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** switch_s390_unix.h 17 Apr 2004 22:04:02 -0000 1.4 --- switch_s390_unix.h 24 Apr 2004 23:29:39 -0000 1.5 *************** *** 25,42 **** slp_switch(void) { ! register int *stackref, stsizediff; ! __asm__ volatile ("" : : : REGS_TO_SAVE); ! __asm__ ("lr %0, 15" : "=g" (stackref) : ); ! { ! SLP_SAVE_STATE(stackref, stsizediff); ! __asm__ volatile ( ! "ar 15, %0" ! : /* no outputs */ ! : "g" (stsizediff) ! ); ! SLP_RESTORE_STATE(); ! return 0; ! } ! __asm__ volatile ("" : : : REGS_TO_SAVE); } --- 25,42 ---- slp_switch(void) { ! register int *stackref, stsizediff; ! __asm__ volatile ("" : : : REGS_TO_SAVE); ! __asm__ ("lr %0, 15" : "=g" (stackref) : ); ! { ! SLP_SAVE_STATE(stackref, stsizediff); ! __asm__ volatile ( ! "ar 15, %0" ! : /* no outputs */ ! : "g" (stsizediff) ! ); ! SLP_RESTORE_STATE(); ! return 0; ! } ! __asm__ volatile ("" : : : REGS_TO_SAVE); } Index: switch_sparc_sun_gcc.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_sparc_sun_gcc.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** switch_sparc_sun_gcc.h 17 Apr 2004 22:04:02 -0000 1.5 --- switch_sparc_sun_gcc.h 24 Apr 2004 23:29:39 -0000 1.6 *************** *** 27,73 **** slp_switch(void) { ! register int *stackref, stsizediff; ! /* Put the stack pointer into stackref */ ! /* Sparc special: at first, flush register windows ! */ ! __asm__ volatile ( ! "ta %1\n\t" ! "mov %%sp, %0" ! : "=r" (stackref) : "i" (ST_FLUSH_WINDOWS)); ! { /* You shalt put SLP_SAVE_STATE into a local block */ ! SLP_SAVE_STATE(stackref, stsizediff); ! /* Increment stack and frame pointer by stsizediff */ ! /* Sparc special: at first load new return address. ! This cannot be done later, because the stack ! might be overwritten again just after SLP_RESTORE_STATE ! has finished. BTW: All other registers (l0-l7 and i0-i5) ! might be clobbered too. ! */ ! __asm__ volatile ( ! "ld [%0+60], %%i7\n\t" ! "add %1, %%sp, %%sp\n\t" ! "add %1, %%fp, %%fp" ! : : "r" (_cst->stack), "r" (stsizediff) ! : "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", ! "%i0", "%i1", "%i2", "%i3", "%i4", "%i5"); ! SLP_RESTORE_STATE(); ! /* Run far away as fast as possible, don't look back at the sins. ! * The LORD rained down burning sulfur on Sodom and Gomorra ... ! */ ! /* Sparc special: Must make it *very* clear to the CPU that ! it shouldn't look back into the register windows ! */ ! __asm__ volatile ( "ta %0" : : "i" (ST_CLEAN_WINDOWS)); ! return 0; ! } } --- 27,73 ---- slp_switch(void) { ! register int *stackref, stsizediff; ! /* Put the stack pointer into stackref */ ! /* Sparc special: at first, flush register windows ! */ ! __asm__ volatile ( ! "ta %1\n\t" ! "mov %%sp, %0" ! : "=r" (stackref) : "i" (ST_FLUSH_WINDOWS)); ! { /* You shalt put SLP_SAVE_STATE into a local block */ ! SLP_SAVE_STATE(stackref, stsizediff); ! /* Increment stack and frame pointer by stsizediff */ ! /* Sparc special: at first load new return address. ! This cannot be done later, because the stack ! might be overwritten again just after SLP_RESTORE_STATE ! has finished. BTW: All other registers (l0-l7 and i0-i5) ! might be clobbered too. ! */ ! __asm__ volatile ( ! "ld [%0+60], %%i7\n\t" ! "add %1, %%sp, %%sp\n\t" ! "add %1, %%fp, %%fp" ! : : "r" (_cst->stack), "r" (stsizediff) ! : "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", ! "%i0", "%i1", "%i2", "%i3", "%i4", "%i5"); ! SLP_RESTORE_STATE(); ! /* Run far away as fast as possible, don't look back at the sins. ! * The LORD rained down burning sulfur on Sodom and Gomorra ... ! */ ! /* Sparc special: Must make it *very* clear to the CPU that ! it shouldn't look back into the register windows ! */ ! __asm__ volatile ( "ta %0" : : "i" (ST_CLEAN_WINDOWS)); ! return 0; ! } } Index: switch_x86_msvc.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_x86_msvc.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** switch_x86_msvc.h 17 Apr 2004 22:04:02 -0000 1.31 --- switch_x86_msvc.h 24 Apr 2004 23:29:39 -0000 1.32 *************** *** 34,52 **** slp_switch(void) { ! register int *stackref, stsizediff; ! __asm mov stackref, esp; /* modify EBX, ESI and EDI in order to get them preserved */ __asm mov ebx, ebx; __asm xchg esi, edi; ! { ! SLP_SAVE_STATE(stackref, stsizediff); ! __asm { ! mov eax, stsizediff ! add esp, eax ! add ebp, eax ! } ! SLP_RESTORE_STATE(); ! return 0; ! } } --- 34,52 ---- slp_switch(void) { ! register int *stackref, stsizediff; ! __asm mov stackref, esp; /* modify EBX, ESI and EDI in order to get them preserved */ __asm mov ebx, ebx; __asm xchg esi, edi; ! { ! SLP_SAVE_STATE(stackref, stsizediff); ! __asm { ! mov eax, stsizediff ! add esp, eax ! add ebp, eax ! } ! SLP_RESTORE_STATE(); ! return 0; ! } } Index: switch_x86_unix.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_x86_unix.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** switch_x86_unix.h 17 Apr 2004 22:04:02 -0000 1.15 --- switch_x86_unix.h 24 Apr 2004 23:29:39 -0000 1.16 *************** *** 31,49 **** slp_switch(void) { ! register int *stackref, stsizediff; ! __asm__ volatile ("" : : : "ebx", "esi", "edi"); ! __asm__ ("movl %%esp, %0" : "=g" (stackref)); ! { ! SLP_SAVE_STATE(stackref, stsizediff); ! __asm__ volatile ( ! "addl %0, %%esp\n" ! "addl %0, %%ebp\n" ! : ! : "r" (stsizediff) ! ); ! SLP_RESTORE_STATE(); ! return 0; ! } ! __asm__ volatile ("" : : : "ebx", "esi", "edi"); } --- 31,49 ---- slp_switch(void) { ! register int *stackref, stsizediff; ! __asm__ volatile ("" : : : "ebx", "esi", "edi"); ! __asm__ ("movl %%esp, %0" : "=g" (stackref)); ! { ! SLP_SAVE_STATE(stackref, stsizediff); ! __asm__ volatile ( ! "addl %0, %%esp\n" ! "addl %0, %%ebp\n" ! : ! : "r" (stsizediff) ! ); ! SLP_RESTORE_STATE(); ! return 0; ! } ! __asm__ volatile ("" : : : "ebx", "esi", "edi"); } Index: taskletobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/taskletobject.c,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** taskletobject.c 19 Apr 2004 16:08:56 -0000 1.107 --- taskletobject.c 24 Apr 2004 23:29:39 -0000 1.108 *************** *** 14,21 **** slp_current_insert(PyTaskletObject *task) { ! PyThreadState *ts = PyThreadState_GET(); ! PyTaskletObject **chain = &ts->st.current; ! SLP_CHAIN_INSERT(PyTaskletObject, chain, task, next, prev); ! ++ts->st.runcount; } --- 14,22 ---- slp_current_insert(PyTaskletObject *task) [...2158 lines suppressed...] ! if ( (t = PyFlexType_Build("stackless", "tasklet", t->tp_doc, "", ! t, sizeof(PyTasklet_HeapType), tasklet_cmethods) ) == NULL) return -1; ! PyTasklet_TypePtr = t; ! return 0; } #endif --- 1468,1479 ---- int init_tasklettype(void) { ! PyTypeObject *t = &_PyTasklet_Type; ! if ( (t = PyFlexType_Build("stackless", "tasklet", t->tp_doc, "", t, ! sizeof(PyTasklet_HeapType), ! tasklet_cmethods) ) == NULL) return -1; ! PyTasklet_TypePtr = t; ! return 0; } #endif --- stackless_frame.h DELETED --- --- stacklesseval.h DELETED --- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Wed Apr 7 19:23:42 2004 From: tismer at centera.de (Christian Tismer) Date: Wed, 07 Apr 2004 19:23:42 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless scheduling.c, 1.85, 1.86 stacklesseval.c, 1.137, 1.138 switch_x86_msvc.h, 1.29, 1.30 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv15965/src/2.3/dev/Stackless Modified Files: scheduling.c stacklesseval.c switch_x86_msvc.h Log Message: cured a really bad bug in the Windows stack switching code. This turned up, after I de-virtualized the cstack operations, and less registers were used. Also clarified a possibly dangling pointer from cstack to tasklet. And TaskletExit inherits from SystemExit, now. Index: scheduling.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/scheduling.c,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** scheduling.c 25 Mar 2004 22:59:07 -0000 1.85 --- scheduling.c 7 Apr 2004 17:23:40 -0000 1.86 *************** *** 126,129 **** --- 126,132 ---- PyCStackObject **cstprev; + if (next == prev) + return 0; + /* since we change the stack we must assure that the protocol was met */ STACKLESS_ASSERT(); *************** *** 477,482 **** task->tempval = result; slp_current_remove(); - Py_DECREF(task); --- 480,485 ---- task->tempval = result; + ts->st.current = task; slp_current_remove(); Py_DECREF(task); Index: stacklesseval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklesseval.c,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** stacklesseval.c 31 Mar 2004 01:26:36 -0000 1.137 --- stacklesseval.c 7 Apr 2004 17:23:40 -0000 1.138 *************** *** 137,140 **** --- 137,142 ---- slp_cstack_restore(PyCStackObject *cst) { + /* mark task as no longer responsible for cstack instance */ + cst->task = NULL; memcpy(cst->startaddr - cst->ob_size, &cst->stack, (cst->ob_size) * sizeof(int*)); } Index: switch_x86_msvc.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_x86_msvc.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** switch_x86_msvc.h 24 Nov 2002 15:37:10 -0000 1.29 --- switch_x86_msvc.h 7 Apr 2004 17:23:40 -0000 1.30 *************** *** 31,41 **** #define STACK_MAGIC 0 ! __forceinline static int slp_switch(void) { register int *stackref, stsizediff; __asm mov stackref, esp; ! /* mention EBX, ESI and EDI in order to get them preserved */ ! __asm lea ebx, [esi+edi]; { SLP_SAVE_STATE(stackref, stsizediff); --- 31,42 ---- #define STACK_MAGIC 0 ! static int slp_switch(void) { register int *stackref, stsizediff; __asm mov stackref, esp; ! /* modify EBX, ESI and EDI in order to get them preserved */ ! __asm mov ebx, ebx; ! __asm xchg esi, edi; { SLP_SAVE_STATE(stackref, stsizediff); _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:29:41 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:29:41 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Objects abstract.c, 1.11, 1.12 descrobject.c, 1.10, 1.11 funcobject.c, 1.8, 1.9 iterobject.c, 1.4, 1.5 rangeobject.c, 1.2, 1.3 typeobject.c, 1.12, 1.13 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Objects In directory centera.de:/tmp/cvs-serv10482/Objects Modified Files: abstract.c descrobject.c funcobject.c iterobject.c rangeobject.c typeobject.c Log Message: I did a big cleanup. Tried to reformat everything using 8-tabs, roemoved dead code, and tried to make all Python source file whitespace compatible with the Stackless' version. I hope I didn't make too many mistakes... Index: abstract.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/abstract.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** abstract.c 15 Apr 2004 22:31:11 -0000 1.11 --- abstract.c 24 Apr 2004 23:29:39 -0000 1.12 *************** *** 1848,1852 **** --- 1848,1854 ---- } STACKLESS_PROMOTE_ALL(); + retval = PyObject_Call(func, args, NULL); + STACKLESS_ASSERT(); Py_DECREF(args); Index: descrobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/descrobject.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** descrobject.c 23 Apr 2004 00:34:37 -0000 1.10 --- descrobject.c 24 Apr 2004 23:29:39 -0000 1.11 *************** *** 424,430 **** 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL,/* tp_flags */ #else ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ #endif 0, /* tp_doc */ --- 424,430 ---- 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ #endif 0, /* tp_doc */ *************** *** 467,473 **** 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL,/* tp_flags */ #else ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ #endif 0, /* tp_doc */ --- 467,473 ---- 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ #endif 0, /* tp_doc */ *************** *** 585,591 **** 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL,/* tp_flags */ #else ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ #endif 0, /* tp_doc */ --- 585,591 ---- 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ #endif 0, /* tp_doc */ *************** *** 1052,1058 **** 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL,/* tp_flags */ #else ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ #endif 0, /* tp_doc */ --- 1052,1058 ---- 0, /* tp_as_buffer */ #ifdef STACKLESS ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_STACKLESS_CALL, /* tp_flags */ #else ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ #endif 0, /* tp_doc */ Index: funcobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/funcobject.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** funcobject.c 5 Apr 2004 17:17:36 -0000 1.8 --- funcobject.c 24 Apr 2004 23:29:39 -0000 1.9 *************** *** 503,506 **** --- 503,507 ---- nk = 0; } + STACKLESS_PROMOTE_ALL(); result = PyEval_EvalCodeEx( *************** *** 510,515 **** k, nk, d, nd, PyFunction_GET_CLOSURE(func)); - STACKLESS_ASSERT(); if (k != NULL) PyMem_DEL(k); --- 511,516 ---- k, nk, d, nd, PyFunction_GET_CLOSURE(func)); STACKLESS_ASSERT(); + if (k != NULL) PyMem_DEL(k); Index: iterobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/iterobject.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iterobject.c 26 Jan 2004 17:58:02 -0000 1.4 --- iterobject.c 24 Apr 2004 23:29:39 -0000 1.5 *************** *** 109,116 **** 0, /* tp_descr_get */ 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ }; --- 109,112 ---- *************** *** 230,236 **** 0, /* tp_descr_get */ 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ }; --- 226,228 ---- Index: rangeobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/rangeobject.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rangeobject.c 27 Jan 2004 03:58:36 -0000 1.2 --- rangeobject.c 24 Apr 2004 23:29:39 -0000 1.3 *************** *** 225,229 **** } rangeiterobject; ! PyTypeObject Pyrangeiter_Type; static PyObject * --- 225,234 ---- } rangeiterobject; ! #ifdef STACKLESS ! PyTypeObject PyRangeIter_Type; ! #define Pyrangeiter_Type PyRangeIter_Type ! #else ! static PyTypeObject Pyrangeiter_Type; ! #endif static PyObject * *************** *** 254,258 **** } ! PyTypeObject Pyrangeiter_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ --- 259,267 ---- } ! #ifdef STACKLESS ! PyTypeObject PyRangeIter_Type = { ! #else ! static PyTypeObject Pyrangeiter_Type = { ! #endif PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ Index: typeobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/typeobject.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** typeobject.c 5 Apr 2004 17:17:36 -0000 1.12 --- typeobject.c 24 Apr 2004 23:29:39 -0000 1.13 *************** *** 922,925 **** --- 922,926 ---- retval = PyObject_Call(func, args, NULL); STACKLESS_ASSERT(); + Py_DECREF(args); Py_DECREF(func); *************** *** 962,965 **** --- 963,967 ---- retval = PyObject_Call(func, args, NULL); STACKLESS_ASSERT(); + Py_DECREF(args); Py_DECREF(func); _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 19 18:13:33 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 19 Apr 2004 18:13:33 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless slp_transfer.c, 1.18, 1.19 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv18420/dev/Stackless Modified Files: slp_transfer.c Log Message: small glitch Index: slp_transfer.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/slp_transfer.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** slp_transfer.c 19 Apr 2004 16:08:56 -0000 1.18 --- slp_transfer.c 19 Apr 2004 16:13:31 -0000 1.19 *************** *** 106,109 **** --- 106,110 ---- } + #ifdef Py_DEBUG int slp_transfer_return(PyCStackObject *cst) *************** *** 112,113 **** --- 113,116 ---- } #endif + + #endif _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 17:14:39 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 17:14:39 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/unittests runAll.py, 1.2, 1.3 test_miscell.py, 1.2, 1.3 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/unittests In directory centera.de:/tmp/cvs-serv28229/src/2.3/dev/Stackless/unittests Modified Files: runAll.py test_miscell.py Log Message: small corrections to the release build. Added pickling of xrange objects as well. Index: runAll.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/unittests/runAll.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** runAll.py 14 Mar 2004 14:19:08 -0000 1.2 --- runAll.py 18 Apr 2004 15:14:37 -0000 1.3 *************** *** 14,18 **** suite = unittest.TestSuite() ! sys.path.insert(0, '.') for filename in glob.glob('test_*.py'): --- 14,19 ---- suite = unittest.TestSuite() ! if '.' not in sys.path: ! sys.path.insert(0, '.') for filename in glob.glob('test_*.py'): Index: test_miscell.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/unittests/test_miscell.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_miscell.py 14 Mar 2004 14:04:09 -0000 1.2 --- test_miscell.py 18 Apr 2004 15:14:37 -0000 1.3 *************** *** 7,10 **** --- 7,12 ---- def runtask(): x = 0 + # provoke pickling of an xrange object + dummy = xrange(10) for ii in xrange(1000): x += 1 _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sat Apr 24 05:42:43 2004 From: tismer at centera.de (Christian Tismer) Date: Sat, 24 Apr 2004 05:42:43 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Objects classobject.c, 1.14, 1.15 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Objects In directory centera.de:/tmp/cvs-serv17897/dev/Objects Modified Files: classobject.c Log Message: removed a special patch for __reduce__/ex which made sure that __reduce__ is always found, even for object attributes. it makes some sense, but is no longer needed, since our pickling uses copy_reg. At the same time founda problem with pickling of some builtin methods. Cannot pickle tasklet methods, they don't get a wrapper. Have to find out why. Why does it work with a generator's next method? Further found a cPickle error when it searches the module of a buitlin method. This call gets down to old-style PyMember_GetOne, which gives a None instead of an error... ... probably this is a real bug in Python :-( Index: classobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/classobject.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** classobject.c 5 Apr 2004 17:17:36 -0000 1.14 --- classobject.c 24 Apr 2004 03:42:41 -0000 1.15 *************** *** 2169,2190 **** if (f != NULL && PyDescr_IsData(descr)) return f(descr, obj, (PyObject *)obj->ob_type); - #ifdef STACKLESS - /* - * this is a temporary hack until ExtensionClass is either - * dead or changed to support class methods. It would be - * much nicer to call cls.__reduce__(inst) instead. - */ - { - static PyObject *__reduce___str, *__reduce_ex___str; - if (__reduce___str == NULL) { - if (!( __reduce___str = PyString_InternFromString("__reduce__"))) - return NULL; - if (!( __reduce_ex___str = PyString_InternFromString("__reduce_ex__"))) - return NULL; - } - if (f != NULL && (name == __reduce___str || name == __reduce_ex___str)) - return f(descr, obj, (PyObject *)obj->ob_type); - } - #endif } --- 2169,2172 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 20:13:45 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 20:13:45 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/core slp_transfer.c, 1.20, 1.21 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/core In directory centera.de:/tmp/cvs-serv7009/Stackless/core Modified Files: slp_transfer.c Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: slp_transfer.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/core/slp_transfer.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** slp_transfer.c 24 Apr 2004 23:29:39 -0000 1.20 --- slp_transfer.c 29 Apr 2004 18:13:42 -0000 1.21 *************** *** 45,49 **** #define SLP_EVAL ! #include "slp_platformselect.h" static int --- 45,49 ---- #define SLP_EVAL ! #include "platf/slp_platformselect.h" static int _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 5 19:17:38 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 05 Apr 2004 19:17:38 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_impl.h, 1.70, 1.71 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv17563/Stackless Modified Files: stackless_impl.h Log Message: removed certain #ifdefs, which unfortunatly became necessary after the STACKLESS_GETARG was moved to the top of every function. I chnaged the definition for the not STACKLESS case to a typedef, which is probably ignored and doesn't give warnings. Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** stackless_impl.h 29 Mar 2004 00:04:45 -0000 1.70 --- stackless_impl.h 5 Apr 2004 17:17:36 -0000 1.71 *************** *** 293,297 **** /* turn the stackless flag macros into dummies */ ! #define STACKLESS_GETARG() #define STACKLESS_PROMOTE(func) 0 #define STACKLESS_PROMOTE_FLAG(flag) 0 --- 293,297 ---- /* turn the stackless flag macros into dummies */ ! #define STACKLESS_GETARG() typedef int this_is_just_a_syntax_issue #define STACKLESS_PROMOTE(func) 0 #define STACKLESS_PROMOTE_FLAG(flag) 0 _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 22:30:11 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 22:30:11 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev Makefile.pre.in, 1.27, 1.28 setup.py, 1.20, 1.21 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev In directory centera.de:/tmp/cvs-serv14056/dev Modified Files: Makefile.pre.in setup.py Log Message: safe pickling: under Linux, cPickle is an extension, and I packed safe_pickling with it. Index: Makefile.pre.in =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Makefile.pre.in,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Makefile.pre.in 18 Apr 2004 19:51:27 -0000 1.27 --- Makefile.pre.in 18 Apr 2004 20:30:09 -0000 1.28 *************** *** 229,233 **** Stackless/taskletobject.o \ Stackless/prickelpit.o \ - Stackless/safe_pickle.o \ Python/compile.o \ Python/codecs.o \ --- 229,232 ---- Index: setup.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/setup.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** setup.py 9 Jan 2004 00:13:15 -0000 1.20 --- setup.py 18 Apr 2004 20:30:09 -0000 1.21 *************** *** 371,375 **** # cStringIO and cPickle exts.append( Extension('cStringIO', ['cStringIO.c']) ) ! exts.append( Extension('cPickle', ['cPickle.c']) ) # Memory-mapped files (also works on Win32). --- 371,375 ---- # cStringIO and cPickle exts.append( Extension('cStringIO', ['cStringIO.c']) ) ! exts.append( Extension('cPickle', ['cPickle.c', '../Stackless/safe_pickle.c']) ) # Memory-mapped files (also works on Win32). _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From sdrees at centera.de Thu Apr 8 01:25:31 2004 From: sdrees at centera.de (Stefan Drees) Date: Thu, 08 Apr 2004 01:25:31 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev Makefile.pre.in, 1.25, 1.26 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev In directory centera.de:/tmp/cvs-serv26176 Modified Files: Makefile.pre.in Log Message: Removed stacklessversion.h also from Makefile.pre.in in dev-branch Index: Makefile.pre.in =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Makefile.pre.in,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Makefile.pre.in 29 Mar 2004 00:04:32 -0000 1.25 --- Makefile.pre.in 7 Apr 2004 23:25:29 -0000 1.26 *************** *** 528,532 **** Stackless/stackless.h \ Stackless/stacklesseval.h \ - Stackless/stacklessversion.h \ Stackless/stackless_api.h \ Stackless/stackless_frame.h \ --- 528,531 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 23 04:19:00 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 23 Apr 2004 04:19:00 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless prickelpit.c, 1.67, 1.68 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv8362/dev/Stackless Modified Files: prickelpit.c Log Message: pheww. seems to be ok now. Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** prickelpit.c 23 Apr 2004 02:17:32 -0000 1.67 --- prickelpit.c 23 Apr 2004 02:18:58 -0000 1.68 *************** *** 1568,1572 **** { /* this is a bit hairy since we need to build a dummy one */ ! wrapperobject *w, *neww = NULL; PyObject *it = NULL, *tup = PyTuple_New(0); --- 1568,1572 ---- { /* this is a bit hairy since we need to build a dummy one */ ! wrapperobject *w = NULL, *neww = NULL; PyObject *it = NULL, *tup = PyTuple_New(0); _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:32:34 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:32:34 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/core - New directory Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/core In directory centera.de:/tmp/cvs-serv4797/core Log Message: Directory /home/cvs/slpdev/src/2.3/dev/Stackless/core added to the repository _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 30 01:33:26 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 30 Apr 2004 01:33:26 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/core backwardcompat.h, 1.1, 1.2 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/core In directory centera.de:/tmp/cvs-serv16077/dev/Stackless/core Modified Files: backwardcompat.h Log Message: making the Stackless folder version independent Index: backwardcompat.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/core/backwardcompat.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** backwardcompat.h 29 Apr 2004 21:02:34 -0000 1.1 --- backwardcompat.h 29 Apr 2004 23:33:24 -0000 1.2 *************** *** 55,57 **** --- 55,61 ---- /* a couple of compatibility definitions */ + #define PyBool_FromLong PyInt_FromLong + + #define PyDoc_STR(s) s + #endif _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 16:00:32 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 16:00:32 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/unittests test_tasklet_become.py, 1.1, 1.2 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/unittests In directory centera.de:/tmp/cvs-serv18568/src/2.3/dev/Stackless/unittests Modified Files: test_tasklet_become.py Log Message: this test was wrong. if capture has the argument 42, then the calling frame must receive 42. This means, stackless had a problem, before! Index: test_tasklet_become.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/unittests/test_tasklet_become.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_tasklet_become.py 8 Apr 2004 23:36:07 -0000 1.1 --- test_tasklet_become.py 18 Apr 2004 14:00:30 -0000 1.2 *************** *** 6,36 **** class TestTaskletBecome(unittest.TestCase): ! def testSimpleTaskletBecome(self): ! def f(ch): ! print "\tBecoming a tasklet inside f(ch)" ! #become_tasklet() ! got = tasklet().capture(42) ! yum = repr(got) ! print "\tCaptured inside f(ch):", yum ! print ch.receive() ! print "\tFunction f(ch) finished" ! ch = channel() ! print ! print "First in main(TestTaskletBecome):", ! foo = getcurrent() ! print foo ! print "Now calling a function f(ch)" ! bar = f(ch) ! print "Back in main(TestTaskletBecome):",bar ! ch.send("Did it work out right?") ! self.assertEquals(foo,bar) if __name__ == '__main__': ! import sys ! if not sys.argv[1:]: ! sys.argv.append('-v') ! unittest.main() --- 6,36 ---- class TestTaskletBecome(unittest.TestCase): ! def testSimpleTaskletBecome(self): ! def f(ch): ! print "\tBecoming a tasklet inside f(ch)" ! #become_tasklet() ! got = tasklet().capture(42) ! yum = repr(got) ! print "\tCaptured inside f(ch):", yum ! print "message received: " + ch.receive() ! print "\tFunction f(ch) finished" ! ch = channel() ! print ! print "First in main(TestTaskletBecome):", ! foo = getcurrent() ! print foo ! print "Now calling a function f(ch)" ! bar = f(ch) ! print "Back in main(TestTaskletBecome):",bar ! ch.send("Did it work out right?") ! self.assertEquals(42,bar) if __name__ == '__main__': ! import sys ! if not sys.argv[1:]: ! sys.argv.append('-v') ! unittest.main() _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Wed Apr 7 19:37:24 2004 From: tismer at centera.de (Christian Tismer) Date: Wed, 07 Apr 2004 19:37:24 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/src/Stackless stacklessversion.h, 1.1, NONE Message-ID: Update of /home/cvs/slpdev/src/2.3/src/Stackless In directory centera.de:/tmp/cvs-serv16389/src/Stackless Removed Files: stacklessversion.h Log Message: cleanup dirt. --- stacklessversion.h DELETED --- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From sdrees at centera.de Thu Apr 8 00:59:58 2004 From: sdrees at centera.de (Stefan Drees) Date: Thu, 08 Apr 2004 00:59:58 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/src Makefile.pre.in, 1.25, 1.26 Message-ID: Update of /home/cvs/slpdev/src/2.3/src In directory centera.de:/tmp/cvs-serv25193 Modified Files: Makefile.pre.in Log Message: Removed traces of deleted stacklessversion.h in Makefile.pre.in Index: Makefile.pre.in =================================================================== RCS file: /home/cvs/slpdev/src/2.3/src/Makefile.pre.in,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Makefile.pre.in 29 Mar 2004 00:04:32 -0000 1.25 --- Makefile.pre.in 7 Apr 2004 22:59:55 -0000 1.26 *************** *** 528,532 **** Stackless/stackless.h \ Stackless/stacklesseval.h \ - Stackless/stacklessversion.h \ Stackless/stackless_api.h \ Stackless/stackless_frame.h \ --- 528,531 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 23:02:37 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 23:02:37 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless.h, 1.38, 1.39 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv12423/Stackless Modified Files: stackless.h Log Message: making the Stackless folder version independent Index: stackless.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** stackless.h 29 Apr 2004 02:18:40 -0000 1.38 --- stackless.h 29 Apr 2004 21:02:34 -0000 1.39 *************** *** 59,62 **** --- 59,67 ---- #endif + #ifdef STACKLESS + /* get some definitions for backward compatibility */ + #include "core/backwardcompat.h" + #endif + #ifdef __cplusplus } _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 5 19:27:06 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 05 Apr 2004 19:27:06 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev configure,1.11,1.12 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev In directory centera.de:/tmp/cvs-serv24995 Modified Files: configure Log Message: some glitch with the SLPFLAGS variable Index: configure =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/configure,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** configure 2 Apr 2004 18:54:03 -0000 1.11 --- configure 5 Apr 2004 17:27:04 -0000 1.12 *************** *** 19587,19590 **** --- 19587,19591 ---- s, at SRCDIRS@,$SRCDIRS,;t t s, at LTLIBOBJS@,$LTLIBOBJS,;t t + s, at SLPFLAGS@,$SLPFLAGS,;t t CEOF _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 00:04:04 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 00:04:04 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless switch_ppc_macosx.h, 1.12, 1.13 switch_ppc_unix.h, 1.4, 1.5 switch_s390_unix.h, 1.3, 1.4 switch_sparc_sun_gcc.h, 1.4, 1.5 switch_x86_msvc.h, 1.30, 1.31 switch_x86_unix.h, 1.14, 1.15 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv29667/src/2.3/dev/Stackless Modified Files: switch_ppc_macosx.h switch_ppc_unix.h switch_s390_unix.h switch_sparc_sun_gcc.h switch_x86_msvc.h switch_x86_unix.h Log Message: fixed a typo in the comments. Index: switch_ppc_macosx.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_ppc_macosx.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** switch_ppc_macosx.h 13 Mar 2004 13:03:25 -0000 1.12 --- switch_ppc_macosx.h 17 Apr 2004 22:04:02 -0000 1.13 *************** *** 11,16 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the --- 11,16 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the Index: switch_ppc_unix.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_ppc_unix.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** switch_ppc_unix.h 14 Jan 2004 14:26:54 -0000 1.4 --- switch_ppc_unix.h 17 Apr 2004 22:04:02 -0000 1.5 *************** *** 11,16 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 04-Oct-02 Gustavo Niemeyer * Ported from MacOS version. --- 11,16 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 04-Oct-02 Gustavo Niemeyer * Ported from MacOS version. Index: switch_s390_unix.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_s390_unix.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** switch_s390_unix.h 8 Jan 2004 18:54:57 -0000 1.3 --- switch_s390_unix.h 17 Apr 2004 22:04:02 -0000 1.4 *************** *** 6,11 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 06-Oct-02 Gustavo Niemeyer * Ported to Linux/S390. --- 6,11 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 06-Oct-02 Gustavo Niemeyer * Ported to Linux/S390. Index: switch_sparc_sun_gcc.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_sparc_sun_gcc.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** switch_sparc_sun_gcc.h 14 Jan 2004 19:43:40 -0000 1.4 --- switch_sparc_sun_gcc.h 17 Apr 2004 22:04:02 -0000 1.5 *************** *** 6,11 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the --- 6,11 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the Index: switch_x86_msvc.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_x86_msvc.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** switch_x86_msvc.h 7 Apr 2004 17:23:40 -0000 1.30 --- switch_x86_msvc.h 17 Apr 2004 22:04:02 -0000 1.31 *************** *** 6,11 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 26-Sep-02 Christian Tismer * again as a result of virtualized stack access, --- 6,11 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 26-Sep-02 Christian Tismer * again as a result of virtualized stack access, Index: switch_x86_unix.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/switch_x86_unix.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** switch_x86_unix.h 8 Jan 2004 18:54:57 -0000 1.14 --- switch_x86_unix.h 17 Apr 2004 22:04:02 -0000 1.15 *************** *** 6,11 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the --- 6,11 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:29:42 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:29:42 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Include ceval.h, 1.3, 1.4 classobject.h, 1.3, 1.4 compile.h, 1.3, 1.4 frameobject.h, 1.24, 1.25 methodobject.h, 1.6, 1.7 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Include In directory centera.de:/tmp/cvs-serv10482/Include Modified Files: ceval.h classobject.h compile.h frameobject.h methodobject.h Log Message: I did a big cleanup. Tried to reformat everything using 8-tabs, roemoved dead code, and tried to make all Python source file whitespace compatible with the Stackless' version. I hope I didn't make too many mistakes... Index: ceval.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Include/ceval.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ceval.h 14 Jan 2004 19:11:07 -0000 1.3 --- ceval.h 24 Apr 2004 23:29:39 -0000 1.4 *************** *** 5,12 **** #endif - #ifdef STACKLESS - #include "stacklesseval.h" - #endif - /* Interface to random parts in ceval.c */ --- 5,8 ---- Index: classobject.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Include/classobject.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** classobject.h 14 Jan 2004 19:11:07 -0000 1.3 --- classobject.h 24 Apr 2004 23:29:39 -0000 1.4 *************** *** 64,79 **** PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); - /* Look up attribute with name (a string) on instance object pinst, using - * only the instance and base class dicts. If a descriptor is found in - * a class dict, the descriptor is returned without calling it. - * Returns NULL if nothing found, else a borrowed reference to the - * value associated with name in the dict in which name was found. - * The point of this routine is that it never calls arbitrary Python - * code, so is always "safe": all it does is dict lookups. The function - * can't fail, never sets an exception, and NULL is not an error (it just - * means "not found"). - */ - extern DL_IMPORT(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); - /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ --- 64,67 ---- Index: compile.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Include/compile.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** compile.h 14 Jan 2004 19:11:07 -0000 1.3 --- compile.h 24 Apr 2004 23:29:39 -0000 1.4 *************** *** 47,53 **** effect, this passes on the "from __future__ import generators" state in effect when the code block was compiled. */ - #ifdef STACKLESS - #define CO_STACKLESS_AWARE 0x0100 - #endif #define CO_GENERATOR_ALLOWED 0x1000 /* no longer used in an essential way */ #define CO_FUTURE_DIVISION 0x2000 --- 47,50 ---- Index: frameobject.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Include/frameobject.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** frameobject.h 26 Mar 2004 18:52:39 -0000 1.24 --- frameobject.h 24 Apr 2004 23:29:39 -0000 1.25 *************** *** 9,13 **** #ifdef STACKLESS ! #include "stackless_frame.h" #endif --- 9,13 ---- #ifdef STACKLESS ! typedef PyObject *(PyFrame_ExecFunc) (struct _frame *, PyObject *); #endif *************** *** 18,58 **** } PyTryBlock; - #ifdef STACKLESS - - typedef struct _frame { - PyObject_VAR_HEAD - struct _frame *f_back; /* previous frame, or NULL */ - /* support for soft stackless */ - PyFrame_ExecFunc *f_execute; - PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ - PyObject *f_globals; /* global symbol table (PyDictObject) */ - /* note: f_tstate removed, f_code moved down */ - PyCodeObject *f_code; /* code segment */ - PyObject *f_locals; /* local symbol table (PyDictObject) */ - PyObject **f_valuestack; /* points after the last local */ - /* Next free slot in f_valuestack. Frame creation sets to f_valuestack. - Frame evaluation usually NULLs it, but a frame that yields sets it - to the current stack top. */ - PyObject **f_stacktop; - PyObject *f_trace; /* Trace function */ - PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; - int f_lasti; /* Last instruction if called */ - int f_lineno; /* Current line number */ - int f_restricted; /* Flag set if restricted operations - in this scope */ - int f_iblock; /* index in f_blockstack */ - PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ - int f_nlocals; /* number of locals */ - int f_ncells; - int f_nfreevars; - int f_stacksize; /* size of value stack */ - PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ - } PyFrameObject; - - #else - typedef struct _frame { PyObject_VAR_HEAD struct _frame *f_back; /* previous frame, or NULL */ PyCodeObject *f_code; /* code segment */ PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ --- 18,28 ---- } PyTryBlock; typedef struct _frame { PyObject_VAR_HEAD struct _frame *f_back; /* previous frame, or NULL */ + #ifdef STACKLESS + /* support for soft stackless */ + PyFrame_ExecFunc *f_execute; + #endif PyCodeObject *f_code; /* code segment */ PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ *************** *** 66,70 **** --- 36,42 ---- PyObject *f_trace; /* Trace function */ PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; + #ifndef STACKLESS PyThreadState *f_tstate; + #endif int f_lasti; /* Last instruction if called */ /* As of 2.3 f_lineno is only valid when tracing is active (i.e. when *************** *** 82,86 **** } PyFrameObject; - #endif /* Standard object interface */ --- 54,57 ---- Index: methodobject.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Include/methodobject.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** methodobject.h 25 Mar 2004 22:59:07 -0000 1.6 --- methodobject.h 24 Apr 2004 23:29:39 -0000 1.7 *************** *** 37,41 **** char *ml_doc; }; - typedef struct PyMethodDef PyMethodDef; --- 37,40 ---- *************** *** 59,63 **** --- 58,64 ---- #define METH_CLASS 0x0010 #define METH_STATIC 0x0020 + #ifdef STACKLESS #define METH_STACKLESS 0x0040 + #endif typedef struct PyMethodChain { _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 23 02:34:40 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 23 Apr 2004 02:34:40 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Lib pickle.py,1.6,1.7 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Lib In directory centera.de:/tmp/cvs-serv4949/dev/Lib Modified Files: pickle.py Log Message: I did a complete rewrite of Stackless pickling. There is *no longer* any patched type. All post-pickled builtin types are now installed into copy_reg. This is done through a module _wrap in stackless. The implementation use sshadow type objects which act like the real types, but they have __reduce__, __new__, __setstate__. This works just great now. One missing spot is pickleing of def f():yield 42 pickle.dumps(type(f()).next) This needs a slot wrapper which is missing. Besides that, I have thought out a second rewrite of pickling which uses a simple special object, which is much smaller and can serve the same service. This will generalize pickling even much more and will make it easier to adopt to all those many new types in Zope, for instance. Stay tuned! Index: pickle.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Lib/pickle.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pickle.py 27 Jan 2004 06:15:44 -0000 1.6 --- pickle.py 23 Apr 2004 00:34:37 -0000 1.7 *************** *** 213,216 **** --- 213,221 ---- self.bin = protocol >= 1 self.fast = 0 + try: + from stackless import _pickle_moduledict + except ImportError: + _pickle_moduledict = lambda:None + self._pickle_moduledict = _pickle_moduledict def clear_memo(self): *************** *** 653,656 **** --- 658,664 ---- def save_dict(self, obj): + modict_saver = self._pickle_moduledict(self, obj) + if modict_saver is not None: + return self.save_reduce(*modict_saver) write = self.write *************** *** 787,800 **** except PicklingError, e: pass ! # Check for a __reduce_ex__ method, fall back to __reduce__ ! reduce = getattr(obj, "__reduce_ex__", None) if reduce: ! rv = reduce(self.proto) else: ! reduce = getattr(obj, "__reduce__", None) if reduce: ! rv = reduce() else: ! raise e return self.save_reduce(obj=obj, *rv) --- 795,813 ---- except PicklingError, e: pass ! # Check copy_reg.dispatch_table ! reduce = dispatch_table.get(type(obj)) if reduce: ! rv = reduce(obj) else: ! # Check for a __reduce_ex__ method, fall back to __reduce__ ! reduce = getattr(obj, "__reduce_ex__", None) if reduce: ! rv = reduce(self.proto) else: ! reduce = getattr(obj, "__reduce__", None) ! if reduce: ! rv = reduce() ! else: ! raise e return self.save_reduce(obj=obj, *rv) _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:29:43 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:29:43 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Doc/tut tut.tex, 1.3, 1.4 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Doc/tut In directory centera.de:/tmp/cvs-serv10482/Doc/tut Modified Files: tut.tex Log Message: I did a big cleanup. Tried to reformat everything using 8-tabs, roemoved dead code, and tried to make all Python source file whitespace compatible with the Stackless' version. I hope I didn't make too many mistakes... Index: tut.tex =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Doc/tut/tut.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tut.tex 14 Jan 2004 19:11:07 -0000 1.3 --- tut.tex 24 Apr 2004 23:29:40 -0000 1.4 *************** *** 2811,2825 **** set of modules found in a package. - \subsection{Packages in Multiple Directories} - - Packages support one more special attribute, \member{__path__}. This - is initialized to be a list containing the name of the directory - holding the package's \file{__init__.py} before the code in that file - is executed. This variable can be modified; doing so affects future - searches for modules and subpackages contained in the package. - - While this feature is not often needed, it can be used to extend the - set of modules found in a package. - --- 2811,2814 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:29:41 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:29:41 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Modules _hotshot.c, 1.4, 1.5 _tkinter.c, 1.6, 1.7 cPickle.c, 1.10, 1.11 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Modules In directory centera.de:/tmp/cvs-serv10482/Modules Modified Files: _hotshot.c _tkinter.c cPickle.c Log Message: I did a big cleanup. Tried to reformat everything using 8-tabs, roemoved dead code, and tried to make all Python source file whitespace compatible with the Stackless' version. I hope I didn't make too many mistakes... Index: _hotshot.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Modules/_hotshot.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** _hotshot.c 14 Jan 2004 19:11:07 -0000 1.4 --- _hotshot.c 24 Apr 2004 23:29:39 -0000 1.5 *************** *** 1622,1626 **** ! DL_IMPORT(void) init_hotshot(void) { --- 1622,1626 ---- ! void init_hotshot(void) { Index: _tkinter.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Modules/_tkinter.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _tkinter.c 14 Jan 2004 19:11:07 -0000 1.6 --- _tkinter.c 24 Apr 2004 23:29:39 -0000 1.7 *************** *** 1996,2002 **** } } - res = PyEval_CallObject(func, arg); - Py_DECREF(arg); --- 1996,2000 ---- Index: cPickle.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Modules/cPickle.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** cPickle.c 23 Apr 2004 00:34:37 -0000 1.10 --- cPickle.c 24 Apr 2004 23:29:39 -0000 1.11 *************** *** 2271,2279 **** ! if (listitems && batch_list(self, listitems) < 0) ! return -1; ! if (dictitems && batch_dict(self, dictitems) < 0) ! return -1; if (state) { --- 2271,2279 ---- ! if (listitems && batch_list(self, listitems) < 0) ! return -1; ! if (dictitems && batch_dict(self, dictitems) < 0) ! return -1; if (state) { _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 20:13:44 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 20:13:44 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python getversion.c, 1.4, 1.5 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv7009/Python Modified Files: getversion.c Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: getversion.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/getversion.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** getversion.c 29 Apr 2004 17:58:58 -0000 1.4 --- getversion.c 29 Apr 2004 18:13:42 -0000 1.5 *************** *** 8,12 **** #ifdef STACKLESS /* avoiding to recompile everything for Stackless all the time */ ! #include "core/stackless_version.h" const char * --- 8,12 ---- #ifdef STACKLESS /* avoiding to recompile everything for Stackless all the time */ ! #include "stackless_version.h" const char * _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 04:36:23 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 04:36:23 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Lib copy_reg.py, 1.1.1.3, 1.2 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Lib In directory centera.de:/tmp/cvs-serv17250/dev/Lib Modified Files: copy_reg.py Log Message: supporting stackless pickling for types which don't have __reduce__ when they allow for inheritance. Example: module Index: copy_reg.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Lib/copy_reg.py,v retrieving revision 1.1.1.3 retrieving revision 1.2 diff -C2 -d -r1.1.1.3 -r1.2 *** copy_reg.py 8 Jan 2004 22:09:41 -0000 1.1.1.3 --- copy_reg.py 29 Apr 2004 02:36:21 -0000 1.2 *************** *** 68,71 **** --- 68,78 ---- if base is self.__class__: raise TypeError, "can't pickle %s objects" % base.__name__ + ## Stackless addition BEGIN + # if base is only supported by our shadow types in copy_reg, + # we need to substitute here: + reducer = dispatch_table.get(base) + if reducer: + base = reducer(self)[0] + ## Stackless addition END state = base(self) args = (self.__class__, base, state) _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:29:43 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:29:43 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/PCbuild pythoncore.dsp, 1.55, 1.56 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/PCbuild In directory centera.de:/tmp/cvs-serv10482/PCbuild Modified Files: pythoncore.dsp Log Message: I did a big cleanup. Tried to reformat everything using 8-tabs, roemoved dead code, and tried to make all Python source file whitespace compatible with the Stackless' version. I hope I didn't make too many mistakes... Index: pythoncore.dsp =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/PCbuild/pythoncore.dsp,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** pythoncore.dsp 18 Apr 2004 19:51:27 -0000 1.55 --- pythoncore.dsp 24 Apr 2004 23:29:40 -0000 1.56 *************** *** 165,176 **** # Begin Source File - SOURCE=..\Stackless\stackless_ceval.h - # End Source File - # Begin Source File - - SOURCE=..\Stackless\stackless_frame.h - # End Source File - # Begin Source File - SOURCE=..\Stackless\stackless_impl.h # End Source File --- 165,168 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 00:04:04 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 00:04:04 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Greenlet switch_ppc_macosx.h, 1.1, 1.2 switch_ppc_unix.h, 1.1, 1.2 switch_s390_unix.h, 1.1, 1.2 switch_sparc_sun_gcc.h, 1.1, 1.2 switch_x86_msvc.h, 1.1, 1.2 switch_x86_unix.h, 1.1, 1.2 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Greenlet In directory centera.de:/tmp/cvs-serv29667/src/2.3/dev/Greenlet Modified Files: switch_ppc_macosx.h switch_ppc_unix.h switch_s390_unix.h switch_sparc_sun_gcc.h switch_x86_msvc.h switch_x86_unix.h Log Message: fixed a typo in the comments. Index: switch_ppc_macosx.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Greenlet/switch_ppc_macosx.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** switch_ppc_macosx.h 14 Mar 2004 19:52:10 -0000 1.1 --- switch_ppc_macosx.h 17 Apr 2004 22:04:01 -0000 1.2 *************** *** 11,16 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the --- 11,16 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the Index: switch_ppc_unix.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Greenlet/switch_ppc_unix.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** switch_ppc_unix.h 14 Mar 2004 19:52:10 -0000 1.1 --- switch_ppc_unix.h 17 Apr 2004 22:04:01 -0000 1.2 *************** *** 11,16 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 04-Oct-02 Gustavo Niemeyer * Ported from MacOS version. --- 11,16 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 04-Oct-02 Gustavo Niemeyer * Ported from MacOS version. Index: switch_s390_unix.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Greenlet/switch_s390_unix.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** switch_s390_unix.h 14 Mar 2004 19:52:10 -0000 1.1 --- switch_s390_unix.h 17 Apr 2004 22:04:01 -0000 1.2 *************** *** 6,11 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 06-Oct-02 Gustavo Niemeyer * Ported to Linux/S390. --- 6,11 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 06-Oct-02 Gustavo Niemeyer * Ported to Linux/S390. Index: switch_sparc_sun_gcc.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Greenlet/switch_sparc_sun_gcc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** switch_sparc_sun_gcc.h 14 Mar 2004 19:52:10 -0000 1.1 --- switch_sparc_sun_gcc.h 17 Apr 2004 22:04:01 -0000 1.2 *************** *** 6,11 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the --- 6,11 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the Index: switch_x86_msvc.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Greenlet/switch_x86_msvc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** switch_x86_msvc.h 14 Mar 2004 19:52:10 -0000 1.1 --- switch_x86_msvc.h 17 Apr 2004 22:04:01 -0000 1.2 *************** *** 6,11 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 26-Sep-02 Christian Tismer * again as a result of virtualized stack access, --- 6,11 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 26-Sep-02 Christian Tismer * again as a result of virtualized stack access, Index: switch_x86_unix.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Greenlet/switch_x86_unix.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** switch_x86_unix.h 14 Mar 2004 19:52:10 -0000 1.1 --- switch_x86_unix.h 17 Apr 2004 22:04:01 -0000 1.2 *************** *** 6,11 **** * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) - * STACK_REFPLUS will probably be 1 in most cases. * gets included into the saved stack area. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the --- 6,11 ---- * needed to add another magic constant to insure * that f in slp_eval_frame(PyFrameObject *f) * gets included into the saved stack area. + * STACK_REFPLUS will probably be 1 in most cases. * 17-Sep-02 Christian Tismer * after virtualizing stack save/restore, the _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:29:43 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:29:43 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Lib/test test_generators.py, 1.4, 1.5 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Lib/test In directory centera.de:/tmp/cvs-serv10482/Lib/test Modified Files: test_generators.py Log Message: I did a big cleanup. Tried to reformat everything using 8-tabs, roemoved dead code, and tried to make all Python source file whitespace compatible with the Stackless' version. I hope I didn't make too many mistakes... Index: test_generators.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Lib/test/test_generators.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_generators.py 14 Mar 2004 14:38:03 -0000 1.4 --- test_generators.py 24 Apr 2004 23:29:40 -0000 1.5 *************** *** 377,387 **** ... yield 1 ... ! >>> import types ! >>> isinstance(g, types.FunctionType) ! True >>> i = g() ! >>> import types ! >>> isinstance(i,types.GeneratorType) ! True >>> [s for s in dir(i) if not s.startswith('_')] ['gi_frame', 'gi_running', 'next'] --- 377,385 ---- ... yield 1 ... ! >>> type(g) ! >>> i = g() ! >>> type(i) ! >>> [s for s in dir(i) if not s.startswith('_')] ['gi_frame', 'gi_running', 'next'] *************** *** 390,393 **** --- 388,392 ---- >>> iter(i) is i True + >>> import types >>> isinstance(i, types.GeneratorType) True *************** *** 397,402 **** >>> i.gi_running 0 ! >>> type(i.gi_frame).__name__ ! 'frame' >>> i.gi_running = 42 Traceback (most recent call last): --- 396,401 ---- >>> i.gi_running 0 ! >>> type(i.gi_frame) ! >>> i.gi_running = 42 Traceback (most recent call last): *************** *** 736,749 **** ... if 0: ... yield 1 ! >>> import types ! >>> isinstance(f(),types.GeneratorType) ! True >>> def f(): ... if "": ... yield None ! >>> import types ! >>> isinstance(f(),types.GeneratorType) ! True >>> def f(): --- 735,746 ---- ... if 0: ... yield 1 ! >>> type(f()) ! >>> def f(): ... if "": ... yield None ! >>> type(f()) ! >>> def f(): *************** *** 768,774 **** ... x = 1 ... return ! >>> import types ! >>> isinstance(f(),types.GeneratorType) ! True >>> def f(): --- 765,770 ---- ... x = 1 ... return ! >>> type(f()) ! >>> def f(): *************** *** 795,801 **** ... if 0: ... yield 2 ! >>> import types ! >>> isinstance(f(),types.GeneratorType) ! True --- 791,796 ---- ... if 0: ... yield 2 ! >>> type(f()) ! _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 23:02:36 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 23:02:36 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/core backwardcompat.h, NONE, 1.1 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/core In directory centera.de:/tmp/cvs-serv12423/Stackless/core Added Files: backwardcompat.h Log Message: making the Stackless folder version independent --- NEW FILE: backwardcompat.h --- #ifndef PyAPI_DATA #define PyAPI_PRE_23 /* * this is a partial extract from 2.3's pyport.h. * We try to make new-style declarations work. */ #if defined(__CYGWIN__) || defined(__BEOS__) # define HAVE_DECLSPEC_DLL #endif #if defined(Py_ENABLE_SHARED) /* only get special linkage if built as shared */ # if defined(HAVE_DECLSPEC_DLL) # ifdef Py_BUILD_CORE # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE # define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE /* module init functions inside the core need no external linkage */ # define PyMODINIT_FUNC void # else /* Py_BUILD_CORE */ /* Building an extension module, or an embedded situation */ /* public Python functions and data are imported */ /* Under Cygwin, auto-import functions to prevent compilation */ /* failures similar to http://python.org/doc/FAQ.html#3.24 */ # if !defined(__CYGWIN__) # define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE # endif /* !__CYGWIN__ */ # define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE /* module init functions outside the core must be exported */ # if defined(__cplusplus) # define PyMODINIT_FUNC extern "C" __declspec(dllexport) void # else /* __cplusplus */ # define PyMODINIT_FUNC __declspec(dllexport) void # endif /* __cplusplus */ # endif /* Py_BUILD_CORE */ # endif /* HAVE_DECLSPEC */ #endif /* Py_ENABLE_SHARED */ /* If no external linkage macros defined by now, create defaults */ #ifndef PyAPI_FUNC # define PyAPI_FUNC(RTYPE) RTYPE #endif #ifndef PyAPI_DATA # define PyAPI_DATA(RTYPE) extern RTYPE #endif #ifndef PyMODINIT_FUNC # if defined(__cplusplus) # define PyMODINIT_FUNC extern "C" void # else /* __cplusplus */ # define PyMODINIT_FUNC void # endif /* __cplusplus */ #endif /* a couple of compatibility definitions */ #endif _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:59:00 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:59:00 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Include pystate.h, 1.9, 1.10 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Include In directory centera.de:/tmp/cvs-serv5382/Include Modified Files: pystate.h Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: pystate.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Include/pystate.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pystate.h 14 Jan 2004 19:11:07 -0000 1.9 --- pystate.h 29 Apr 2004 17:58:58 -0000 1.10 *************** *** 6,10 **** #define Py_PYSTATE_H #ifdef STACKLESS ! #include "stackless_tstate.h" #endif #ifdef __cplusplus --- 6,10 ---- #define Py_PYSTATE_H #ifdef STACKLESS ! #include "core/stackless_tstate.h" #endif #ifdef __cplusplus _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 23 02:34:40 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 23 Apr 2004 02:34:40 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless prickelpit.c, 1.62, 1.63 prickelpit.h, 1.9, 1.10 stackless_impl.h, 1.81, 1.82 stackless_structs.h, 1.59, 1.60 stacklesseval.c, 1.139, 1.140 stacklessmodule.c, 1.164, 1.165 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv4949/dev/Stackless Modified Files: prickelpit.c prickelpit.h stackless_impl.h stackless_structs.h stacklesseval.c stacklessmodule.c Log Message: I did a complete rewrite of Stackless pickling. There is *no longer* any patched type. All post-pickled builtin types are now installed into copy_reg. This is done through a module _wrap in stackless. The implementation use sshadow type objects which act like the real types, but they have __reduce__, __new__, __setstate__. This works just great now. One missing spot is pickleing of def f():yield 42 pickle.dumps(type(f()).next) This needs a slot wrapper which is missing. Besides that, I have thought out a second rewrite of pickling which uses a simple special object, which is much smaller and can serve the same service. This will generalize pickling even much more and will make it easier to adopt to all those many new types in Zope, for instance. Stay tuned! Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** prickelpit.c 19 Apr 2004 19:46:21 -0000 1.62 --- prickelpit.c 23 Apr 2004 00:34:37 -0000 1.63 *************** *** 12,74 **** /****************************************************** ! support code for post-installing of pickling ! *******************************************************/ ! static PyObject *_patched_types = NULL; ! static int meth_table_len(PyMethodDef *ml) { [...2157 lines suppressed...] || init_tracebacktype() || init_moduletype() || init_itertype() || init_methodtype() || init_dictitertype() || init_enumtype() || init_listitertype() || init_rangeitertype() || init_tupleitertype() || init_rangetype() ! || init_methodwrappertype() ! || init_generatortype() ! ) ret = -1; ! Py_XDECREF(pickle_reg); ! Py_XDECREF(copy_reg); ! return 0; } #endif Index: prickelpit.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** prickelpit.h 19 Apr 2004 19:46:21 -0000 1.9 --- prickelpit.h 23 Apr 2004 00:34:37 -0000 1.10 *************** *** 42,53 **** */ ! /* the special proxy for module dicts */ ! PyAPI_FUNC(PyObject *) PyModuleDict_New(PyObject *name); /* initialization */ int init_prickelpit(void); - int init_prickelpit_post(void); #ifdef __cplusplus --- 42,54 ---- */ ! /* helper functions for module dicts */ ! PyAPI_FUNC(PyObject *) PyStackless_Pickle_ModuleDict(PyObject *pickler, PyObject *self); ! PyAPI_FUNC(PyObject *) slp_pickle_moduledict(PyObject *self, PyObject *args); ! PyAPI_DATA(char slp_pickle_moduledict__doc__[]); /* initialization */ int init_prickelpit(void); #ifdef __cplusplus Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** stackless_impl.h 19 Apr 2004 16:08:56 -0000 1.81 --- stackless_impl.h 23 Apr 2004 00:34:37 -0000 1.82 *************** *** 17,20 **** --- 17,21 ---- #include "stackless_frame.h" #include "stackless_structs.h" + #include "prickelpit.h" #undef STACKLESS_SPY *************** *** 99,102 **** --- 100,109 ---- PyAPI_DATA(PyTypeObject) PyGenerator_Type; PyAPI_FUNC(PyObject *) PyGenerator_New(struct _frame *f); + #define PyGenerator_Check(op) PyObject_TypeCheck(op, &PyGenerator_Type) + + /* exposing the method wrapper type for pickling */ + + PyAPI_DATA(PyTypeObject) PyMethodWrapper_Type; + #define PyMethodWrapper_Check(op) PyObject_TypeCheck(op, &PyMethodWrapper_Type) /* fast (release) and safe (debug) access to the unwind token and retval */ Index: stackless_structs.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_structs.h,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** stackless_structs.h 29 Mar 2004 00:04:45 -0000 1.59 --- stackless_structs.h 23 Apr 2004 00:34:37 -0000 1.60 *************** *** 163,174 **** /* PyCFrame_Type in stackless_frame.h */ - PyAPI_DATA(PyTypeObject) PyEnumFactory_Type; - #define PyEnumFactory_Check(op) PyObject_TypeCheck(op, &PyEnumFactory_Type) - #define PyEnumFactory_CheckExact(op) ((op)->ob_type == &PyEnumFactory_Type) - - PyAPI_DATA(PyTypeObject) PyModuleDict_Type; - #define PyModuleDict_Check(op) PyObject_TypeCheck(op, &PyModuleDict_Type) - #define PyModuleDict_CheckExact(op) ((op)->ob_type == &PyModuleDict_Type) - PyAPI_DATA(PyTypeObject) PyCStack_Type; --- 163,166 ---- Index: stacklesseval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklesseval.c,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** stacklesseval.c 18 Apr 2004 14:07:33 -0000 1.139 --- stacklesseval.c 23 Apr 2004 00:34:38 -0000 1.140 *************** *** 511,573 **** } - static PyObject * - generator_reduce(genobject *gen) - { - PyObject *tup; - tup = Py_BuildValue("(O(Oi))", - &PyGenerator_Type, - gen->gi_frame, - gen->gi_running - ); - return tup; - } - - static - PyObject * - generator_new(PyTypeObject *type, PyObject *args, PyObject *kwds) - { - genobject *gen = NULL; - PyFrameObject *f; - int gi_running; - - if (kwds != NULL) { - PyErr_SetString(PyExc_ValueError, "Keyword parameters not supported for generator_new"); - return NULL; - } - - if (!PyArg_ParseTuple(args, "O!i:generator", - &PyFrame_Type, &f, &gi_running)) - return NULL; - - if (!gi_running) { - if ((f = slp_ensure_new_frame(f)) != NULL) { - /* PyGenerator_New eats an existing reference */ - if ((gen = (genobject *) PyGenerator_New(f)) == NULL) { - Py_DECREF(f); - } - } - return (PyObject *) gen; - } - - gen = PyObject_GC_New(genobject, &PyGenerator_Type); - if (gen == NULL) { - Py_DECREF(f); - return NULL; - } - /* - * The frame might now be initially unpickled (with PyNone as f_back), - * or it is already chained into a tasklet. - * Fortunately, we can simply leave it this way: - * since gi_running is set, there is no way to continue the - * generator without the corresponding tasklet. - */ - Py_INCREF(f); - gen->gi_frame = f; - gen->gi_running = gi_running; - gen->gi_weakreflist = NULL; - _PyObject_GC_TRACK(gen); - return (PyObject *)gen; - } - static PyMemberDef gen_memberlist[] = { --- 511,514 ---- *************** *** 577,586 **** }; - static struct PyMethodDef gen_methods[] = { - {"__reduce__", (PyCFunction)generator_reduce, METH_NOARGS, - "gi.__reduce__() -- reduce generator for pickling"}, - {NULL, NULL} /* Sentinel */ - }; - PyTypeObject PyGenerator_Type = { --- 518,521 ---- *************** *** 614,628 **** (getiterfunc)gen_getiter, /* tp_iter */ (iternextfunc)gen_iternext, /* tp_iternext */ ! gen_methods, /* tp_methods */ gen_memberlist, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - generator_new, /* tp_new */ }; --- 549,557 ---- (getiterfunc)gen_getiter, /* tp_iter */ (iternextfunc)gen_iternext, /* tp_iternext */ ! 0, /* tp_methods */ gen_memberlist, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ }; Index: stacklessmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklessmodule.c,v retrieving revision 1.164 retrieving revision 1.165 diff -C2 -d -r1.164 -r1.165 *** stacklessmodule.c 19 Apr 2004 19:46:21 -0000 1.164 --- stacklessmodule.c 23 Apr 2004 00:34:38 -0000 1.165 *************** *** 259,264 **** } ! static ! PyObject * run_watchdog(PyObject *self, PyObject *args, PyObject *kwds) { --- 259,263 ---- } ! static PyObject * run_watchdog(PyObject *self, PyObject *args, PyObject *kwds) { *************** *** 270,273 **** --- 269,285 ---- } + static PyObject * + slpmodule_reduce(PyObject *self) + { + return PyObject_GetAttrString(slp_module, "__name__"); + } + + /****************************************************** + + some test functions + + ******************************************************/ + + static char test_cframe__doc__[] = "test_cframe(switches, words=0) -- a builtin testing function that does nothing\n\ *************** *** 645,660 **** static PyMethodDef stackless_methods[] = { ! {"schedule", (PyCFunction)schedule, METH_VARARGS | METH_KEYWORDS | METH_STACKLESS, schedule__doc__}, ! {"schedule_remove", (PyCFunction)schedule_remove, METH_VARARGS | METH_KEYWORDS | METH_STACKLESS, schedule__doc__}, ! {"run", (PyCFunction)run_watchdog, METH_VARARGS | METH_KEYWORDS, run_watchdog__doc__}, ! {"getruncount", (PyCFunction)getruncount, METH_NOARGS, getruncount__doc__}, ! {"getcurrent", (PyCFunction)getcurrent, METH_NOARGS, getcurrent__doc__}, ! {"getmain", (PyCFunction)getmain, METH_NOARGS, getmain__doc__}, ! {"enable_softswitch", (PyCFunction)enable_softswitch, METH_O, enable_soft__doc__}, ! {"test_cframe", (PyCFunction)test_cframe, METH_VARARGS | METH_KEYWORDS, test_cframe__doc__}, ! {"test_cframe_nr", (PyCFunction)test_cframe_nr, METH_VARARGS | METH_KEYWORDS, test_cframe_nr__doc__}, ! {"test_outside", (PyCFunction)test_outside, METH_NOARGS, test_outside__doc__}, {"set_channel_callback", (PyCFunction)set_channel_callback, METH_O, set_channel_callback__doc__}, {"set_schedule_callback", (PyCFunction)set_schedule_callback, METH_O, set_schedule_callback__doc__}, #ifdef STACKLESS_SPY {"_peek", (PyCFunction)_peek, METH_O, _peek__doc__}, --- 657,673 ---- static PyMethodDef stackless_methods[] = { ! {"schedule", (PyCFunction)schedule, METH_VARARGS | METH_KEYWORDS | METH_STACKLESS, schedule__doc__}, ! {"schedule_remove", (PyCFunction)schedule_remove, METH_VARARGS | METH_KEYWORDS | METH_STACKLESS, schedule__doc__}, ! {"run", (PyCFunction)run_watchdog, METH_VARARGS | METH_KEYWORDS, run_watchdog__doc__}, ! {"getruncount", (PyCFunction)getruncount, METH_NOARGS, getruncount__doc__}, ! {"getcurrent", (PyCFunction)getcurrent, METH_NOARGS, getcurrent__doc__}, ! {"getmain", (PyCFunction)getmain, METH_NOARGS, getmain__doc__}, ! {"enable_softswitch", (PyCFunction)enable_softswitch, METH_O, enable_soft__doc__}, ! {"test_cframe", (PyCFunction)test_cframe, METH_VARARGS | METH_KEYWORDS, test_cframe__doc__}, ! {"test_cframe_nr", (PyCFunction)test_cframe_nr, METH_VARARGS | METH_KEYWORDS, test_cframe_nr__doc__}, ! {"test_outside", (PyCFunction)test_outside, METH_NOARGS, test_outside__doc__}, {"set_channel_callback", (PyCFunction)set_channel_callback, METH_O, set_channel_callback__doc__}, {"set_schedule_callback", (PyCFunction)set_schedule_callback, METH_O, set_schedule_callback__doc__}, + {"_pickle_moduledict", (PyCFunction)slp_pickle_moduledict, METH_VARARGS, slp_pickle_moduledict__doc__}, #ifdef STACKLESS_SPY {"_peek", (PyCFunction)_peek, METH_O, _peek__doc__}, *************** *** 663,666 **** --- 676,681 ---- {"_get_refinfo", (PyCFunction)_get_refinfo, METH_NOARGS, _get_refinfo__doc__}, #endif + {"__reduce__", (PyCFunction)slpmodule_reduce, METH_NOARGS, NULL}, + {"__reduce_ex__", (PyCFunction)slpmodule_reduce, METH_VARARGS, NULL}, {NULL, NULL} /* sentinel */ }; *************** *** 687,691 **** m->__tasklet__ = NULL; nameobj = PyString_FromString(name); ! m->md_dict = PyModuleDict_New(nameobj); if (m->md_dict == NULL || nameobj == NULL) goto fail; --- 702,706 ---- m->__tasklet__ = NULL; nameobj = PyString_FromString(name); ! m->md_dict = PyDict_New(); if (m->md_dict == NULL || nameobj == NULL) goto fail; *************** *** 860,864 **** if (0 || init_cframetype() - || init_prickelpit() || init_flextype() || init_tasklettype() --- 875,878 ---- *************** *** 886,890 **** modules = PyImport_GetModuleDict(); slp_module = slpmodule_new(name); ! if (slp_module == NULL || PyDict_SetItemString(modules, name, slp_module) != 0) { Py_DECREF(slp_module); return ; --- 900,904 ---- modules = PyImport_GetModuleDict(); slp_module = slpmodule_new(name); ! if (slp_module == NULL || PyDict_SetItemString(modules, name, slp_module)) { Py_DECREF(slp_module); return ; *************** *** 897,901 **** return; /* errors handled by caller */ ! if (init_prickelpit_post()) return; dict = PyModule_GetDict(slp_module); --- 911,915 ---- return; /* errors handled by caller */ ! if (init_prickelpit()) return; dict = PyModule_GetDict(slp_module); *************** *** 912,918 **** INSERT("stackless", slp_module); - /* module dicts */ - INSERT("modict", &PyModuleDict_Type); - m = (PySlpModuleObject *) slp_module; slpmodule_set__tasklet__(m, &PyTasklet_Type, NULL); --- 926,929 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 5 20:52:48 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 05 Apr 2004 20:52:48 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_impl.h, 1.74, 1.75 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv4466/Stackless Modified Files: stackless_impl.h Log Message: still trying to convince gcc not to blather... Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** stackless_impl.h 5 Apr 2004 18:22:29 -0000 1.74 --- stackless_impl.h 5 Apr 2004 18:52:45 -0000 1.75 *************** *** 293,305 **** /* turn the stackless flag macros into dummies */ ! #define STACKLESS_GETARG() struct x { struct x* y; } ! #define STACKLESS_PROMOTE(func) 0 ! #define STACKLESS_PROMOTE_FLAG(flag) 0 ! #define STACKLESS_PROMOTE_ALL() 0 ! #define STACKLESS_PROPOSE(func) 0 ! #define STACKLESS_PROPOSE_FLAG(flag) 0 ! #define STACKLESS_PROPOSE_ALL() 0 ! #define STACKLESS_RETRACT() ! #define STACKLESS_ASSERT() #endif /* STACKLESS */ --- 293,305 ---- /* turn the stackless flag macros into dummies */ ! #define STACKLESS_GETARG() int stackless = 0 ! #define STACKLESS_PROMOTE(func) stackless = 0 ! #define STACKLESS_PROMOTE_FLAG(flag) stackless = 0 ! #define STACKLESS_PROMOTE_ALL() stackless = 0 ! #define STACKLESS_PROPOSE(func) {int stackless = 0;} ! #define STACKLESS_PROPOSE_FLAG(flag) {int stackless = 0;} ! #define STACKLESS_PROPOSE_ALL() {int stackless = 0;} ! #define STACKLESS_RETRACT() {int stackless = 0;} ! #define STACKLESS_ASSERT() {int stackless = 0;} #endif /* STACKLESS */ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:29:42 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:29:42 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Lib pickle.py,1.7,1.8 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Lib In directory centera.de:/tmp/cvs-serv10482/Lib Modified Files: pickle.py Log Message: I did a big cleanup. Tried to reformat everything using 8-tabs, roemoved dead code, and tried to make all Python source file whitespace compatible with the Stackless' version. I hope I didn't make too many mistakes... Index: pickle.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Lib/pickle.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pickle.py 23 Apr 2004 00:34:37 -0000 1.7 --- pickle.py 24 Apr 2004 23:29:40 -0000 1.8 *************** *** 216,220 **** from stackless import _pickle_moduledict except ImportError: ! _pickle_moduledict = lambda:None self._pickle_moduledict = _pickle_moduledict --- 216,220 ---- from stackless import _pickle_moduledict except ImportError: ! _pickle_moduledict = lambda self, obj:None self._pickle_moduledict = _pickle_moduledict _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Wed Apr 7 19:37:24 2004 From: tismer at centera.de (Christian Tismer) Date: Wed, 07 Apr 2004 19:37:24 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stacklessversion.h, 1.1, NONE Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv16389/dev/Stackless Removed Files: stacklessversion.h Log Message: cleanup dirt. --- stacklessversion.h DELETED --- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 16:07:36 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 16:07:36 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/test taskspeed.py, 1.19, 1.20 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/test In directory centera.de:/tmp/cvs-serv19010/src/2.3/dev/Stackless/test Modified Files: taskspeed.py Log Message: a huge rewrite, moving towards a cleaner implementation with less global state variables. This first step eliminates ts->st.tempval, and it transports values cleanly *inside* the Py_UnwindToken, which has been extended. The token is no longer explicitly used, but tested, loaded and unloaded by some macroes. The next stepp will be to also put the next frame to run into this structure. The final step will be hard: dropping the frame concept and using thunks, instead. This will make frames completely unmodified, a big step towards more compatibility and easier maintenance. Index: taskspeed.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/test/taskspeed.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** taskspeed.py 26 Mar 2004 18:52:39 -0000 1.19 --- taskspeed.py 18 Apr 2004 14:07:33 -0000 1.20 *************** *** 39,43 **** try: args_given = int(sys.argv[1]) ! except: pass def f(n, sched): --- 39,43 ---- try: args_given = int(sys.argv[1]) ! except: sys.exc_clear() def f(n, sched): *************** *** 78,82 **** if stackless.debug: ! niter = 10 if args_given: --- 78,82 ---- if stackless.debug: ! niter = 20 if args_given: _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 23 02:34:40 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 23 Apr 2004 02:34:40 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python pythonrun.c, 1.17, 1.18 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv4949/dev/Python Modified Files: pythonrun.c Log Message: I did a complete rewrite of Stackless pickling. There is *no longer* any patched type. All post-pickled builtin types are now installed into copy_reg. This is done through a module _wrap in stackless. The implementation use sshadow type objects which act like the real types, but they have __reduce__, __new__, __setstate__. This works just great now. One missing spot is pickleing of def f():yield 42 pickle.dumps(type(f()).next) This needs a slot wrapper which is missing. Besides that, I have thought out a second rewrite of pickling which uses a simple special object, which is much smaller and can serve the same service. This will generalize pickling even much more and will make it easier to adopt to all those many new types in Zope, for instance. Stay tuned! Index: pythonrun.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/pythonrun.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pythonrun.c 19 Apr 2004 19:46:21 -0000 1.17 --- pythonrun.c 23 Apr 2004 00:34:38 -0000 1.18 *************** *** 212,218 **** _PyImport_Init(); - #ifdef STACKLESS - _PyStackless_Init(); - #endif /* initialize builtin exceptions */ --- 212,215 ---- *************** *** 227,230 **** --- 224,230 ---- initsigs(); /* Signal handling stuff, including initintr() */ + #ifdef STACKLESS + _PyStackless_Init(); + #endif initmain(); /* Module __main__ */ if (!Py_NoSiteFlag) _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:28:36 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:28:36 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/pickling - New directory Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/pickling In directory centera.de:/tmp/cvs-serv4689/pickling Log Message: Directory /home/cvs/slpdev/src/2.3/dev/Stackless/pickling added to the repository _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 19 21:15:20 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 19 Apr 2004 21:15:20 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python pythonrun.c, 1.15, 1.16 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv23468/dev/Python Modified Files: pythonrun.c Log Message: moved the patched types for pickling into builtins. This should generate less incompatibilites. I tried to use copy_reg, but this still requires some location for the global types, and still would mean to change the type names. Index: pythonrun.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/pythonrun.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pythonrun.c 5 Apr 2004 17:17:36 -0000 1.15 --- pythonrun.c 19 Apr 2004 19:15:18 -0000 1.16 *************** *** 201,204 **** --- 201,207 ---- Py_INCREF(interp->builtins); + #ifdef STACKLESS + _PyStackless_Init(); + #endif sysmod = _PySys_Init(); if (sysmod == NULL) *************** *** 211,217 **** interp->modules); - #ifdef STACKLESS - _PyStackless_Init(); - #endif _PyImport_Init(); --- 214,217 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Wed Apr 7 19:32:22 2004 From: tismer at centera.de (Christian Tismer) Date: Wed, 07 Apr 2004 19:32:22 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_version.h, 1.41, 1.42 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv16188/src/2.3/dev/Stackless Modified Files: stackless_version.h Log Message: cured a really bad bug in the Windows stack switching code. This turned up, after I de-virtualized the cstack operations, and less registers were used. Also clarified a possibly dangling pointer from cstack to tasklet. And TaskletExit inherits from SystemExit, now. Index: stackless_version.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_version.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** stackless_version.h 7 Apr 2004 01:00:59 -0000 1.41 --- stackless_version.h 7 Apr 2004 17:32:19 -0000 1.42 *************** *** 1,5 **** /* * Stackless Python version string ! * created at Wed Apr 07 02:51:47 2004 by mkversion.py */ --- 1,5 ---- /* * Stackless Python version string ! * created at Wed Apr 07 19:24:13 2004 by mkversion.py */ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 04:20:50 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 04:20:50 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/unittests picklebug.py, NONE, 1.1 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/unittests In directory centera.de:/tmp/cvs-serv16771/Stackless/unittests Added Files: picklebug.py Log Message: This script helped me a lot to find a deep problem with generator pickling. Generators did not adhere to the frame protocol, which was assumed by tasklet unpickling. This problem will vanish, soon. The script makes sense, anyway. --- NEW FILE: picklebug.py --- """ This file was needed to figure out a deep problem with generator pickling. I'm adding this file to the unittests as a template to cure similar problems in the future. This file only works in a debug build. """ import sys, gc import cPickle as pickle from stackless import * try: genschedoutertest except NameError: try: execfile("test_pickle.py") except SystemExit: pass t=tasklet(genschedoutertest)(20,13) t.run() s = pickle.dumps(t) t.run() del t pre = None post = None newob = None del pre, post, newob gc.collect() pre = stackless._get_all_objects() post = pre[:] print "refs before unpickling, objects", sys.gettotalrefcount(), len(pre) pickle.loads(s).run() post = None gc.collect() post = stackless._get_all_objects() for i, ob in enumerate(post): if id(ob) == id(pre): del post[i] del i, ob gc.collect() print "refs after unpickling, objects", sys.gettotalrefcount(), len(post) newob = post[:len(post)-len(pre)] print "look into newob" del pre, post gc.collect() _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 23 04:12:27 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 23 Apr 2004 04:12:27 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless prickelpit.c, 1.64, 1.65 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv7951/dev/Stackless Modified Files: prickelpit.c Log Message: still small Linux probs... Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** prickelpit.c 23 Apr 2004 02:09:22 -0000 1.64 --- prickelpit.c 23 Apr 2004 02:12:24 -0000 1.65 *************** *** 91,95 **** }; \ \ ! PyTypeObject wrap_##type = { \ PyObject_HEAD_INIT(&PyType_Type) \ 0, \ --- 91,95 ---- }; \ \ ! static struct _typeobject wrap_##type = { \ PyObject_HEAD_INIT(&PyType_Type) \ 0, \ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Wed Apr 7 19:32:22 2004 From: tismer at centera.de (Christian Tismer) Date: Wed, 07 Apr 2004 19:32:22 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/src/Stackless scheduling.c, 1.85, 1.86 stackless_version.h, 1.40, 1.41 stacklesseval.c, 1.137, 1.138 switch_x86_msvc.h, 1.29, 1.30 Message-ID: Update of /home/cvs/slpdev/src/2.3/src/Stackless In directory centera.de:/tmp/cvs-serv16188/src/2.3/src/Stackless Modified Files: scheduling.c stackless_version.h stacklesseval.c switch_x86_msvc.h Log Message: cured a really bad bug in the Windows stack switching code. This turned up, after I de-virtualized the cstack operations, and less registers were used. Also clarified a possibly dangling pointer from cstack to tasklet. And TaskletExit inherits from SystemExit, now. Index: scheduling.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/src/Stackless/scheduling.c,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** scheduling.c 25 Mar 2004 22:59:07 -0000 1.85 --- scheduling.c 7 Apr 2004 17:32:19 -0000 1.86 *************** *** 126,129 **** --- 126,132 ---- PyCStackObject **cstprev; + if (next == prev) + return 0; + /* since we change the stack we must assure that the protocol was met */ STACKLESS_ASSERT(); *************** *** 477,482 **** task->tempval = result; slp_current_remove(); - Py_DECREF(task); --- 480,485 ---- task->tempval = result; + ts->st.current = task; slp_current_remove(); Py_DECREF(task); Index: stackless_version.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/src/Stackless/stackless_version.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** stackless_version.h 2 Apr 2004 23:53:06 -0000 1.40 --- stackless_version.h 7 Apr 2004 17:32:19 -0000 1.41 *************** *** 1,7 **** /* * Stackless Python version string ! * created at Sat Apr 03 01:43:41 2004 by mkversion.py */ /* keep this entry up-to-date */ ! #define STACKLESS_VERSION "3.0 040403" --- 1,7 ---- /* * Stackless Python version string ! * created at Wed Apr 07 19:24:13 2004 by mkversion.py */ /* keep this entry up-to-date */ ! #define STACKLESS_VERSION "3.0 040407" Index: stacklesseval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/src/Stackless/stacklesseval.c,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** stacklesseval.c 31 Mar 2004 01:26:36 -0000 1.137 --- stacklesseval.c 7 Apr 2004 17:32:19 -0000 1.138 *************** *** 137,140 **** --- 137,142 ---- slp_cstack_restore(PyCStackObject *cst) { + /* mark task as no longer responsible for cstack instance */ + cst->task = NULL; memcpy(cst->startaddr - cst->ob_size, &cst->stack, (cst->ob_size) * sizeof(int*)); } Index: switch_x86_msvc.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/src/Stackless/switch_x86_msvc.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** switch_x86_msvc.h 24 Nov 2002 15:37:10 -0000 1.29 --- switch_x86_msvc.h 7 Apr 2004 17:32:19 -0000 1.30 *************** *** 31,41 **** #define STACK_MAGIC 0 ! __forceinline static int slp_switch(void) { register int *stackref, stsizediff; __asm mov stackref, esp; ! /* mention EBX, ESI and EDI in order to get them preserved */ ! __asm lea ebx, [esi+edi]; { SLP_SAVE_STATE(stackref, stsizediff); --- 31,42 ---- #define STACK_MAGIC 0 ! static int slp_switch(void) { register int *stackref, stsizediff; __asm mov stackref, esp; ! /* modify EBX, ESI and EDI in order to get them preserved */ ! __asm mov ebx, ebx; ! __asm xchg esi, edi; { SLP_SAVE_STATE(stackref, stsizediff); _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 16:07:36 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 16:07:36 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless cframeobject.c, 1.63, 1.64 channelobject.c, 1.40, 1.41 prickelpit.c, 1.56, 1.57 prickelpit.h, 1.7, 1.8 scheduling.c, 1.86, 1.87 stackless_frame.h, 1.41, 1.42 stackless_impl.h, 1.77, 1.78 stackless_tstate.h, 1.47, 1.48 stackless_util.c, 1.15, 1.16 stacklesseval.c, 1.138, 1.139 stacklesseval.h, 1.10, 1.11 stacklessmodule.c, 1.160, 1.161 taskletobject.c, 1.105, 1.106 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv19010/src/2.3/dev/Stackless Modified Files: cframeobject.c channelobject.c prickelpit.c prickelpit.h scheduling.c stackless_frame.h stackless_impl.h stackless_tstate.h stackless_util.c stacklesseval.c stacklesseval.h stacklessmodule.c taskletobject.c Log Message: a huge rewrite, moving towards a cleaner implementation with less global state variables. This first step eliminates ts->st.tempval, and it transports values cleanly *inside* the Py_UnwindToken, which has been extended. The token is no longer explicitly used, but tested, loaded and unloaded by some macroes. The next stepp will be to also put the next frame to run into this structure. The final step will be hard: dropping the frame concept and using thunks, instead. This will make frames completely unmodified, a big step towards more compatibility and easier maintenance. Index: cframeobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/cframeobject.c,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** cframeobject.c 27 Mar 2004 01:22:45 -0000 1.63 --- cframeobject.c 18 Apr 2004 14:07:33 -0000 1.64 *************** *** 184,197 **** } ! static PyObject * run_cframe(PyFrameObject *f) { PyThreadState *ts = PyThreadState_GET(); PyCFrameObject *c = (PyCFrameObject*) f; - PyObject *result = NULL; ts->frame = f; ! result = ts->st.tempval; ! ts->st.tempval = NULL; ! if (result == NULL) goto exit_run_cframe; if (c->callable == NULL) { --- 184,194 ---- } ! static PyObject * run_cframe(PyFrameObject *f, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); PyCFrameObject *c = (PyCFrameObject*) f; ts->frame = f; ! if (retval == NULL) goto exit_run_cframe; if (c->callable == NULL) { *************** *** 204,225 **** * which should try to look like any other Python function. */ ! Py_DECREF(result); if (PyCFunction_Check(c->callable) && PyCFunction_GET_FLAGS(c->callable) & METH_KEYWORDS && PyCFunction_GET_FUNCTION(c->callable) != NULL) { STACKLESS_PROPOSE_FLAG(PyCFunction_GET_FLAGS(c->callable) & METH_STACKLESS); ! result = (*(PyCFunctionWithKeywords)PyCFunction_GET_FUNCTION(c->callable))( PyCFunction_GET_SELF(c->callable), c->args, c->kwds); } else { STACKLESS_PROPOSE_ALL(); ! result = PyObject_Call(c->callable, c->args, c->kwds); } STACKLESS_ASSERT(); ! if (result == Py_UnwindToken) { Py_DECREF(c->callable); c->callable = NULL; ! return Py_UnwindToken; } } --- 201,222 ---- * which should try to look like any other Python function. */ ! Py_DECREF(retval); if (PyCFunction_Check(c->callable) && PyCFunction_GET_FLAGS(c->callable) & METH_KEYWORDS && PyCFunction_GET_FUNCTION(c->callable) != NULL) { STACKLESS_PROPOSE_FLAG(PyCFunction_GET_FLAGS(c->callable) & METH_STACKLESS); ! retval = (*(PyCFunctionWithKeywords)PyCFunction_GET_FUNCTION(c->callable))( PyCFunction_GET_SELF(c->callable), c->args, c->kwds); } else { STACKLESS_PROPOSE_ALL(); ! retval = PyObject_Call(c->callable, c->args, c->kwds); } STACKLESS_ASSERT(); ! if (STACKLESS_UNWINDING(retval)) { Py_DECREF(c->callable); c->callable = NULL; ! return retval; } } *************** *** 228,232 **** ts->frame = c->bf.f_back; Py_DECREF(f); ! return result; } --- 225,229 ---- ts->frame = c->bf.f_back; Py_DECREF(f); ! return retval; } Index: channelobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/channelobject.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** channelobject.c 27 Mar 2004 01:22:45 -0000 1.40 --- channelobject.c 18 Apr 2004 14:07:33 -0000 1.41 *************** *** 253,262 **** } Py_INCREF(ts->frame); ! /* the retval is still in ts->st.tempval, so we're ready */ ! return Py_UnwindToken; } static PyObject * ! channel_blocking_finished_send(PyFrameObject *f) { PyThreadState *ts = PyThreadState_GET(); --- 253,262 ---- } Py_INCREF(ts->frame); ! /* the retval is still in the unwind token, so we're ready */ ! return (PyObject *) Py_UnwindToken; } static PyObject * ! channel_blocking_finished_send(PyFrameObject *f, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); *************** *** 265,284 **** Py_DECREF(cbf->tasklet); ts->frame = f->f_back; ! return Py_UnwindToken; } static PyObject * ! channel_blocking_finished_recv(PyFrameObject *f) { PyThreadState *ts = PyThreadState_GET(); channel_blocking_frame *cbf = (channel_blocking_frame *) f; - PyObject *result = ts->st.tempval; PyObject *rval; /* support for exception instances */ ! if (PyObject_IsInstance(result, PyExc_Exception)) { ! PyObject *type = (PyObject *) ((PyInstanceObject*)result)->in_class; ! PyObject *args = PyObject_GetAttrString(result, "args"); Py_INCREF(type); /* special case: un-wrap a string exception */ --- 265,283 ---- Py_DECREF(cbf->tasklet); ts->frame = f->f_back; ! return STACKLESS_PACK(retval); } static PyObject * ! channel_blocking_finished_recv(PyFrameObject *f, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); channel_blocking_frame *cbf = (channel_blocking_frame *) f; PyObject *rval; /* support for exception instances */ ! if (PyObject_IsInstance(retval, PyExc_Exception)) { ! PyObject *type = (PyObject *) ((PyInstanceObject*)retval)->in_class; ! PyObject *args = PyObject_GetAttrString(retval, "args"); Py_INCREF(type); /* special case: un-wrap a string exception */ *************** *** 291,302 **** type = t; Py_INCREF(a); ! Py_DECREF(result); ! result = a; } Py_XDECREF(args); ! PyErr_Restore(type, result, NULL); rval = NULL; } else { ! rval = Py_UnwindToken; } --- 290,301 ---- type = t; Py_INCREF(a); ! Py_DECREF(retval); ! retval = a; } Py_XDECREF(args); ! PyErr_Restore(type, retval, NULL); rval = NULL; } else { ! rval = STACKLESS_PACK(retval); } *************** *** 311,315 **** PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *sender, *receiver; ! PyObject *ret; assert(PyChannel_Check(self)); if (ts->st.main == NULL) return PyChannel_Send_M(self, arg); --- 310,314 ---- PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *sender, *receiver; ! PyObject *retval; assert(PyChannel_Check(self)); if (ts->st.main == NULL) return PyChannel_Send_M(self, arg); *************** *** 330,344 **** NOTIFY_SEND(self, sender, 0, NULL); ! Py_INCREF(Py_None); ! ts->st.tempval = Py_None; ! switch (slp_schedule_nr_maybe(sender, receiver)) { ! case -1: ! return NULL; ! case 1: ! return Py_UnwindToken; ! } ! if (slp_schedule_task(sender, receiver)) return NULL; ! if (ts->st.tempval == NULL) return NULL; } else { --- 329,336 ---- NOTIFY_SEND(self, sender, 0, NULL); ! retval = Py_None; ! Py_INCREF(retval); ! return slp_schedule_task(sender, receiver, 1, retval); } else { *************** *** 353,367 **** NOTIFY_SEND(self, sender, 1, NULL); Py_INCREF(arg); - ts->st.tempval = arg; receiver = ts->st.current; ! switch (slp_schedule_nr_maybe(sender, receiver)) { ! case -1: ! return NULL; ! case 1: return channel_blocking_defer(channel_blocking_finished_send, self, sender); } ! if (slp_schedule_task(sender, receiver)) return NULL; ! if (ts->st.tempval == NULL) { if (sender->flags.blocked) { /* they *might* have invented code to unblock me early :-) */ --- 345,356 ---- NOTIFY_SEND(self, sender, 1, NULL); Py_INCREF(arg); receiver = ts->st.current; ! retval = slp_schedule_task(sender, receiver, -1, arg); ! if (STACKLESS_UNWINDING(retval)) { return channel_blocking_defer(channel_blocking_finished_send, self, sender); } ! retval = slp_schedule_task(sender, receiver, 0, arg); ! if (retval == NULL) { if (sender->flags.blocked) { /* they *might* have invented code to unblock me early :-) */ *************** *** 375,382 **** } ! ret = ts->st.tempval; ! ts->st.tempval = NULL; ! return ret; ! } --- 364,368 ---- } ! return retval; } *************** *** 410,417 **** Py_INCREF(Py_None); - ts->st.tempval = Py_None; ! if (slp_schedule_task(sender, receiver)) return NULL; ! if (ts->st.tempval == NULL) return NULL; } else { --- 396,401 ---- Py_INCREF(Py_None); ! return slp_schedule_task(sender, receiver, 0, Py_None); } else { *************** *** 432,440 **** Py_INCREF(arg); - ts->st.tempval = arg; receiver = ts->st.current; ! if (slp_schedule_task(sender, receiver)) return NULL; ! if (ts->st.tempval == NULL) { if (sender->flags.blocked) { /* they *might* have invented code to unblock me early :-) */ --- 416,423 ---- Py_INCREF(arg); receiver = ts->st.current; ! ret = slp_schedule_task(sender, receiver, 0, arg); ! if (ret == NULL) { if (sender->flags.blocked) { /* they *might* have invented code to unblock me early :-) */ *************** *** 448,453 **** } - ret = ts->st.tempval; - ts->st.tempval = NULL; return ret; } --- 431,434 ---- *************** *** 579,583 **** channel_send_exception_nr(PyObject *myself, PyObject *args) { ! PyObject *result = NULL; PyObject *klass = PySequence_GetItem(args, 0); PyThreadState *ts = PyThreadState_GET(); --- 560,564 ---- channel_send_exception_nr(PyObject *myself, PyObject *args) { ! PyObject *retval = NULL; PyObject *klass = PySequence_GetItem(args, 0); PyThreadState *ts = PyThreadState_GET(); *************** *** 589,606 **** goto err_exit; } ! result = impl_channel_send_exception_nr((PyChannelObject*)myself, klass, args); ! if (result == NULL) { goto err_exit; ! } else if (result == Py_UnwindToken) { Py_INCREF(Py_None); caller->tempval = Py_None; ! return result; } Py_INCREF(Py_None); ! result = Py_None; err_exit: Py_DECREF(klass); Py_XDECREF(args); ! return result; } --- 570,587 ---- goto err_exit; } ! retval = impl_channel_send_exception_nr((PyChannelObject*)myself, klass, args); ! if (retval == NULL) { goto err_exit; ! } else if (STACKLESS_UNWINDING(retval)) { Py_INCREF(Py_None); caller->tempval = Py_None; ! return retval; } Py_INCREF(Py_None); ! retval = Py_None; err_exit: Py_DECREF(klass); Py_XDECREF(args); ! return retval; } *************** *** 608,612 **** channel_send_exception(PyObject *myself, PyObject *args) { ! PyObject *result = NULL; PyObject *klass = PySequence_GetItem(args, 0); PyThreadState *ts = PyThreadState_GET(); --- 589,593 ---- channel_send_exception(PyObject *myself, PyObject *args) { ! PyObject *retval = NULL; PyObject *klass = PySequence_GetItem(args, 0); PyThreadState *ts = PyThreadState_GET(); *************** *** 618,635 **** goto err_exit; } ! result = impl_channel_send_exception_nr((PyChannelObject*)myself, klass, args); ! if (result == NULL) { goto err_exit; ! } else if (result == Py_UnwindToken) { Py_INCREF(Py_None); caller->tempval = Py_None; ! return result; } Py_INCREF(Py_None); ! result = Py_None; err_exit: Py_DECREF(klass); Py_XDECREF(args); ! return result; } --- 599,616 ---- goto err_exit; } ! retval = impl_channel_send_exception_nr((PyChannelObject*)myself, klass, args); ! if (retval == NULL) { goto err_exit; ! } else if (STACKLESS_UNWINDING(retval)) { Py_INCREF(Py_None); caller->tempval = Py_None; ! return retval; } Py_INCREF(Py_None); ! retval = Py_None; err_exit: Py_DECREF(klass); Py_XDECREF(args); ! return retval; } *************** *** 700,712 **** /* note that we don't set tempval since the sender does it */ ! switch (slp_schedule_nr_maybe(receiver, ts->st.current)) { ! case -1: ! return NULL; ! case 1: return channel_blocking_defer(channel_blocking_finished_recv, self, receiver); } ! if (slp_schedule_task(receiver, ts->st.current)) return NULL; ! if (ts->st.tempval == NULL) { /* reactivate on exception */ if (receiver->flags.blocked) { --- 681,691 ---- /* note that we don't set tempval since the sender does it */ ! result = slp_schedule_task(receiver, ts->st.current, -1, NULL); ! if (STACKLESS_UNWINDING(result)) { return channel_blocking_defer(channel_blocking_finished_recv, self, receiver); } ! result = slp_schedule_task(receiver, ts->st.current, 0, NULL); ! if (result == NULL) { /* reactivate on exception */ if (receiver->flags.blocked) { *************** *** 719,724 **** return NULL; } - result = ts->st.tempval; - ts->st.tempval = NULL; } /* support for exception instances */ --- 698,701 ---- *************** *** 779,784 **** /* note that we don't set tempval since the sender does it */ ! if (slp_schedule_task(receiver, ts->st.current)) return NULL; ! if (ts->st.tempval == NULL) { /* reactivate on exception */ if (receiver->flags.blocked) { --- 756,761 ---- /* note that we don't set tempval since the sender does it */ ! result = slp_schedule_task(receiver, ts->st.current, 0, NULL); ! if (result == NULL) { /* reactivate on exception */ if (receiver->flags.blocked) { *************** *** 791,796 **** return NULL; } - result = ts->st.tempval; - ts->st.tempval = NULL; } /* support for exception instances */ --- 768,771 ---- Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** prickelpit.c 24 Mar 2004 16:27:08 -0000 1.56 --- prickelpit.c 18 Apr 2004 14:07:33 -0000 1.57 *************** *** 90,94 **** PyObject * ! slp_cannot_execute(PyFrameObject *f, char *exec_name) { /* --- 90,94 ---- PyObject * ! slp_cannot_execute(PyFrameObject *f, char *exec_name, PyObject *retval) { /* *************** *** 109,112 **** --- 109,113 ---- err_exit: tstate->frame = f->f_back; + Py_XDECREF(retval); return NULL; } Index: prickelpit.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** prickelpit.h 26 Jan 2004 12:24:03 -0000 1.7 --- prickelpit.h 18 Apr 2004 14:07:33 -0000 1.8 *************** *** 18,22 **** PyAPI_FUNC(PyObject *) slp_find_execname(PyFrameObject *f, int *valid); ! PyAPI_FUNC(PyObject *) slp_cannot_execute(PyFrameObject *f, char *exec_name); /* macros to define and use an invalid frame executor */ --- 18,22 ---- PyAPI_FUNC(PyObject *) slp_find_execname(PyFrameObject *f, int *valid); ! PyAPI_FUNC(PyObject *) slp_cannot_execute(PyFrameObject *f, char *exec_name, PyObject *retval); /* macros to define and use an invalid frame executor */ *************** *** 24,30 **** #define DEF_INVALID_EXEC(procname) \ static PyObject *\ ! cannot_##procname(PyFrameObject *f) \ { \ ! return slp_cannot_execute(f, #procname); \ } --- 24,30 ---- #define DEF_INVALID_EXEC(procname) \ static PyObject *\ ! cannot_##procname(PyFrameObject *f, PyObject *retval) \ { \ ! return slp_cannot_execute(f, #procname, retval); \ } Index: scheduling.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/scheduling.c,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** scheduling.c 7 Apr 2004 17:23:40 -0000 1.86 --- scheduling.c 18 Apr 2004 14:07:33 -0000 1.87 *************** *** 62,70 **** args = Py_BuildValue("(OO)", prev, next); if (args != NULL) { ! PyObject *type, *value, *traceback, *ret, *hold; PyThreadState *ts = PyThreadState_GET(); PyErr_Fetch(&type, &value, &traceback); - hold = ts->st.tempval; - ts->st.tempval = NULL; ret = PyObject_Call(_slp_schedule_hook, args, NULL); if (ret != NULL) --- 62,68 ---- args = Py_BuildValue("(OO)", prev, next); if (args != NULL) { ! PyObject *type, *value, *traceback, *ret; PyThreadState *ts = PyThreadState_GET(); PyErr_Fetch(&type, &value, &traceback); ret = PyObject_Call(_slp_schedule_hook, args, NULL); if (ret != NULL) *************** *** 75,79 **** Py_XDECREF(traceback); } - ts->st.tempval = hold; Py_XDECREF(ret); Py_DECREF(args); --- 73,76 ---- *************** *** 120,125 **** } ! int ! slp_schedule_task(PyTaskletObject *prev, PyTaskletObject *next) { PyThreadState *ts = PyThreadState_GET(); --- 117,124 ---- } ! static PyObject *slp_schedule_nr_maybe(PyTaskletObject *prev, PyTaskletObject *next, PyObject *retval); ! ! PyObject * ! slp_schedule_task(PyTaskletObject *prev, PyTaskletObject *next, int stackless, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); *************** *** 127,131 **** if (next == prev) ! return 0; /* since we change the stack we must assure that the protocol was met */ --- 126,138 ---- if (next == prev) ! return retval; ! ! /* stackless != 0 => try stackless. stackless < 0 => don't hard switch */ ! ! if (stackless) { ! retval = slp_schedule_nr_maybe(prev, next, retval); ! if (STACKLESS_UNWINDING(retval) || retval == NULL || stackless < 0) ! return retval; ! } /* since we change the stack we must assure that the protocol was met */ *************** *** 139,143 **** prev->flags = ts->st.flags; prev->f.frame = ts->frame; ! prev->tempval = ts->st.tempval; cstprev = &prev->cstate; } --- 146,151 ---- prev->flags = ts->st.flags; prev->f.frame = ts->frame; ! assert(prev->tempval == NULL); ! prev->tempval = retval; cstprev = &prev->cstate; } *************** *** 145,157 **** cstprev = NULL; ! /* note this should go here, since it uses tempval */ ! NOTIFY_SCHEDULE(prev, next, -1); - ts->recursion_depth = next->recursion_depth; - ts->st.flags = next->flags; - ts->frame = next->f.frame; - next->f.frame = NULL; - ts->st.tempval = next->tempval; - next->tempval = NULL; if (!next->flags.blocked) /* that must be done by the channel */ ts->st.current = next; --- 153,158 ---- cstprev = NULL; ! NOTIFY_SCHEDULE(prev, next, NULL); if (!next->flags.blocked) /* that must be done by the channel */ ts->st.current = next; *************** *** 161,174 **** ts->exc_type = NULL; } ++ts->st.nesting_level; if ((ts->exc_type != NULL ? transfer_with_exc : slp_transfer)(cstprev, next->cstate, prev) == 0) { --ts->st.nesting_level; ! return 0; } else { --ts->st.nesting_level; kill_wrap_bad_guy(prev, next); ! return -1; } } --- 162,181 ---- ts->exc_type = NULL; } + ts->recursion_depth = next->recursion_depth; + ts->st.flags = next->flags; + ts->frame = next->f.frame; + next->f.frame = NULL; ++ts->st.nesting_level; if ((ts->exc_type != NULL ? transfer_with_exc : slp_transfer)(cstprev, next->cstate, prev) == 0) { --ts->st.nesting_level; ! retval = prev->tempval; ! prev->tempval = NULL; ! return retval; } else { --ts->st.nesting_level; kill_wrap_bad_guy(prev, next); ! return NULL; } } *************** *** 186,190 **** static PyObject * ! restore_exception(PyFrameObject *f) { PyThreadState *ts = PyThreadState_GET(); --- 193,197 ---- static PyObject * ! restore_exception(PyFrameObject *f, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); *************** *** 195,202 **** ts->exc_traceback = ef->exc_traceback; ef->exc_type = ef->exc_traceback = ef->exc_value = NULL; - Py_INCREF(f); Py_DECREF((PyFrameObject *)ef); ts->frame = f; ! return Py_UnwindToken; } --- 202,208 ---- ts->exc_traceback = ef->exc_traceback; ef->exc_type = ef->exc_traceback = ef->exc_value = NULL; Py_DECREF((PyFrameObject *)ef); ts->frame = f; ! return STACKLESS_PACK(retval); } *************** *** 204,212 **** static PyObject * ! jump_soft_to_hard(PyFrameObject *f) { PyThreadState *ts = PyThreadState_GET(); ts->frame = f->f_back; Py_DECREF(f); slp_transfer(NULL, ts->st.current->cstate, NULL); /* we either have an error or don't come back, so: */ --- 210,219 ---- static PyObject * ! jump_soft_to_hard(PyFrameObject *f, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); ts->frame = f->f_back; Py_DECREF(f); + ts->st.current->tempval = retval; slp_transfer(NULL, ts->st.current->cstate, NULL); /* we either have an error or don't come back, so: */ *************** *** 214,219 **** } ! int ! slp_schedule_nr_maybe(PyTaskletObject *prev, PyTaskletObject *next) { /* --- 221,226 ---- } ! static PyObject * ! slp_schedule_nr_maybe(PyTaskletObject *prev, PyTaskletObject *next, PyObject *retval) { /* *************** *** 230,242 **** if (!slp_enable_softswitch) ! return 0; if (ts->st.nesting_level != 0) ! return 0; /* we can't handle escape from a channel with soft switching, yet */ - /* if (next->flags.blocked) { return 0; } - */ ts->st.ticker = ts->st.interval; --- 237,247 ---- if (!slp_enable_softswitch) ! return retval; if (ts->st.nesting_level != 0) ! return retval; /* we can't handle escape from a channel with soft switching, yet */ if (next->flags.blocked) { return 0; } ts->st.ticker = ts->st.interval; *************** *** 245,250 **** prev->recursion_depth = ts->recursion_depth; prev->flags = ts->st.flags; ! prev->tempval = ts->st.tempval; ! ts->st.tempval = NULL; if (prev->cstate != ts->st.initial_stub) { Py_DECREF(prev->cstate); --- 250,255 ---- prev->recursion_depth = ts->recursion_depth; prev->flags = ts->st.flags; ! assert(prev->tempval == NULL); ! prev->tempval = retval; if (prev->cstate != ts->st.initial_stub) { Py_DECREF(prev->cstate); *************** *** 262,266 **** exc_frame *f = (exc_frame *) slp_baseframe_new(restore_exception, 1, EXC_FRAME_SIZE); if (f == NULL) ! return -1; f->exc_type = ts->exc_type; f->exc_value = ts->exc_value; --- 267,271 ---- exc_frame *f = (exc_frame *) slp_baseframe_new(restore_exception, 1, EXC_FRAME_SIZE); if (f == NULL) ! return NULL; f->exc_type = ts->exc_type; f->exc_value = ts->exc_value; *************** *** 290,294 **** if (ts->frame == NULL) { ts->frame = prev->f.frame; ! return -1; } } --- 295,299 ---- if (ts->frame == NULL) { ts->frame = prev->f.frame; ! return NULL; } } *************** *** 297,308 **** ts->recursion_depth = next->recursion_depth; ! /* careful about notify, it might use retval */ ! NOTIFY_SCHEDULE(prev, next, -1); ts->st.current = next; ! ts->st.tempval = next->tempval; next->tempval = NULL; ! return 1; } --- 302,312 ---- ts->recursion_depth = next->recursion_depth; ! NOTIFY_SCHEDULE(prev, next, NULL); ts->st.current = next; ! retval = next->tempval; next->tempval = NULL; ! return STACKLESS_PACK(retval); } *************** *** 341,345 **** ! static PyObject * tasklet_end(PyFrameObject *runner); int --- 345,349 ---- ! static PyObject * tasklet_end(PyFrameObject *runner, PyObject *retval); int *************** *** 381,384 **** --- 385,390 ---- Py_DECREF(noargs); if (task == NULL) return -1; + Py_INCREF(Py_None); + task->tempval = Py_None; task->f.frame = f; task->topframe = f; *************** *** 399,407 **** static PyObject * ! tasklet_end(PyFrameObject *runner) { PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *task = ts->st.current; - PyObject *result = ts->st.tempval; int ismain = task == ts->st.main; --- 405,412 ---- static PyObject * ! tasklet_end(PyFrameObject *runner, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *task = ts->st.current; int ismain = task == ts->st.main; *************** *** 410,422 **** /* See whether we need to adjust main's context before returning */ if (ts->st.serial_last_jump != ts->st.serial) { ! /* little hack to be not a new tasklet */ ! runner->f_back = (PyFrameObject *) Py_None; slp_transfer(NULL, ts->st.current->cstate, NULL); } ! runner->f_back = NULL; } - ts->st.tempval = NULL; - /* these may need to be updated */ task->f.frame = task->topframe; --- 415,429 ---- /* See whether we need to adjust main's context before returning */ if (ts->st.serial_last_jump != ts->st.serial) { ! task->tempval = retval; slp_transfer(NULL, ts->st.current->cstate, NULL); } ! /* this hack can attach us to ourselves :( */ ! if (runner->f_back != NULL) { ! assert(runner->f_back == runner); ! Py_DECREF(runner); ! runner->f_back = NULL; ! } } /* these may need to be updated */ task->f.frame = task->topframe; *************** *** 433,442 **** /* see whether we have a TaskletExit, which is no error */ ! if (result == NULL && PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_TaskletExit)) { PyErr_Clear(); Py_INCREF(Py_None); ! result = Py_None; } --- 440,449 ---- /* see whether we have a TaskletExit, which is no error */ ! if (retval == NULL && PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_TaskletExit)) { PyErr_Clear(); Py_INCREF(Py_None); ! retval = Py_None; } *************** *** 478,482 **** * possible referers access to the return value */ ! task->tempval = result; ts->st.current = task; --- 485,489 ---- * possible referers access to the return value */ ! task->tempval = retval; ts->st.current = task; *************** *** 491,498 **** */ ts->st.main = NULL; ! result = task->tempval; ! Py_XINCREF(result); Py_DECREF(task); ! return result; } --- 498,505 ---- */ ts->st.main = NULL; ! retval = task->tempval; ! Py_XINCREF(retval); Py_DECREF(task); ! return retval; } *************** *** 505,509 **** RUNTIME_ERROR("the main tasklet is sending without a receiver available.", NULL); /* fall through to error handling */ ! result = NULL; } } --- 512,516 ---- RUNTIME_ERROR("the main tasklet is sending without a receiver available.", NULL); /* fall through to error handling */ ! retval = NULL; } } *************** *** 511,515 **** assert(ts->st.runcount > 0 || ts->st.main->flags.blocked); ! if (result == NULL) { /* * error handling: continue in the context of the main tasklet. --- 518,522 ---- assert(ts->st.runcount > 0 || ts->st.main->flags.blocked); ! if (retval == NULL) { /* * error handling: continue in the context of the main tasklet. *************** *** 521,531 **** ts->st.main->tempval = NULL; } ! switch (slp_schedule_nr_maybe(NULL, ts->st.main)) { ! case -1: ! return NULL; ! case 1: ! return Py_UnwindToken; ! } ! if (slp_schedule_task(NULL, ts->st.main)) return NULL; /* we do not come back here */ } --- 528,532 ---- ts->st.main->tempval = NULL; } ! return slp_schedule_task(NULL, ts->st.main, 1, NULL); /* we do not come back here */ } *************** *** 534,552 **** assert(ts->st.current->f.frame->ob_refcnt > 0); ! switch (slp_schedule_nr_maybe(NULL, ts->st.current)) { ! case -1: ! return NULL; ! case 1: ! return Py_UnwindToken; ! } ! if (slp_schedule_task(NULL, ts->st.current)) return NULL; ! ! result = ts->st.tempval; ! ts->st.tempval = NULL; ! return result; } /* ! the following function only has to handle "real" tasklets, those which need to switch the C stack. The "soft" tasklets are handled by frame pushing. --- 535,543 ---- assert(ts->st.current->f.frame->ob_refcnt > 0); ! return slp_schedule_task(NULL, ts->st.current, 1, retval); } /* ! the following functions only have to handle "real" tasklets, those which need to switch the C stack. The "soft" tasklets are handled by frame pushing. *************** *** 555,558 **** --- 546,558 ---- PyObject * + slp_resume_tasklet(PyFrameObject *f) + { + PyThreadState *ts = PyThreadState_GET(); + PyObject *retval = ts->st.current->tempval; + ts->st.current->tempval = NULL; + return slp_frame_dispatch_top(f, retval); + } + + PyObject * slp_run_tasklet(PyFrameObject *f) { *************** *** 564,572 **** } - assert(f->f_back == NULL); runner = ts->st.tasklet_runner; ! f->f_back = runner; ! Py_INCREF(runner); ! return slp_frame_dispatch_top(f); } #endif --- 564,574 ---- } runner = ts->st.tasklet_runner; ! assert(f->f_back == NULL ||f->f_back == runner); ! if (f->f_back == NULL) { ! f->f_back = runner; ! Py_INCREF(runner); ! } ! return slp_resume_tasklet(f); } #endif Index: stackless_frame.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_frame.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** stackless_frame.h 17 Mar 2004 20:58:15 -0000 1.41 --- stackless_frame.h 18 Apr 2004 14:07:33 -0000 1.42 *************** *** 12,16 **** /* support for soft stackless */ ! typedef PyObject *(PyFrame_ExecFunc) (struct _frame *); #endif --- 12,16 ---- /* support for soft stackless */ ! typedef PyObject *(PyFrame_ExecFunc) (struct _frame *, PyObject *); #endif Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** stackless_impl.h 5 Apr 2004 19:09:18 -0000 1.77 --- stackless_impl.h 18 Apr 2004 14:07:33 -0000 1.78 *************** *** 61,80 **** /* the frame dispatcher */ ! PyAPI_FUNC(PyObject *) slp_frame_dispatch(PyFrameObject *f, PyFrameObject *stopframe); /* the frame dispatcher for toplevel tasklets */ ! PyAPI_FUNC(PyObject *) slp_frame_dispatch_top(PyFrameObject *f); /* the now exported eval_frame */ ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *f); /* the new eval_frame loop with or without value or resuming an iterator */ ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_value(struct _frame *f); ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_noval(struct _frame *f); ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_iter(struct _frame *f); /* rebirth of software stack avoidance */ ! PyAPI_DATA(PyObject *) Py_UnwindToken; /* frame cloning both needed in tasklets and generators */ --- 61,85 ---- /* the frame dispatcher */ ! PyAPI_FUNC(PyObject *) slp_frame_dispatch(PyFrameObject *f, PyFrameObject *stopframe, PyObject *retval); /* the frame dispatcher for toplevel tasklets */ ! PyAPI_FUNC(PyObject *) slp_frame_dispatch_top(PyFrameObject *f, PyObject *retval); /* the now exported eval_frame */ ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *f, PyObject *retval); /* the new eval_frame loop with or without value or resuming an iterator */ ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_value(struct _frame *f, PyObject *retval); ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_noval(struct _frame *f, PyObject *retval); ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame_iter(struct _frame *f, PyObject *retval); /* rebirth of software stack avoidance */ ! typedef struct { ! PyObject_HEAD ! PyObject *tempval; ! } PyUnwindObject; ! ! PyAPI_DATA(PyUnwindObject *) Py_UnwindToken; /* frame cloning both needed in tasklets and generators */ *************** *** 88,91 **** --- 93,117 ---- PyAPI_FUNC(PyObject *) PyGenerator_New(struct _frame *f); + /* fast (release) and safe (debug) access to the unwind token and retval */ + + #define STACKLESS_PACK(retval) \ + (assert(Py_UnwindToken->tempval == NULL), \ + Py_UnwindToken->tempval = (retval), \ + (PyObject *) Py_UnwindToken) + + #ifdef Py_DEBUG + + #define STACKLESS_UNPACK(retval) \ + (assert(STACKLESS_UNWINDING(retval)), \ + retval = Py_UnwindToken->tempval, \ + Py_UnwindToken->tempval = NULL, retval) + #else + #define STACKLESS_UNPACK(token, retval) \ + (retval = (token)->tempval, retval) + #endif + + #define STACKLESS_UNWINDING(obj) \ + ((PyObject *) (obj) == (PyObject *) Py_UnwindToken) + /* macros for setting/resetting the stackless flag */ *************** *** 240,247 **** PyAPI_FUNC(PyObject *) slp_tasklet_new(PyTypeObject *type, PyObject *args, PyObject *kwds); ! PyAPI_FUNC(int) slp_schedule_task(PyTaskletObject *prev, PyTaskletObject *next); ! PyAPI_FUNC(int) slp_schedule_nr_maybe(PyTaskletObject *prev, PyTaskletObject *next); PyObject * slp_run_tasklet(PyFrameObject *f); int initialize_main_and_current(PyFrameObject *f); --- 266,273 ---- PyAPI_FUNC(PyObject *) slp_tasklet_new(PyTypeObject *type, PyObject *args, PyObject *kwds); ! PyAPI_FUNC(PyObject *) slp_schedule_task(PyTaskletObject *prev, PyTaskletObject *next, int stackless, PyObject *retval); PyObject * slp_run_tasklet(PyFrameObject *f); + PyObject * slp_resume_tasklet(PyFrameObject *f); int initialize_main_and_current(PyFrameObject *f); Index: stackless_tstate.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_tstate.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** stackless_tstate.h 29 Mar 2004 00:04:45 -0000 1.47 --- stackless_tstate.h 18 Apr 2004 14:07:33 -0000 1.48 *************** *** 37,42 **** int interval; PyObject * (*interrupt) (void); /* the fast scheduler */ - /* passing return values in soft switching mode */ - PyObject * tempval; /* trap recursive scheduling via callbacks */ int schedlock; --- 37,40 ---- *************** *** 61,65 **** tstate->st.interval = 0; \ tstate->st.interrupt = NULL; \ - tstate->st.tempval = NULL;\ tstate->st.schedlock = 0; \ tstate->st.main = NULL; \ --- 59,62 ---- Index: stackless_util.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_util.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** stackless_util.c 29 Mar 2004 00:13:43 -0000 1.15 --- stackless_util.c 18 Apr 2004 14:07:33 -0000 1.16 *************** *** 79,84 **** if (retval == NULL) return -1; ! if (retval == Py_UnwindToken) return 1; Py_DECREF(retval); return 0; --- 79,87 ---- if (retval == NULL) return -1; ! if (STACKLESS_UNWINDING(retval)) { ! STACKLESS_UNPACK(retval); ! Py_XDECREF(retval); return 1; + } Py_DECREF(retval); return 0; Index: stacklesseval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklesseval.c,v retrieving revision 1.138 retrieving revision 1.139 diff -C2 -d -r1.138 -r1.139 *** stacklesseval.c 7 Apr 2004 17:23:40 -0000 1.138 --- stacklesseval.c 18 Apr 2004 14:07:33 -0000 1.139 *************** *** 271,275 **** PyFrameObject *fprev = f->f_back; int * stackref; - PyObject *result; if (fprev == NULL && ts->st.main == NULL) { --- 271,274 ---- *************** *** 298,309 **** if (f == NULL) return NULL; ! if (f->f_back == NULL) { /* this is really a new tasklet or main */ ! result = slp_run_tasklet(f); ! return result; } ! return slp_frame_dispatch_top(f); } ! return slp_frame_dispatch(f, fprev); } --- 297,309 ---- if (f == NULL) return NULL; ! if (f->f_back == NULL || f->f_back == ts->st.tasklet_runner) { /* this is really a new tasklet or main */ ! /* I hope very much to get rid of this hack, soon */ ! return slp_run_tasklet(f); } ! return slp_resume_tasklet(f); } ! Py_INCREF(Py_None); ! return slp_frame_dispatch(f, fprev, Py_None); } *************** *** 380,384 **** #define GEN_CALLBACK_FRAME_SIZE ((sizeof(gen_callback_frame)-sizeof(PyBaseFrameObject))/sizeof(PyObject*)) ! static PyObject* gen_iternext_callback(PyFrameObject *f); DEF_INVALID_EXEC(gen_iternext_callback) --- 380,384 ---- #define GEN_CALLBACK_FRAME_SIZE ((sizeof(gen_callback_frame)-sizeof(PyBaseFrameObject))/sizeof(PyObject*)) ! static PyObject* gen_iternext_callback(PyFrameObject *f, PyObject *retval); DEF_INVALID_EXEC(gen_iternext_callback) *************** *** 440,443 **** --- 440,444 ---- PyFrameObject *f = gen->gi_frame; PyFrameObject *stopframe = ts->frame; + PyObject *retval; if (gen->gi_running) { *************** *** 459,463 **** Py_INCREF(Py_None); ! ts->st.tempval = Py_None; f->f_execute = PyEval_EvalFrame; Py_INCREF(gen); --- 460,464 ---- Py_INCREF(Py_None); ! retval = Py_None; f->f_execute = PyEval_EvalFrame; Py_INCREF(gen); *************** *** 466,481 **** ts->frame = f; if (stackless) ! return Py_UnwindToken; ! return slp_frame_dispatch(f, stopframe); } static PyObject* ! gen_iternext_callback(PyFrameObject *f) { PyThreadState *ts = PyThreadState_GET(); gen_callback_frame *gcf = (gen_callback_frame*) f; genobject *gen = gcf->gen; - PyObject *result = ts->st.tempval; - ts->st.tempval = NULL; gen->gi_running = 0; --- 467,480 ---- ts->frame = f; if (stackless) ! return STACKLESS_PACK(retval); ! return slp_frame_dispatch(f, stopframe, retval); } static PyObject* ! gen_iternext_callback(PyFrameObject *f, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); gen_callback_frame *gcf = (gen_callback_frame*) f; genobject *gen = gcf->gen; gen->gi_running = 0; *************** *** 490,496 **** /* If the generator just returned (as opposed to yielding), signal * that the generator is exhausted. */ ! if (result == Py_None && f->f_stacktop == NULL) { ! Py_DECREF(result); ! result = NULL; /* are we awaited by a for_iter or called by next() ? */ if (ts->frame->f_execute != PyEval_EvalFrame_iter) { --- 489,495 ---- /* If the generator just returned (as opposed to yielding), signal * that the generator is exhausted. */ ! if (retval == Py_None && f->f_stacktop == NULL) { ! Py_DECREF(retval); ! retval = NULL; /* are we awaited by a for_iter or called by next() ? */ if (ts->frame->f_execute != PyEval_EvalFrame_iter) { *************** *** 502,506 **** gcf->gen = NULL; Py_DECREF(gen); ! return result; } --- 501,505 ---- gcf->gen = NULL; Py_DECREF(gen); ! return retval; } *************** *** 667,671 **** }; ! PyObject *Py_UnwindToken = (PyObject *) &PyUnwindToken_Type; /* --- 666,675 ---- }; ! static PyUnwindObject unwind_token = { ! PyObject_HEAD_INIT(&PyUnwindToken_Type) ! NULL ! }; ! ! PyUnwindObject *Py_UnwindToken = &unwind_token; /* *************** *** 676,682 **** PyObject * ! slp_frame_dispatch(PyFrameObject *f, PyFrameObject *stopframe) { - PyObject * result; PyThreadState *ts = PyThreadState_GET(); --- 680,685 ---- PyObject * ! slp_frame_dispatch(PyFrameObject *f, PyFrameObject *stopframe, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); *************** *** 688,692 **** indicates that a different frame will be run. Semantics of an appearing Py_UnwindToken: ! The true return value is in the f_retval field. We always use the topmost tstate frame and bail out when we see the frame that issued the --- 691,695 ---- indicates that a different frame will be run. Semantics of an appearing Py_UnwindToken: ! The true return value is in its tempval field. We always use the topmost tstate frame and bail out when we see the frame that issued the *************** *** 696,706 **** while (1) { ! result = f->f_execute(f); f = ts->frame; if (f == stopframe) break; - else if (result != Py_UnwindToken) { - ts->st.tempval = result; - } } --ts->st.nesting_level; --- 699,708 ---- while (1) { ! retval = f->f_execute(f, retval); f = ts->frame; + if (STACKLESS_UNWINDING(retval)) + STACKLESS_UNPACK(retval); if (f == stopframe) break; } --ts->st.nesting_level; *************** *** 708,724 **** if (ts->st.flags.pending_irq) slp_check_pending_irq(); ! if (result == Py_UnwindToken) { ! /* XXX this is a temporary bug fix. ! The protocol should again be explicit about the result value. */ ! result = ts->st.tempval; ! ts->st.tempval = NULL; ! } ! return result; } PyObject * ! slp_frame_dispatch_top(PyFrameObject *f) { - PyObject *result; PyThreadState *ts = PyThreadState_GET(); --- 710,719 ---- if (ts->st.flags.pending_irq) slp_check_pending_irq(); ! return retval; } PyObject * ! slp_frame_dispatch_top(PyFrameObject *f, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); *************** *** 727,745 **** while (1) { ! result = f->f_execute(f); f = ts->frame; if (f == NULL) break; - else if (result != Py_UnwindToken) { - ts->st.tempval = result; - } } ! if (result == Py_UnwindToken) { ! /* XXX this is a temporary bug fix. ! The protocol should again be explicit about the result value. */ ! result = ts->st.tempval; ! ts->st.tempval = NULL; ! } ! return result; } --- 722,733 ---- while (1) { ! retval = f->f_execute(f, retval); f = ts->frame; + if (STACKLESS_UNWINDING(retval)) + STACKLESS_UNPACK(retval); if (f == NULL) break; } ! return retval; } Index: stacklesseval.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklesseval.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** stacklesseval.h 25 Mar 2004 22:59:07 -0000 1.10 --- stacklesseval.h 18 Apr 2004 14:07:33 -0000 1.11 *************** *** 5,11 **** #include "frameobject.h" - /*** additional exports to ceval.h ***/ - - PyAPI_DATA(PyObject *) Py_UnwindToken; - #endif --- 5,7 ---- Index: stacklessmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklessmodule.c,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** stacklessmodule.c 2 Apr 2004 23:47:25 -0000 1.160 --- stacklessmodule.c 18 Apr 2004 14:07:33 -0000 1.161 *************** *** 57,77 **** if (remove && do_remove_current()) return NULL; - ts->st.tempval = retval; Py_INCREF(retval); ! ! if (stackless) { ! switch (slp_schedule_nr_maybe(prev, next)) { ! case -1: ! return NULL; ! case 1: ! return Py_UnwindToken; ! } ! } ! ! if (slp_schedule_task(prev, next)) return NULL; ! if (ts->st.tempval == NULL) return NULL; ! retval = ts->st.tempval; ! ts->st.tempval = NULL; ! return retval; } --- 57,62 ---- if (remove && do_remove_current()) return NULL; Py_INCREF(retval); ! return slp_schedule_task(prev, next, stackless, retval); } *************** *** 93,97 **** return NULL; } ! STACKLESS_PROPOSE_ALL(); return PyStackless_Schedule(retval, remove); } --- 78,82 ---- return NULL; } ! STACKLESS_PROMOTE_ALL(); return PyStackless_Schedule(retval, remove); } *************** *** 211,234 **** Py_INCREF(ts->st.main); slp_current_insert(ts->st.main); ! ts->st.tempval = Py_None; ! Py_INCREF(Py_None); ! ! /* Try soft first */ ! switch (slp_schedule_nr_maybe(ts->st.current, ts->st.main)) { ! case -1: ! return NULL; ! ! case 1: ! return Py_UnwindToken; ! } ! ! if (slp_schedule_task(ts->st.current, ts->st.main)) return NULL; ! ! if (PyErr_Occurred()) return NULL; ! if (ts->st.tempval == NULL) return NULL; ! retval = ts->st.tempval; ! ts->st.tempval = NULL; ! return retval; } --- 196,203 ---- Py_INCREF(ts->st.main); slp_current_insert(ts->st.main); ! retval = Py_None; ! Py_INCREF(retval); ! return slp_schedule_task(ts->st.current, ts->st.main, 1, retval); } *************** *** 244,248 **** PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *victim; ! PyObject *ret; int err; if (ts->st.main == NULL) return PyStackless_RunWatchdog_M(timeout); --- 213,217 ---- PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *victim; ! PyObject *retval; int err; if (ts->st.main == NULL) return PyStackless_RunWatchdog_M(timeout); *************** *** 250,255 **** return RUNTIME_ERROR("run_watchdog must be run from the main tasklet.", NULL); - ts->st.tempval = Py_None; Py_INCREF(Py_None); if (ts->st.runcount > 1) { --- 219,224 ---- return RUNTIME_ERROR("run_watchdog must be run from the main tasklet.", NULL); Py_INCREF(Py_None); + retval = Py_None; if (ts->st.runcount > 1) { *************** *** 268,276 **** /* now let them run until the end. */ ! if (slp_schedule_task(ts->st.main, ts->st.current)) return NULL; ts->st.interrupt = NULL; ! err = ts->st.tempval == NULL; if (err) /* an exception has occoured */ --- 237,245 ---- /* now let them run until the end. */ ! retval = slp_schedule_task(ts->st.main, ts->st.current, 0, retval); ts->st.interrupt = NULL; ! err = retval == NULL; if (err) /* an exception has occoured */ *************** *** 283,294 **** victim = slp_current_remove(); ts->st.current = (PyTaskletObject*)ts->st.main; ! Py_DECREF(ts->st.tempval); ! ts->st.tempval = NULL; return (PyObject*) victim; } } ! ret = ts->st.tempval; ! ts->st.tempval = NULL; ! return ret; } --- 252,260 ---- victim = slp_current_remove(); ts->st.current = (PyTaskletObject*)ts->st.main; ! Py_DECREF(retval); return (PyObject*) victim; } } ! return retval; } *************** *** 407,435 **** static PyObject * ! test_cframe_nr_loop(PyFrameObject *f) { looping_frame *b = (looping_frame *) f; PyThreadState *ts = PyThreadState_GET(); ! PyObject *result = ts->st.tempval; ! ts->st.tempval = NULL; ! if (result == NULL) goto exit_test_cframe_nr_loop; while (b->count->ob_ival-- > 0) { ! Py_DECREF(result); ! result = PyStackless_Schedule_nr(Py_None, 0); ! if (result == NULL) { ts->frame = f->f_back; return NULL; } ! if (result == Py_UnwindToken) { ! return Py_UnwindToken; } /* was a hard switch */ - assert(ts->st.tempval == NULL); } exit_test_cframe_nr_loop: ts->frame = b->bf.f_back; Py_DECREF(f); ! return result; } --- 373,399 ---- static PyObject * ! test_cframe_nr_loop(PyFrameObject *f, PyObject *retval) { looping_frame *b = (looping_frame *) f; PyThreadState *ts = PyThreadState_GET(); ! ! if (retval == NULL) goto exit_test_cframe_nr_loop; while (b->count->ob_ival-- > 0) { ! Py_DECREF(retval); ! retval = PyStackless_Schedule_nr(Py_None, 0); ! if (retval == NULL) { ts->frame = f->f_back; return NULL; } ! if (STACKLESS_UNWINDING(retval)) { ! return retval; } /* was a hard switch */ } exit_test_cframe_nr_loop: ts->frame = b->bf.f_back; Py_DECREF(f); ! return retval; } *************** *** 453,461 **** assert(count->ob_refcnt == 1); count->ob_ival = switches; - Py_INCREF(Py_None); - ts->st.tempval = Py_None; b->count = count; ts->frame = (PyFrameObject *) b; ! return Py_UnwindToken; } --- 417,424 ---- assert(count->ob_refcnt == 1); count->ob_ival = switches; b->count = count; ts->frame = (PyFrameObject *) b; ! Py_INCREF(Py_None); ! return STACKLESS_PACK(Py_None); } *************** *** 472,476 **** PyThreadState *ts = PyThreadState_GET(); PyCFrameObject *c; ! PyObject *ret; if (ts->st.main != NULL) return RUNTIME_ERROR("Call_Main cannot run within a main tasklet", NULL); --- 435,439 ---- PyThreadState *ts = PyThreadState_GET(); PyCFrameObject *c; ! PyObject *retval; if (ts->st.main != NULL) return RUNTIME_ERROR("Call_Main cannot run within a main tasklet", NULL); *************** *** 478,488 **** if (c == NULL) return NULL; - Py_INCREF(Py_None); - ts->st.tempval = Py_None; /* frames eat their own reference when returning */ Py_INCREF((PyObject *)c); ! ret = slp_eval_frame((PyFrameObject*)c); Py_DECREF((PyObject *)c); ! return ret; } --- 441,449 ---- if (c == NULL) return NULL; /* frames eat their own reference when returning */ Py_INCREF((PyObject *)c); ! retval = slp_eval_frame((PyFrameObject*)c); Py_DECREF((PyObject *)c); ! return retval; } Index: taskletobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/taskletobject.c,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** taskletobject.c 7 Apr 2004 19:33:31 -0000 1.105 --- taskletobject.c 18 Apr 2004 14:07:33 -0000 1.106 *************** *** 77,81 **** */ while (self->next != NULL) ! slp_schedule_task(ts->st.current, self); /* now we are sure that self has left the runnables */ } --- 77,81 ---- */ while (self->next != NULL) ! slp_schedule_task(ts->st.current, self, 0, NULL); /* now we are sure that self has left the runnables */ } *************** *** 530,553 **** STACKLESS_GETARG(); PyThreadState *ts = PyThreadState_GET(); ! PyObject *ret; assert(PyTasklet_Check(task)); if (ts->st.main == NULL) return PyTasklet_Run_M(task); if (PyTasklet_Insert(task)) return NULL; ! Py_INCREF(task); ! ts->st.tempval = (PyObject *) task; ! if (stackless) { ! switch (slp_schedule_nr_maybe(ts->st.current, task)) { ! case -1: ! return NULL; ! case 1: ! return Py_UnwindToken; ! } ! } ! if (slp_schedule_task(ts->st.current, task)) return NULL; ! if (ts->st.tempval == NULL) return NULL; ! ret = ts->st.tempval; ! ts->st.tempval = NULL; ! return ret; } --- 530,540 ---- STACKLESS_GETARG(); PyThreadState *ts = PyThreadState_GET(); ! PyObject *retval = (PyObject *) task; assert(PyTasklet_Check(task)); if (ts->st.main == NULL) return PyTasklet_Run_M(task); if (PyTasklet_Insert(task)) return NULL; ! Py_INCREF(retval); ! return slp_schedule_task(ts->st.current, task, stackless, retval); } *************** *** 667,672 **** task->topframe = frame; Py_XDECREF(task->tempval); - task->tempval = Py_None; Py_INCREF(Py_None); if (task->cstate != ts->st.initial_stub) { PyCStackObject *hold = task->cstate; --- 654,659 ---- task->topframe = frame; Py_XDECREF(task->tempval); Py_INCREF(Py_None); + task->tempval = Py_None; if (task->cstate != ts->st.initial_stub) { PyCStackObject *hold = task->cstate; *************** *** 716,722 **** task->tempval = (PyObject *) task; Py_INCREF(task); /* returned to caller */ - ts->st.tempval = retval; Py_INCREF(retval); /* returned to caller's caller */ ! return Py_UnwindToken; } --- 703,708 ---- task->tempval = (PyObject *) task; Py_INCREF(task); /* returned to caller */ Py_INCREF(retval); /* returned to caller's caller */ ! return STACKLESS_PACK(retval); } *************** *** 743,751 **** static PyObject * ! post_schedule_remove(PyFrameObject *f) { PyThreadState *ts = PyThreadState_GET(); - PyObject *retval = (PyObject *) ts->st.current; - ts->st.tempval = NULL; ts->frame = f->f_back; return PyStackless_Schedule_nr(retval, 1); --- 729,735 ---- static PyObject * ! post_schedule_remove(PyFrameObject *f, PyObject *retval) { PyThreadState *ts = PyThreadState_GET(); ts->frame = f->f_back; return PyStackless_Schedule_nr(retval, 1); *************** *** 756,762 **** PyThreadState *ts = PyThreadState_GET(); PyFrameObject *save; ! if (impl_tasklet_become(task, retval) != Py_UnwindToken) return NULL; - Py_DECREF(retval); save = ts->frame; /* create a helper frame to perform the schedule_remove after return */ --- 740,746 ---- PyThreadState *ts = PyThreadState_GET(); PyFrameObject *save; ! retval = impl_tasklet_become(task, retval); ! if (!STACKLESS_UNWINDING(retval)) return NULL; save = ts->frame; /* create a helper frame to perform the schedule_remove after return */ *************** *** 766,771 **** return NULL; } ! /* the retval is still in ts->st.tempval, so we're ready */ ! return Py_UnwindToken; } --- 750,754 ---- return NULL; } ! return retval; } *************** *** 876,880 **** PyThreadState *ts = PyThreadState_GET(); PyObject *tb = NULL; ! PyObject *ret; if (ts->st.main == NULL) return PyTasklet_RaiseException_M(self, klass, args); if (! (PyObject_IsSubclass(klass, PyExc_Exception) == 1 || PyString_Check(klass) ) ) --- 859,863 ---- PyThreadState *ts = PyThreadState_GET(); PyObject *tb = NULL; ! PyObject *retval; if (ts->st.main == NULL) return PyTasklet_RaiseException_M(self, klass, args); if (! (PyObject_IsSubclass(klass, PyExc_Exception) == 1 || PyString_Check(klass) ) ) *************** *** 912,931 **** } Py_INCREF(Py_None); ! ts->st.tempval = Py_None; ! ! if (stackless) { ! switch (slp_schedule_nr_maybe(ts->st.current, self)) { ! case -1: ! return NULL; ! case 1: ! return Py_UnwindToken; ! } ! } ! ! if (slp_schedule_task(ts->st.current, self)) return NULL; ! if (ts->st.tempval == NULL) return NULL; ! ret = ts->st.tempval; ! ts->st.tempval = NULL; ! return ret; } --- 895,901 ---- } Py_INCREF(Py_None); ! retval = Py_None; ! ! return slp_schedule_task(ts->st.current, self, stackless, retval); } _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From lutz at centera.de Mon Apr 5 16:47:16 2004 From: lutz at centera.de (=?iso-8859-1?Q?Lutz_P=E4like?=) Date: Mon, 05 Apr 2004 16:47:16 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Objects abstract.c, 1.8, 1.9 classobject.c, 1.12, 1.13 descrobject.c, 1.7, 1.8 funcobject.c, 1.6, 1.7 methodobject.c, 1.6, 1.7 typeobject.c, 1.10, 1.11 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Objects In directory centera.de:/tmp/cvs-serv11270/src/2.3/dev/Objects Modified Files: abstract.c classobject.c descrobject.c funcobject.c methodobject.c typeobject.c Log Message: Added some missing #ifdef STACKLESS definitions to make compilation as standard python possible again. Index: abstract.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/abstract.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** abstract.c 27 Mar 2004 01:11:59 -0000 1.8 --- abstract.c 5 Apr 2004 14:47:13 -0000 1.9 *************** *** 1751,1759 **** --- 1751,1765 ---- PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif ternaryfunc call; if ((call = func->ob_type->tp_call) != NULL) { + #ifdef STACKLESS PyObject *result = (STACKLESS_PROMOTE(func), (*call)(func, arg, kw)); + #else + PyObject *result = (*call)(func, arg, kw); + #endif if (result == NULL && !PyErr_Occurred()) PyErr_SetString( *************** *** 1770,1774 **** --- 1776,1782 ---- PyObject_CallFunction(PyObject *callable, char *format, ...) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif va_list va; PyObject *args, *retval; *************** *** 1798,1805 **** args = a; } STACKLESS_PROMOTE_ALL(); retval = PyObject_Call(callable, args, NULL); STACKLESS_ASSERT(); ! Py_DECREF(args); --- 1806,1816 ---- args = a; } + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif retval = PyObject_Call(callable, args, NULL); + #ifdef STACKLESS STACKLESS_ASSERT(); ! #endif Py_DECREF(args); *************** *** 1810,1814 **** --- 1821,1827 ---- PyObject_CallMethod(PyObject *o, char *name, char *format, ...) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif va_list va; PyObject *args, *func = 0, *retval; *************** *** 1847,1855 **** args = a; } ! STACKLESS_PROMOTE_ALL(); retval = PyObject_Call(func, args, NULL); STACKLESS_ASSERT(); ! Py_DECREF(args); Py_DECREF(func); --- 1860,1870 ---- args = a; } ! #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif retval = PyObject_Call(func, args, NULL); + #ifdef STACKLESS STACKLESS_ASSERT(); ! #endif Py_DECREF(args); Py_DECREF(func); *************** *** 1892,1896 **** --- 1907,1913 ---- PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif PyObject *args, *tmp; va_list vargs; *************** *** 1911,1917 **** --- 1928,1938 ---- return NULL; } + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif tmp = PyObject_Call(callable, args, NULL); + #ifdef STACKLESS STACKLESS_ASSERT(); + #endif Py_DECREF(args); Py_DECREF(callable); *************** *** 1923,1927 **** --- 1944,1950 ---- PyObject_CallFunctionObjArgs(PyObject *callable, ...) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif PyObject *args, *tmp; va_list vargs; *************** *** 1936,1942 **** --- 1959,1969 ---- if (args == NULL) return NULL; + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif tmp = PyObject_Call(callable, args, NULL); + #ifdef STACKLESS STACKLESS_ASSERT(); + #endif Py_DECREF(args); *************** *** 2196,2208 **** PyIter_Next(PyObject *iter) { STACKLESS_GETARG(); PyObject *result; assert(PyIter_Check(iter)); #ifdef STACKLESS /* we use the same flag here, since iterators are not callable */ ! #endif STACKLESS_PROMOTE(iter); result = (*iter->ob_type->tp_iternext)(iter); STACKLESS_ASSERT(); if (result == NULL && PyErr_Occurred() && --- 2223,2240 ---- PyIter_Next(PyObject *iter) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif PyObject *result; assert(PyIter_Check(iter)); #ifdef STACKLESS /* we use the same flag here, since iterators are not callable */ ! STACKLESS_PROMOTE(iter); + #endif result = (*iter->ob_type->tp_iternext)(iter); + #ifdef STACKLESS STACKLESS_ASSERT(); + #endif if (result == NULL && PyErr_Occurred() && Index: classobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/classobject.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** classobject.c 27 Mar 2004 01:11:59 -0000 1.12 --- classobject.c 5 Apr 2004 14:47:13 -0000 1.13 *************** *** 2407,2411 **** --- 2407,2413 ---- instancemethod_call(PyObject *func, PyObject *arg, PyObject *kw) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif PyObject *self = PyMethod_GET_SELF(func); PyObject *class = PyMethod_GET_CLASS(func); Index: descrobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/descrobject.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** descrobject.c 27 Mar 2004 01:11:59 -0000 1.7 --- descrobject.c 5 Apr 2004 14:47:13 -0000 1.8 *************** *** 211,215 **** --- 211,217 ---- methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwds) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif int argc; PyObject *self, *func, *result; *************** *** 258,262 **** --- 260,266 ---- PyObject *kwds) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif PyObject *func, *result; *************** *** 265,271 **** --- 269,279 ---- return NULL; + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif result = PyEval_CallObjectWithKeywords(func, args, kwds); + #ifdef STACKLESS STACKLESS_ASSERT(); + #endif Py_DECREF(func); return result; *************** *** 275,279 **** --- 283,289 ---- wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif int argc; PyObject *self, *func, *result; *************** *** 310,316 **** --- 320,330 ---- return NULL; } + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif result = PyEval_CallObjectWithKeywords(func, args, kwds); + #ifdef STACKLESS STACKLESS_ASSERT(); + #endif Py_DECREF(args); Py_DECREF(func); *************** *** 985,989 **** --- 999,1005 ---- wrapper_call(wrapperobject *wp, PyObject *args, PyObject *kwds) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif wrapperfunc wrapper = wp->descr->d_base->wrapper; PyObject *self = wp->self; Index: funcobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/funcobject.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** funcobject.c 27 Mar 2004 01:11:59 -0000 1.6 --- funcobject.c 5 Apr 2004 14:47:13 -0000 1.7 *************** *** 469,473 **** --- 469,475 ---- function_call(PyObject *func, PyObject *arg, PyObject *kw) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif PyObject *result; PyObject *argdefs; *************** *** 503,508 **** nk = 0; } ! STACKLESS_PROMOTE_ALL(); result = PyEval_EvalCodeEx( (PyCodeObject *)PyFunction_GET_CODE(func), --- 505,511 ---- nk = 0; } ! #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif result = PyEval_EvalCodeEx( (PyCodeObject *)PyFunction_GET_CODE(func), *************** *** 511,516 **** k, nk, d, nd, PyFunction_GET_CLOSURE(func)); - STACKLESS_ASSERT(); if (k != NULL) PyMem_DEL(k); --- 514,521 ---- k, nk, d, nd, PyFunction_GET_CLOSURE(func)); + #ifdef STACKLESS + STACKLESS_ASSERT(); + #endif if (k != NULL) PyMem_DEL(k); Index: methodobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/methodobject.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** methodobject.c 27 Mar 2004 01:11:59 -0000 1.6 --- methodobject.c 5 Apr 2004 14:47:13 -0000 1.7 *************** *** 76,80 **** --- 76,82 ---- PyCFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = PyCFunction_GET_FUNCTION(func); Index: typeobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/typeobject.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** typeobject.c 27 Mar 2004 01:11:59 -0000 1.10 --- typeobject.c 5 Apr 2004 14:47:13 -0000 1.11 *************** *** 895,899 **** --- 895,901 ---- call_method(PyObject *o, char *name, PyObject **nameobj, char *format, ...) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif va_list va; PyObject *args, *func = 0, *retval; *************** *** 919,926 **** assert(PyTuple_Check(args)); STACKLESS_PROMOTE_ALL(); retval = PyObject_Call(func, args, NULL); STACKLESS_ASSERT(); ! Py_DECREF(args); Py_DECREF(func); --- 921,931 ---- assert(PyTuple_Check(args)); + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif retval = PyObject_Call(func, args, NULL); + #ifdef STACKLESS STACKLESS_ASSERT(); ! #endif Py_DECREF(args); Py_DECREF(func); *************** *** 934,938 **** --- 939,945 ---- call_maybe(PyObject *o, char *name, PyObject **nameobj, char *format, ...) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif va_list va; PyObject *args, *func = 0, *retval; *************** *** 960,967 **** assert(PyTuple_Check(args)); STACKLESS_PROMOTE_ALL(); retval = PyObject_Call(func, args, NULL); STACKLESS_ASSERT(); ! Py_DECREF(args); Py_DECREF(func); --- 967,977 ---- assert(PyTuple_Check(args)); + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif retval = PyObject_Call(func, args, NULL); + #ifdef STACKLESS STACKLESS_ASSERT(); ! #endif Py_DECREF(args); Py_DECREF(func); _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 19 21:46:23 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 19 Apr 2004 21:46:23 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python pythonrun.c, 1.16, 1.17 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv24147/dev/Python Modified Files: pythonrun.c Log Message: moved the patched types for pickling into builtins. This should generate less incompatibilites. I tried to use copy_reg, but this still requires some location for the global types, and still would mean to change the type names. I had a problem with initialisation order. Index: pythonrun.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/pythonrun.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pythonrun.c 19 Apr 2004 19:15:18 -0000 1.16 --- pythonrun.c 19 Apr 2004 19:46:21 -0000 1.17 *************** *** 201,207 **** Py_INCREF(interp->builtins); - #ifdef STACKLESS - _PyStackless_Init(); - #endif sysmod = _PySys_Init(); if (sysmod == NULL) --- 201,204 ---- *************** *** 215,218 **** --- 212,218 ---- _PyImport_Init(); + #ifdef STACKLESS + _PyStackless_Init(); + #endif /* initialize builtin exceptions */ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 05:09:04 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 05:09:04 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_version.h, 1.42, 1.43 stacklesseval.c, 1.141, 1.142 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv16972/Stackless Modified Files: stackless_version.h stacklesseval.c Log Message: voidened a value to suppress a warning. made a new version. Index: stackless_version.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_version.h,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** stackless_version.h 7 Apr 2004 17:32:19 -0000 1.42 --- stackless_version.h 25 Apr 2004 03:09:02 -0000 1.43 *************** *** 1,7 **** /* * Stackless Python version string ! * created at Wed Apr 07 19:24:13 2004 by mkversion.py */ /* keep this entry up-to-date */ ! #define STACKLESS_VERSION "3.0 040407" --- 1,7 ---- /* * Stackless Python version string ! * created at Sun Apr 25 05:06:12 2004 by mkversion.py */ /* keep this entry up-to-date */ ! #define STACKLESS_VERSION "3.0 040425" Index: stacklesseval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklesseval.c,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** stacklesseval.c 24 Apr 2004 23:29:39 -0000 1.141 --- stacklesseval.c 25 Apr 2004 03:09:02 -0000 1.142 *************** *** 118,122 **** if (*cst == NULL) return NULL; } ! PyObject_INIT_VAR(*cst, &PyCStack_Type, size); (*cst)->startaddr = stackbase; --- 118,122 ---- if (*cst == NULL) return NULL; } ! (void) PyObject_INIT_VAR(*cst, &PyCStack_Type, size); (*cst)->startaddr = stackbase; _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 16:07:36 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 16:07:36 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/PCbuild pythoncore.dsp, 1.53, 1.54 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/PCbuild In directory centera.de:/tmp/cvs-serv19010/src/2.3/dev/PCbuild Modified Files: pythoncore.dsp Log Message: a huge rewrite, moving towards a cleaner implementation with less global state variables. This first step eliminates ts->st.tempval, and it transports values cleanly *inside* the Py_UnwindToken, which has been extended. The token is no longer explicitly used, but tested, loaded and unloaded by some macroes. The next stepp will be to also put the next frame to run into this structure. The final step will be hard: dropping the frame concept and using thunks, instead. This will make frames completely unmodified, a big step towards more compatibility and easier maintenance. Index: pythoncore.dsp =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/PCbuild/pythoncore.dsp,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** pythoncore.dsp 29 Mar 2004 00:04:45 -0000 1.53 --- pythoncore.dsp 18 Apr 2004 14:07:33 -0000 1.54 *************** *** 186,196 **** SOURCE=..\Stackless\stacklesseval.c - - !IF "$(CFG)" == "pythoncore - Win32 Release" - - !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" - - !ENDIF - # End Source File # End Group --- 186,189 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 5 20:17:45 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 05 Apr 2004 20:17:45 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_impl.h, 1.71, 1.72 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv2448/Stackless Modified Files: stackless_impl.h Log Message: still trying to convince gcc not to blather... Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** stackless_impl.h 5 Apr 2004 17:17:36 -0000 1.71 --- stackless_impl.h 5 Apr 2004 18:17:43 -0000 1.72 *************** *** 293,300 **** /* turn the stackless flag macros into dummies */ ! #define STACKLESS_GETARG() typedef int this_is_just_a_syntax_issue ! #define STACKLESS_PROMOTE(func) 0 ! #define STACKLESS_PROMOTE_FLAG(flag) 0 ! #define STACKLESS_PROMOTE_ALL() 0 #define STACKLESS_PROPOSE(func) #define STACKLESS_PROPOSE_FLAG(flag) --- 293,300 ---- /* turn the stackless flag macros into dummies */ ! #define STACKLESS_GETARG() int stackless = 0; typedef int xxxxx ! #define STACKLESS_PROMOTE(func) (xxxxx)stackless ! #define STACKLESS_PROMOTE_FLAG(flag) (xxxxx)stackless ! #define STACKLESS_PROMOTE_ALL() (xxxxx)stackless #define STACKLESS_PROPOSE(func) #define STACKLESS_PROPOSE_FLAG(flag) _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From sdrees at centera.de Fri Apr 9 01:36:09 2004 From: sdrees at centera.de (Stefan Drees) Date: Fri, 09 Apr 2004 01:36:09 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/unittests test_tasklet_become.py, NONE, 1.1 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/unittests In directory centera.de:/tmp/cvs-serv12141 Added Files: test_tasklet_become.py Log Message: First shot at a unit test for tasklet.become() (works with current stackless). --- NEW FILE: test_tasklet_become.py --- import unittest """Unsure, if an explicit tasklet.become(tasklet()) should be tested. """ from sys import stdout from stackless import * class TestTaskletBecome(unittest.TestCase): def testSimpleTaskletBecome(self): def f(ch): print "\tBecoming a tasklet inside f(ch)" #become_tasklet() got = tasklet().capture(42) yum = repr(got) print "\tCaptured inside f(ch):", yum print ch.receive() print "\tFunction f(ch) finished" ch = channel() print print "First in main(TestTaskletBecome):", foo = getcurrent() print foo print "Now calling a function f(ch)" bar = f(ch) print "Back in main(TestTaskletBecome):",bar ch.send("Did it work out right?") self.assertEquals(foo,bar) if __name__ == '__main__': import sys if not sys.argv[1:]: sys.argv.append('-v') unittest.main() _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 21:01:10 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 21:01:10 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/pickling prickelpit.c, 1.71, 1.72 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/pickling In directory centera.de:/tmp/cvs-serv8760/Stackless/pickling Modified Files: prickelpit.c Log Message: Merging the whole Stackless back into 2.2.3 !!! built a chain of initializers using a macro, to make it easier to comment parts out. Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/pickling/prickelpit.c,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** prickelpit.c 29 Apr 2004 17:58:59 -0000 1.71 --- prickelpit.c 29 Apr 2004 19:01:08 -0000 1.72 *************** *** 186,190 **** }; ! static int init_type(PyTypeObject *t) { PyMethodDescrObject *reduce; --- 186,190 ---- }; ! static int init_type(PyTypeObject *t, int (*initchain)(void)) { PyMethodDescrObject *reduce; *************** *** 221,227 **** --- 221,233 ---- Py_XDECREF(retval); Py_XDECREF(args); + if (ret == 0 && initchain != NULL) + ret = initchain(); return ret; } + /* root of init function chain */ + + #define initchain NULL + /* helper to execute a bit of code which simplifies things */ *************** *** 532,537 **** static int init_codetype(void) { ! return init_type(&wrap_PyCode_Type); } /****************************************************** --- 538,546 ---- static int init_codetype(void) { ! return init_type(&wrap_PyCode_Type, initchain); } + #undef initchain + #define initchain init_codetype + /****************************************************** *************** *** 600,605 **** static int init_celltype(void) { ! return init_type(&wrap_PyCell_Type); } --- 609,616 ---- static int init_celltype(void) { ! return init_type(&wrap_PyCell_Type, initchain); } + #undef initchain + #define initchain init_celltype *************** *** 678,683 **** static int init_functype(void) { ! return init_type(&wrap_PyFunction_Type); } --- 689,696 ---- static int init_functype(void) { ! return init_type(&wrap_PyFunction_Type, initchain); } + #undef initchain + #define initchain init_functype *************** *** 1014,1027 **** static int init_frametype(void) { ! return init_type(&wrap_PyFrame_Type) ! || slp_register_execute(&PyFrame_Type, "eval_frame", ! PyEval_EvalFrame, REF_INVALID_EXEC(eval_frame)) || slp_register_execute(&PyFrame_Type, "eval_frame_value", ! PyEval_EvalFrame_value, REF_INVALID_EXEC(eval_frame_value)) || slp_register_execute(&PyFrame_Type, "eval_frame_noval", ! PyEval_EvalFrame_noval, REF_INVALID_EXEC(eval_frame_noval)) || slp_register_execute(&PyFrame_Type, "eval_frame_iter", ! PyEval_EvalFrame_iter, REF_INVALID_EXEC(eval_frame_iter)); } /****************************************************** --- 1027,1043 ---- static int init_frametype(void) { ! return slp_register_execute(&PyFrame_Type, "eval_frame", ! PyEval_EvalFrame, REF_INVALID_EXEC(eval_frame)) || slp_register_execute(&PyFrame_Type, "eval_frame_value", ! PyEval_EvalFrame_value, REF_INVALID_EXEC(eval_frame_value)) || slp_register_execute(&PyFrame_Type, "eval_frame_noval", ! PyEval_EvalFrame_noval, REF_INVALID_EXEC(eval_frame_noval)) || slp_register_execute(&PyFrame_Type, "eval_frame_iter", ! PyEval_EvalFrame_iter, REF_INVALID_EXEC(eval_frame_iter)) ! || init_type(&wrap_PyFrame_Type, initchain); } + #undef initchain + #define initchain init_frametype + /****************************************************** *************** *** 1112,1117 **** static int init_tracebacktype(void) { ! return init_type(&wrap_PyTraceBack_Type); } /****************************************************** --- 1128,1136 ---- static int init_tracebacktype(void) { ! return init_type(&wrap_PyTraceBack_Type, initchain); } + #undef initchain + #define initchain init_tracebacktype + /****************************************************** *************** *** 1191,1196 **** static int init_moduletype(void) { ! return init_type(&wrap_PyModule_Type); } --- 1210,1217 ---- static int init_moduletype(void) { ! return init_type(&wrap_PyModule_Type, initchain); } + #undef initchain + #define initchain init_moduletype *************** *** 1285,1291 **** static int init_itertype(void) { ! return init_type(&wrap_PySeqIter_Type) ! || init_type(&wrap_PyCallIter_Type); } --- 1306,1314 ---- static int init_itertype(void) { ! return init_type(&wrap_PySeqIter_Type, NULL) ! || init_type(&wrap_PyCallIter_Type, initchain); } + #undef initchain + #define initchain init_itertype *************** *** 1320,1325 **** static int init_methodtype(void) { ! return init_type(&wrap_PyMethod_Type); } --- 1343,1350 ---- static int init_methodtype(void) { ! return init_type(&wrap_PyMethod_Type, initchain); } + #undef initchain + #define initchain init_methodtype *************** *** 1401,1406 **** static int init_dictitertype(void) { ! return init_type(&wrap_PyDictIter_Type); } /****************************************************** --- 1426,1434 ---- static int init_dictitertype(void) { ! return init_type(&wrap_PyDictIter_Type, initchain); } + #undef initchain + #define initchain init_dictitertype + /****************************************************** *************** *** 1454,1459 **** static int init_enumtype(void) { ! return init_type(&wrap_PyEnum_Type); } --- 1482,1489 ---- static int init_enumtype(void) { ! return init_type(&wrap_PyEnum_Type, initchain); } + #undef initchain + #define initchain init_enumtype *************** *** 1507,1512 **** static int init_listitertype(void) { ! return init_type(&wrap_PyListIter_Type); } /****************************************************** --- 1537,1545 ---- static int init_listitertype(void) { ! return init_type(&wrap_PyListIter_Type, initchain); } + #undef initchain + #define initchain init_listitertype + /****************************************************** *************** *** 1570,1575 **** static int init_rangeitertype(void) { ! return init_type(&wrap_PyRangeIter_Type); } /****************************************************** --- 1603,1611 ---- static int init_rangeitertype(void) { ! return init_type(&wrap_PyRangeIter_Type, initchain); } + #undef initchain + #define initchain init_rangeitertype + /****************************************************** *************** *** 1623,1628 **** static int init_tupleitertype(void) { ! return init_type(&wrap_PyTupleIter_Type); } --- 1659,1666 ---- static int init_tupleitertype(void) { ! return init_type(&wrap_PyTupleIter_Type, initchain); } + #undef initchain + #define initchain init_tupleitertype *************** *** 1667,1672 **** static int init_rangetype(void) { ! return init_type(&wrap_PyRange_Type); } --- 1705,1712 ---- static int init_rangetype(void) { ! return init_type(&wrap_PyRange_Type, initchain); } + #undef initchain + #define initchain init_rangetype *************** *** 1775,1780 **** static int init_methodwrappertype(void) { ! return init_type(&wrap_PyMethodWrapper_Type); } /****************************************************** --- 1815,1823 ---- static int init_methodwrappertype(void) { ! return init_type(&wrap_PyMethodWrapper_Type, initchain); } + #undef initchain + #define initchain init_methodwrappertype + /****************************************************** *************** *** 1885,1890 **** static int init_generatortype(void) { ! return init_type(&wrap_PyGenerator_Type); } --- 1928,1935 ---- static int init_generatortype(void) { ! return init_type(&wrap_PyGenerator_Type, initchain); } + #undef initchain + #define initchain init_generatortype *************** *** 1998,2019 **** } PyErr_Clear(); ! if (0 ! || init_codetype() ! || init_functype() ! || init_celltype() ! || init_frametype() ! || init_tracebacktype() ! || init_moduletype() ! || init_itertype() ! || init_methodtype() ! || init_dictitertype() ! || init_enumtype() ! || init_listitertype() ! || init_rangeitertype() ! || init_tupleitertype() ! || init_rangetype() ! || init_methodwrappertype() ! || init_generatortype() ! ) ret = -1; --- 2043,2047 ---- } PyErr_Clear(); ! if (initchain()) ret = -1; _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 20:13:45 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 20:13:45 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_api.h, 1.29, 1.30 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv7009/Stackless Modified Files: stackless_api.h Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: stackless_api.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_api.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** stackless_api.h 24 Apr 2004 23:29:39 -0000 1.29 --- stackless_api.h 29 Apr 2004 18:13:42 -0000 1.30 *************** *** 35,39 **** ******************************************************/ ! #include "stackless_impl.h" /* --- 35,39 ---- ******************************************************/ ! #include "core/stackless_impl.h" /* _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 14:43:11 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 14:43:11 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_api.h, 1.27, 1.28 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv16789/src/2.3/dev/Stackless Modified Files: stackless_api.h Log Message: decoration change only. Note that the API is going to change, soon, for all _nr functions. I am changing the protocol to be more explicit! Index: stackless_api.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_api.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** stackless_api.h 29 Mar 2004 00:04:45 -0000 1.27 --- stackless_api.h 18 Apr 2004 12:43:09 -0000 1.28 *************** *** 33,37 **** Note: Py_UnwindToken is *never* inc/decref'ed. ! *******************************************************/ #include "stackless_impl.h" --- 33,37 ---- Note: Py_UnwindToken is *never* inc/decref'ed. ! ******************************************************/ #include "stackless_impl.h" *************** *** 194,198 **** channel related functions ! *******************************************************/ /* --- 194,198 ---- channel related functions ! ******************************************************/ /* *************** *** 236,240 **** stacklessmodule functions ! *******************************************************/ /* --- 236,240 ---- stacklessmodule functions ! ******************************************************/ /* *************** *** 283,287 **** debugging and monitoring functions ! *******************************************************/ /* --- 283,287 ---- debugging and monitoring functions ! ******************************************************/ /* *************** *** 319,323 **** interface functions ! *******************************************************/ /* --- 319,323 ---- interface functions ! ******************************************************/ /* _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:59:01 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:59:01 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python bltinmodule.c, 1.8, 1.9 ceval.c, 1.81, 1.82 getversion.c, 1.3, 1.4 pythonrun.c, 1.19, 1.20 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv5382/Python Modified Files: bltinmodule.c ceval.c getversion.c pythonrun.c Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: bltinmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/bltinmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bltinmodule.c 24 Apr 2004 23:29:39 -0000 1.8 --- bltinmodule.c 29 Apr 2004 17:58:58 -0000 1.9 *************** *** 4,8 **** #include "Python.h" ! #include "stackless_impl.h" #include "node.h" --- 4,8 ---- #include "Python.h" ! #include "core/stackless_impl.h" #include "node.h" Index: ceval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/ceval.c,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** ceval.c 29 Apr 2004 02:30:42 -0000 1.81 --- ceval.c 29 Apr 2004 17:58:58 -0000 1.82 *************** *** 14,18 **** #include "opcode.h" #include "structmember.h" ! #include "stackless_impl.h" #ifdef macintosh --- 14,18 ---- #include "opcode.h" #include "structmember.h" ! #include "core/stackless_impl.h" #ifdef macintosh Index: getversion.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/getversion.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** getversion.c 11 Jul 2002 20:52:41 -0000 1.3 --- getversion.c 29 Apr 2004 17:58:58 -0000 1.4 *************** *** 8,12 **** #ifdef STACKLESS /* avoiding to recompile everything for Stackless all the time */ ! #include "stackless_version.h" const char * --- 8,12 ---- #ifdef STACKLESS /* avoiding to recompile everything for Stackless all the time */ ! #include "core/stackless_version.h" const char * Index: pythonrun.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/pythonrun.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** pythonrun.c 24 Apr 2004 23:29:39 -0000 1.19 --- pythonrun.c 29 Apr 2004 17:58:58 -0000 1.20 *************** *** 13,17 **** #include "eval.h" #include "marshal.h" ! #include "stackless_impl.h" #ifdef HAVE_SIGNAL_H --- 13,17 ---- #include "eval.h" #include "marshal.h" ! #include "core/stackless_impl.h" #ifdef HAVE_SIGNAL_H _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:25:32 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:25:32 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/platf - New directory Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/platf In directory centera.de:/tmp/cvs-serv4633/platf Log Message: Directory /home/cvs/slpdev/src/2.3/dev/Stackless/platf added to the repository _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 5 20:20:26 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 05 Apr 2004 20:20:26 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_impl.h, 1.72, 1.73 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv3043/Stackless Modified Files: stackless_impl.h Log Message: still trying to convince gcc not to blather... Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** stackless_impl.h 5 Apr 2004 18:17:43 -0000 1.72 --- stackless_impl.h 5 Apr 2004 18:20:24 -0000 1.73 *************** *** 293,300 **** /* turn the stackless flag macros into dummies */ ! #define STACKLESS_GETARG() int stackless = 0; typedef int xxxxx ! #define STACKLESS_PROMOTE(func) (xxxxx)stackless ! #define STACKLESS_PROMOTE_FLAG(flag) (xxxxx)stackless ! #define STACKLESS_PROMOTE_ALL() (xxxxx)stackless #define STACKLESS_PROPOSE(func) #define STACKLESS_PROPOSE_FLAG(flag) --- 293,300 ---- /* turn the stackless flag macros into dummies */ ! #define STACKLESS_GETARG() struct x { struct x* y; } ! #define STACKLESS_PROMOTE(func) ! #define STACKLESS_PROMOTE_FLAG(flag) ! #define STACKLESS_PROMOTE_ALL() #define STACKLESS_PROPOSE(func) #define STACKLESS_PROPOSE_FLAG(flag) _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 21:51:29 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 21:51:29 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Modules cPickle.c, 1.7, 1.8 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Modules In directory centera.de:/tmp/cvs-serv4029/dev/Modules Modified Files: cPickle.c Log Message: a first shot at safe pickling, see the new file safe_pickle.c Index: cPickle.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Modules/cPickle.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** cPickle.c 24 Feb 2004 15:50:29 -0000 1.7 --- cPickle.c 18 Apr 2004 19:51:27 -0000 1.8 *************** *** 2,5 **** --- 2,6 ---- #include "cStringIO.h" #include "structmember.h" + #include "stackless_impl.h" PyDoc_STRVAR(cPickle_module_documentation, *************** *** 2277,2280 **** --- 2278,2287 ---- int tmp, size; + #ifdef STACKLESS + if (++self->nesting % 20 == 0){ + res = slp_safe_pickling((void *)&save, (PyObject *)self, args, pers_save); + goto finally; + } + #else if (self->nesting++ > Py_GetRecursionLimit()){ PyErr_SetString(PyExc_RuntimeError, *************** *** 2282,2285 **** --- 2289,2293 ---- goto finally; } + #endif if (!pers_save && self->pers_func) { _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Wed Apr 7 21:33:34 2004 From: tismer at centera.de (Christian Tismer) Date: Wed, 07 Apr 2004 21:33:34 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/src/Stackless taskletobject.c, 1.104, 1.105 Message-ID: Update of /home/cvs/slpdev/src/2.3/src/Stackless In directory centera.de:/tmp/cvs-serv19651/src/2.3/src/Stackless Modified Files: taskletobject.c Log Message: bugfix: I forgot to fill the run slot of tasklets :-) Index: taskletobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/src/Stackless/taskletobject.c,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** taskletobject.c 2 Apr 2004 23:47:26 -0000 1.104 --- taskletobject.c 7 Apr 2004 19:33:32 -0000 1.105 *************** *** 1314,1317 **** --- 1314,1318 ---- tasklet_cmethods[] = { CMETHOD_PUBLIC_ENTRY(PyTasklet_HeapType, tasklet, insert), + CMETHOD_PUBLIC_ENTRY(PyTasklet_HeapType, tasklet, run), CMETHOD_PUBLIC_ENTRY(PyTasklet_HeapType, tasklet, remove), CMETHOD_PUBLIC_ENTRY(PyTasklet_HeapType, tasklet, set_atomic), _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 04:30:44 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 04:30:44 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python ceval.c, 1.80, 1.81 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv17154/dev/Python Modified Files: ceval.c Log Message: white space patch Index: ceval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/ceval.c,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** ceval.c 24 Apr 2004 23:29:39 -0000 1.80 --- ceval.c 29 Apr 2004 02:30:42 -0000 1.81 *************** *** 3925,3929 **** PCALL(PCALL_OTHER); #endif ! STACKLESS_PROPOSE(func); result = PyObject_Call(func, callargs, kwdict); STACKLESS_ASSERT(); --- 3925,3929 ---- PCALL(PCALL_OTHER); #endif ! STACKLESS_PROPOSE(func); result = PyObject_Call(func, callargs, kwdict); STACKLESS_ASSERT(); _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 23 04:17:34 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 23 Apr 2004 04:17:34 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless prickelpit.c, 1.66, 1.67 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv8284/dev/Stackless Modified Files: prickelpit.c Log Message: gargll!!! still small Linux probs... Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** prickelpit.c 23 Apr 2004 02:15:47 -0000 1.66 --- prickelpit.c 23 Apr 2004 02:17:32 -0000 1.67 *************** *** 1052,1057 **** mod_dict = PyModule_GetDict(mod); } ! if ((mod_dict != NULL) && PyDict_Update(mod_dict, dict)) Py_DECREF(mod); return mod; } --- 1052,1058 ---- mod_dict = PyModule_GetDict(mod); } ! if (mod_dict != NULL && PyDict_Update(mod_dict, dict)) { Py_DECREF(mod); + } return mod; } _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From lutz at centera.de Mon Apr 5 16:48:43 2004 From: lutz at centera.de (=?iso-8859-1?Q?Lutz_P=E4like?=) Date: Mon, 05 Apr 2004 16:48:43 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python bltinmodule.c, 1.5, 1.6 ceval.c, 1.75, 1.76 pythonrun.c, 1.13, 1.14 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv11404/src/2.3/dev/Python Modified Files: bltinmodule.c ceval.c pythonrun.c Log Message: Added some missing #ifdef STACKLESS definitions to make compilation as standard python possible again. Index: bltinmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/bltinmodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bltinmodule.c 27 Mar 2004 01:11:59 -0000 1.5 --- bltinmodule.c 5 Apr 2004 14:48:41 -0000 1.6 *************** *** 459,463 **** --- 459,465 ---- builtin_eval(PyObject *self, PyObject *args) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif PyObject *cmd, *result, *tmp = NULL; PyObject *globals = Py_None, *locals = Py_None; *************** *** 490,494 **** --- 492,498 ---- return NULL; } + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals); } *************** *** 517,523 **** --- 521,531 ---- (void)PyEval_MergeCompilerFlags(&cf); + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif result = PyRun_StringFlags(str, Py_eval_input, globals, locals, &cf); + #ifdef STACKLESS STACKLESS_ASSERT(); + #endif Py_XDECREF(tmp); return result; *************** *** 537,541 **** --- 545,551 ---- builtin_execfile(PyObject *self, PyObject *args) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif char *filename; PyObject *globals = Py_None, *locals = Py_None; *************** *** 615,619 **** --- 625,631 ---- } cf.cf_flags = 0; + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif if (PyEval_MergeCompilerFlags(&cf)) res = PyRun_FileExFlags(fp, filename, Py_file_input, globals, *************** *** 622,626 **** --- 634,640 ---- res = PyRun_FileEx(fp, filename, Py_file_input, globals, locals, 1); + #ifdef STACKLESS STACKLESS_ASSERT(); + #endif return res; } Index: ceval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/ceval.c,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** ceval.c 27 Mar 2004 01:11:59 -0000 1.75 --- ceval.c 5 Apr 2004 14:48:41 -0000 1.76 *************** *** 2680,2684 **** --- 2680,2686 ---- PyObject **defs, int defcount, PyObject *closure) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif register PyFrameObject *f; register PyObject *retval = NULL; *************** *** 3595,3599 **** --- 3597,3603 ---- PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif PyObject *result; *************** *** 3614,3621 **** return NULL; } ! STACKLESS_PROMOTE_ALL(); result = PyObject_Call(func, arg, kw); STACKLESS_ASSERT(); Py_DECREF(arg); return result; --- 3618,3628 ---- return NULL; } ! #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif result = PyObject_Call(func, arg, kw); + #ifdef STACKLESS STACKLESS_ASSERT(); + #endif Py_DECREF(arg); return result; Index: pythonrun.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/pythonrun.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pythonrun.c 27 Mar 2004 01:11:59 -0000 1.13 --- pythonrun.c 5 Apr 2004 14:48:41 -0000 1.14 *************** *** 1226,1234 **** --- 1226,1238 ---- PyObject *locals, int closeit) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif node *n = PyParser_SimpleParseFile(fp, filename, start); if (closeit) fclose(fp); + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif return run_err_node(n, filename, globals, locals, NULL); } *************** *** 1255,1264 **** --- 1259,1272 ---- PyObject *locals, int closeit, PyCompilerFlags *flags) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif node *n = PyParser_SimpleParseFileFlags(fp, filename, start, PARSER_FLAGS(flags)); if (closeit) fclose(fp); + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif return run_err_node(n, filename, globals, locals, flags); } *************** *** 1268,1275 **** --- 1276,1287 ---- PyCompilerFlags *flags) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif if (n == NULL) return NULL; + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif return run_node(n, filename, globals, locals, flags); } *************** *** 1279,1283 **** --- 1291,1297 ---- PyCompilerFlags *flags) { + #ifdef STACKLESS STACKLESS_GETARG(); + #endif PyCodeObject *co; PyObject *v; *************** *** 1286,1292 **** --- 1300,1310 ---- if (co == NULL) return NULL; + #ifdef STACKLESS STACKLESS_PROMOTE_ALL(); + #endif v = PyEval_EvalCode(co, globals, locals); + #ifdef STACKLESS STACKLESS_ASSERT(); + #endif Py_DECREF(co); return v; _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 16:07:35 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 16:07:35 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python ceval.c, 1.78, 1.79 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv19010/src/2.3/dev/Python Modified Files: ceval.c Log Message: a huge rewrite, moving towards a cleaner implementation with less global state variables. This first step eliminates ts->st.tempval, and it transports values cleanly *inside* the Py_UnwindToken, which has been extended. The token is no longer explicitly used, but tested, loaded and unloaded by some macroes. The next stepp will be to also put the next frame to run into this structure. The final step will be hard: dropping the frame concept and using thunks, instead. This will make frames completely unmodified, a big step towards more compatibility and easier maintenance. Index: ceval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/ceval.c,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** ceval.c 5 Apr 2004 19:09:18 -0000 1.78 --- ceval.c 18 Apr 2004 14:07:33 -0000 1.79 *************** *** 561,565 **** PyObject * ! PyEval_EvalFrame(PyFrameObject *f) { PyThreadState *tstate = PyThreadState_GET(); --- 561,565 ---- PyObject * ! PyEval_EvalFrame(PyFrameObject *f, PyObject *retval) { PyThreadState *tstate = PyThreadState_GET(); *************** *** 719,726 **** if (tstate->use_tracing) { - #ifdef STACKLESS - PyObject *retval = tstate->st.tempval; - tstate->st.tempval = NULL; - #endif if (tstate->c_tracefunc != NULL) { /* tstate->c_tracefunc, if defined, is a --- 719,722 ---- *************** *** 757,763 **** } } - #ifdef STACKLESS - tstate->st.tempval = retval; - #endif } --- 753,756 ---- *************** *** 765,773 **** f->f_execute = PyEval_EvalFrame_noval; ! return PyEval_EvalFrame_value(f); } PyObject * ! PyEval_EvalFrame_noval(PyFrameObject *f) { /* --- 758,766 ---- f->f_execute = PyEval_EvalFrame_noval; ! return PyEval_EvalFrame_value(f, retval); } PyObject * ! PyEval_EvalFrame_noval(PyFrameObject *f, PyObject *retval) { /* *************** *** 776,784 **** * not, and it makes debugging a little easier. */ ! return PyEval_EvalFrame_value(f); } PyObject * ! PyEval_EvalFrame_iter(PyFrameObject *f) { /* --- 769,777 ---- * not, and it makes debugging a little easier. */ ! return PyEval_EvalFrame_value(f, retval); } PyObject * ! PyEval_EvalFrame_iter(PyFrameObject *f, PyObject *retval) { /* *************** *** 788,796 **** * null without error as valid result. */ ! return PyEval_EvalFrame_value(f); } PyObject * ! PyEval_EvalFrame_value(PyFrameObject *f) { /* unfortunately we repeat all the variables here... */ --- 781,789 ---- * null without error as valid result. */ ! return PyEval_EvalFrame_value(f, retval); } PyObject * ! PyEval_EvalFrame_value(PyFrameObject *f, PyObject *retval) { /* unfortunately we repeat all the variables here... */ *************** *** 811,815 **** register PyObject *stream = NULL; /* for PRINT opcodes */ register PyObject **fastlocals, **freevars; - PyObject *retval = NULL; /* Return value */ PyThreadState *tstate = PyThreadState_GET(); PyCodeObject *co; --- 804,807 ---- *************** *** 836,841 **** fast_reentry: - retval = tstate->st.tempval; - tstate->st.tempval = NULL; #endif /* STACKLESS */ --- 828,831 ---- *************** *** 944,948 **** goto on_error; ! } else if (interrupt_res == Py_UnwindToken) { f->f_execute = PyEval_EvalFrame_noval; goto stackless_interrupt_call; --- 934,938 ---- goto on_error; ! } else if (STACKLESS_UNWINDING(interrupt_res)) { f->f_execute = PyEval_EvalFrame_noval; goto stackless_interrupt_call; *************** *** 2267,2271 **** x = PyIter_Next(v); STACKLESS_ASSERT(); ! if (x == Py_UnwindToken) goto stackless_iter; #else --- 2257,2261 ---- x = PyIter_Next(v); STACKLESS_ASSERT(); ! if (STACKLESS_UNWINDING(x)) goto stackless_iter; #else *************** *** 2298,2302 **** x = call_function(&stack_pointer, oparg); #ifdef STACKLESS ! if (x == Py_UnwindToken) { goto stackless_call; } --- 2288,2292 ---- x = call_function(&stack_pointer, oparg); #ifdef STACKLESS ! if (STACKLESS_UNWINDING(x)) { goto stackless_call; } *************** *** 2344,2348 **** } #ifdef STACKLESS ! if (x == Py_UnwindToken) { goto stackless_call; } --- 2334,2338 ---- } #ifdef STACKLESS ! if (STACKLESS_UNWINDING(x)) { goto stackless_call; } *************** *** 2636,2639 **** --- 2626,2630 ---- stackless_call: + retval = x; /* * keep the reference to the frame to be called. *************** *** 2658,2665 **** ++tstate->recursion_depth; f->f_execute = PyEval_EvalFrame_noval; goto fast_reentry; } ! return Py_UnwindToken; stackless_interrupt_call: --- 2649,2657 ---- ++tstate->recursion_depth; f->f_execute = PyEval_EvalFrame_noval; + STACKLESS_UNPACK(retval); goto fast_reentry; } ! return retval; stackless_interrupt_call: *************** *** 2671,2675 **** f->f_lasti = INSTR_OFFSET() - 1; f = tstate->frame; ! return Py_UnwindToken; #endif } --- 2663,2667 ---- f->f_lasti = INSTR_OFFSET() - 1; f = tstate->frame; ! return (PyObject *) Py_UnwindToken; #endif } *************** *** 2910,2924 **** #ifdef STACKLESS Py_INCREF(Py_None); ! tstate->st.tempval = Py_None; if (stackless) { tstate->frame = f; ! return Py_UnwindToken; } else { if (f->f_back != NULL) /* use the faster path */ ! retval = slp_frame_dispatch(f, f->f_back); ! else retval = slp_eval_frame(f); return retval; } --- 2902,2918 ---- #ifdef STACKLESS Py_INCREF(Py_None); ! retval = Py_None; if (stackless) { tstate->frame = f; ! return STACKLESS_PACK(retval); } else { if (f->f_back != NULL) /* use the faster path */ ! retval = slp_frame_dispatch(f, f->f_back, retval); ! else { ! Py_DECREF(retval); retval = slp_eval_frame(f); + } return retval; } *************** *** 3796,3803 **** #ifdef STACKLESS Py_INCREF(Py_None); ! tstate->st.tempval = Py_None; f->f_execute = PyEval_EvalFrame; tstate->frame = f; ! return Py_UnwindToken; #else retval = eval_frame(f); --- 3790,3797 ---- #ifdef STACKLESS Py_INCREF(Py_None); ! retval = Py_None; f->f_execute = PyEval_EvalFrame; tstate->frame = f; ! return STACKLESS_PACK(retval); #else retval = eval_frame(f); _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 5 21:09:20 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 05 Apr 2004 21:09:20 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_impl.h, 1.76, 1.77 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv6874/Stackless Modified Files: stackless_impl.h Log Message: still trying to convince gcc not to blather... Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** stackless_impl.h 5 Apr 2004 19:00:04 -0000 1.76 --- stackless_impl.h 5 Apr 2004 19:09:18 -0000 1.77 *************** *** 297,303 **** #define STACKLESS_PROMOTE_FLAG(flag) stackless = 0 #define STACKLESS_PROMOTE_ALL() stackless = 0 ! #define STACKLESS_PROPOSE(func) {int stackless = 0;} ! #define STACKLESS_PROPOSE_FLAG(flag) {int stackless = 0;} ! #define STACKLESS_PROPOSE_ALL() {int stackless = 0;} #define STACKLESS_RETRACT() assert(1) #define STACKLESS_ASSERT() assert(1) --- 297,303 ---- #define STACKLESS_PROMOTE_FLAG(flag) stackless = 0 #define STACKLESS_PROMOTE_ALL() stackless = 0 ! #define STACKLESS_PROPOSE(func) assert(1) ! #define STACKLESS_PROPOSE_FLAG(flag) assert(1) ! #define STACKLESS_PROPOSE_ALL() assert(1) #define STACKLESS_RETRACT() assert(1) #define STACKLESS_ASSERT() assert(1) _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:59:01 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:59:01 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Objects abstract.c, 1.12, 1.13 classobject.c, 1.16, 1.17 descrobject.c, 1.12, 1.13 funcobject.c, 1.10, 1.11 methodobject.c, 1.8, 1.9 typeobject.c, 1.13, 1.14 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Objects In directory centera.de:/tmp/cvs-serv5382/Objects Modified Files: abstract.c classobject.c descrobject.c funcobject.c methodobject.c typeobject.c Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: abstract.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/abstract.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** abstract.c 24 Apr 2004 23:29:39 -0000 1.12 --- abstract.c 29 Apr 2004 17:58:58 -0000 1.13 *************** *** 5,9 **** #include "structmember.h" /* we need the offsetof() macro from there */ #include "longintrepr.h" ! #include "stackless_impl.h" #define NEW_STYLE_NUMBER(o) PyType_HasFeature((o)->ob_type, \ --- 5,9 ---- #include "structmember.h" /* we need the offsetof() macro from there */ #include "longintrepr.h" ! #include "core/stackless_impl.h" #define NEW_STYLE_NUMBER(o) PyType_HasFeature((o)->ob_type, \ Index: classobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/classobject.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** classobject.c 24 Apr 2004 23:36:46 -0000 1.16 --- classobject.c 29 Apr 2004 17:58:58 -0000 1.17 *************** *** 4,8 **** #include "Python.h" #include "structmember.h" ! #include "stackless_impl.h" #define TP_DESCR_GET(t) \ --- 4,8 ---- #include "Python.h" #include "structmember.h" ! #include "core/stackless_impl.h" #define TP_DESCR_GET(t) \ Index: descrobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/descrobject.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** descrobject.c 24 Apr 2004 23:36:46 -0000 1.12 --- descrobject.c 29 Apr 2004 17:58:58 -0000 1.13 *************** *** 3,7 **** #include "Python.h" #include "structmember.h" /* Why is this not included in Python.h? */ ! #include "stackless_impl.h" static void --- 3,7 ---- #include "Python.h" #include "structmember.h" /* Why is this not included in Python.h? */ ! #include "core/stackless_impl.h" static void Index: funcobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/funcobject.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** funcobject.c 24 Apr 2004 23:36:46 -0000 1.10 --- funcobject.c 29 Apr 2004 17:58:58 -0000 1.11 *************** *** 6,10 **** #include "eval.h" #include "structmember.h" ! #include "stackless_impl.h" PyObject * --- 6,10 ---- #include "eval.h" #include "structmember.h" ! #include "core/stackless_impl.h" PyObject * Index: methodobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/methodobject.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** methodobject.c 24 Apr 2004 23:36:46 -0000 1.8 --- methodobject.c 29 Apr 2004 17:58:58 -0000 1.9 *************** *** 4,8 **** #include "Python.h" #include "structmember.h" ! #include "stackless_impl.h" static PyCFunctionObject *free_list = NULL; --- 4,8 ---- #include "Python.h" #include "structmember.h" ! #include "core/stackless_impl.h" static PyCFunctionObject *free_list = NULL; Index: typeobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Objects/typeobject.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** typeobject.c 24 Apr 2004 23:29:39 -0000 1.13 --- typeobject.c 29 Apr 2004 17:58:58 -0000 1.14 *************** *** 3,7 **** #include "Python.h" #include "structmember.h" ! #include "stackless_impl.h" #include --- 3,7 ---- #include "Python.h" #include "structmember.h" ! #include "core/stackless_impl.h" #include _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Wed Apr 7 21:33:35 2004 From: tismer at centera.de (Christian Tismer) Date: Wed, 07 Apr 2004 21:33:35 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless taskletobject.c, 1.104, 1.105 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv19651/src/2.3/dev/Stackless Modified Files: taskletobject.c Log Message: bugfix: I forgot to fill the run slot of tasklets :-) Index: taskletobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/taskletobject.c,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** taskletobject.c 2 Apr 2004 23:47:26 -0000 1.104 --- taskletobject.c 7 Apr 2004 19:33:31 -0000 1.105 *************** *** 1314,1317 **** --- 1314,1318 ---- tasklet_cmethods[] = { CMETHOD_PUBLIC_ENTRY(PyTasklet_HeapType, tasklet, insert), + CMETHOD_PUBLIC_ENTRY(PyTasklet_HeapType, tasklet, run), CMETHOD_PUBLIC_ENTRY(PyTasklet_HeapType, tasklet, remove), CMETHOD_PUBLIC_ENTRY(PyTasklet_HeapType, tasklet, set_atomic), _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 17:20:22 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 17:20:22 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless prickelpit.c, 1.58, 1.59 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv29178/src/2.3/dev/Stackless Modified Files: prickelpit.c Log Message: corrected comment Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** prickelpit.c 18 Apr 2004 15:14:37 -0000 1.58 --- prickelpit.c 18 Apr 2004 15:20:20 -0000 1.59 *************** *** 1429,1433 **** /****************************************************** ! pickling of rangeiter ******************************************************/ --- 1429,1433 ---- /****************************************************** ! pickling of xrange ******************************************************/ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 19 21:15:20 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 19 Apr 2004 21:15:20 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless prickelpit.c, 1.60, 1.61 stacklessmodule.c, 1.162, 1.163 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv23468/dev/Stackless Modified Files: prickelpit.c stacklessmodule.c Log Message: moved the patched types for pickling into builtins. This should generate less incompatibilites. I tried to use copy_reg, but this still requires some location for the global types, and still would mean to change the type names. Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** prickelpit.c 18 Apr 2004 16:45:25 -0000 1.60 --- prickelpit.c 19 Apr 2004 19:15:18 -0000 1.61 *************** *** 16,19 **** --- 16,21 ---- *******************************************************/ + static PyObject *_builtin_dict = NULL; + static int meth_table_len(PyMethodDef *ml) { *************** *** 45,50 **** static int init_type(PyTypeObject *t, PyMethodDef *ml, newfunc _new) { ! static char stackless[] = "stackless."; ! char *new_name; if (_new) --- 47,53 ---- static int init_type(PyTypeObject *t, PyMethodDef *ml, newfunc _new) { ! if (PyDict_GetItemString(_builtin_dict, t->tp_name) == NULL) { ! if (PyDict_SetItemString(_builtin_dict, t->tp_name, (PyObject *)t)) return -1; ! } if (_new) *************** *** 60,71 **** t->tp_methods = ml; } - /* we cannot use the __module__ attribute, since this is no heap type */ - if (strncmp(stackless, t->tp_name, strlen(stackless))) { - new_name = malloc(strlen(stackless)+strlen(t->tp_name)+1); - if (new_name == NULL) return -1; - strcpy(new_name, stackless); - strcat(new_name, t->tp_name); - t->tp_name = new_name; - } /* enforce the dict and type to be initialized */ if (PyType_Ready(t)) --- 63,66 ---- *************** *** 1568,1571 **** --- 1563,1570 ---- int init_prickelpit(void) { + PyObject *builtin = PyImport_ImportModule("__builtin__"); + PyObject *dict; + if (builtin == NULL) return -1; + dict = PyModule_GetDict(builtin); if (0 || init_codetype() *************** *** 1586,1591 **** --- 1585,1592 ---- || init_rangetype() ) return -1; + Py_DECREF(builtin); return 0; } + #endif Index: stacklessmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklessmodule.c,v retrieving revision 1.162 retrieving revision 1.163 diff -C2 -d -r1.162 -r1.163 *** stacklessmodule.c 18 Apr 2004 15:14:37 -0000 1.162 --- stacklessmodule.c 19 Apr 2004 19:15:18 -0000 1.163 *************** *** 861,864 **** --- 861,867 ---- || init_cframetype() || init_prickelpit() + || init_flextype() + || init_tasklettype() + || init_channeltype() ) return 0; *************** *** 875,880 **** PySlpModuleObject *m; - if (init_flextype()) - return; if (init_slpmoduletype()) return; --- 878,881 ---- *************** *** 901,909 **** if (PyDict_SetItemString(dict, name, (PyObject*)object) < 0) return - if (0 - || init_tasklettype() - || init_channeltype() - ) - return; INSERT("slpmodule", PySlpModule_TypePtr); INSERT("cframe", &PyCFrame_Type); --- 902,905 ---- *************** *** 914,936 **** INSERT("stackless", slp_module); - /* patched types */ - INSERT("cell", &PyCell_Type); - INSERT("code", &PyCode_Type); - INSERT("traceback", &PyTraceBack_Type); - INSERT("function", &PyFunction_Type); - INSERT("frame", &PyFrame_Type); - INSERT("module", &PyModule_Type); - INSERT("iterator", &PySeqIter_Type); - INSERT("callable-iterator", &PyCallIter_Type); - INSERT("instancemethod", &PyMethod_Type); - - INSERT("dictionary-iterator", &PyDictIter_Type); - INSERT("enumerate", &PyEnum_Type); - INSERT("enumerate-factory", &PyEnumFactory_Type); - INSERT("listiterator", &PyListIter_Type); - INSERT("rangeiterator", &Pyrangeiter_Type); - INSERT("tupleiterator", &PyTupleIter_Type); - INSERT("xrange", &PyRange_Type); - /* module dicts */ INSERT("modict", &PyModuleDict_Type); --- 910,913 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Mon Apr 5 20:22:31 2004 From: tismer at centera.de (Christian Tismer) Date: Mon, 05 Apr 2004 20:22:31 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless stackless_impl.h, 1.73, 1.74 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv3173/Stackless Modified Files: stackless_impl.h Log Message: still trying to convince gcc not to blather... Index: stackless_impl.h =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stackless_impl.h,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** stackless_impl.h 5 Apr 2004 18:20:24 -0000 1.73 --- stackless_impl.h 5 Apr 2004 18:22:29 -0000 1.74 *************** *** 294,303 **** #define STACKLESS_GETARG() struct x { struct x* y; } ! #define STACKLESS_PROMOTE(func) ! #define STACKLESS_PROMOTE_FLAG(flag) ! #define STACKLESS_PROMOTE_ALL() ! #define STACKLESS_PROPOSE(func) ! #define STACKLESS_PROPOSE_FLAG(flag) ! #define STACKLESS_PROPOSE_ALL() #define STACKLESS_RETRACT() #define STACKLESS_ASSERT() --- 294,303 ---- #define STACKLESS_GETARG() struct x { struct x* y; } ! #define STACKLESS_PROMOTE(func) 0 ! #define STACKLESS_PROMOTE_FLAG(flag) 0 ! #define STACKLESS_PROMOTE_ALL() 0 ! #define STACKLESS_PROPOSE(func) 0 ! #define STACKLESS_PROPOSE_FLAG(flag) 0 ! #define STACKLESS_PROPOSE_ALL() 0 #define STACKLESS_RETRACT() #define STACKLESS_ASSERT() _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Tue Apr 20 02:30:44 2004 From: tismer at centera.de (Christian Tismer) Date: Tue, 20 Apr 2004 02:30:44 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Modules cPickle.c, 1.8, 1.9 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Modules In directory centera.de:/tmp/cvs-serv31293/dev/Modules Modified Files: cPickle.c Log Message: due to more pickling compatibility, a special case could be removed. Index: cPickle.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Modules/cPickle.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** cPickle.c 18 Apr 2004 19:51:27 -0000 1.8 --- cPickle.c 20 Apr 2004 00:30:42 -0000 1.9 *************** *** 2374,2389 **** goto finally; } - #ifdef STACKLESS - /* stackless.function */ - if (type == &PyFunction_Type) { - res = save_global(self, args, NULL); - if (res && PyErr_ExceptionMatches(PickleError)) { - /* fall back to reduce */ - PyErr_Clear(); - break; - } - goto finally; - } - #endif break; --- 2374,2377 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 11 14:02:25 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 11 Apr 2004 14:02:25 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.2/src/Stackless/testbench simwrapper.c, 1.5, 1.6 testbench.dsp, 1.2, 1.3 Message-ID: Update of /home/cvs/slpdev/src/2.2/src/Stackless/testbench In directory centera.de:/tmp/cvs-serv31373/src/2.2/src/Stackless/testbench Modified Files: simwrapper.c testbench.dsp Log Message: temporary Index: simwrapper.c =================================================================== RCS file: /home/cvs/slpdev/src/2.2/src/Stackless/testbench/simwrapper.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** simwrapper.c 14 Jan 2004 16:33:13 -0000 1.5 --- simwrapper.c 11 Apr 2004 12:02:23 -0000 1.6 *************** *** 52,56 **** if ( PyTasklet_Alive( task )) ret = PyTasklet_Kill( task ); ! Py_DECREF( task ); } return ret; --- 52,56 ---- if ( PyTasklet_Alive( task )) ret = PyTasklet_Kill( task ); ! Py_XDECREF( task ); } return ret; *************** *** 114,118 **** if( task ) { ! Py_DECREF(task); return wrap(PyStackless_Schedule(Py_None, 0)); } --- 114,118 ---- if( task ) { ! Py_XDECREF(task); return wrap(PyStackless_Schedule(Py_None, 0)); } Index: testbench.dsp =================================================================== RCS file: /home/cvs/slpdev/src/2.2/src/Stackless/testbench/testbench.dsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testbench.dsp 22 Nov 2003 04:52:43 -0000 1.2 --- testbench.dsp 11 Apr 2004 12:02:23 -0000 1.3 *************** *** 45,49 **** F90=df.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c ! # ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /I "..\..\stackless" /I "..\..\PC" /I "..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 --- 45,49 ---- F90=df.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c ! # ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /I "..\..\stackless" /I "..\..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 *************** *** 56,60 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib python22.lib /nologo /subsystem:console /machine:I386 /out:"..\..\PCbuild\testbench.exe" /libpath:"..\..\PCbuild" # SUBTRACT LINK32 /pdb:none --- 56,60 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:".\testbench.exe" /libpath:"..\..\stackless\src\PCbuild" # SUBTRACT LINK32 /pdb:none *************** *** 75,79 **** # ADD F90 /browser # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c ! # ADD CPP /nologo /MT /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\stackless" /I "..\..\PC" /I "..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /FD /GZ /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 --- 75,79 ---- # ADD F90 /browser # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c ! # ADD CPP /nologo /MT /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\stackless" /I "..\..\PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /FD /GZ /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 *************** *** 86,90 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\PCbuild\testbench_d.exe" /pdbtype:sept /libpath:"..\..\PCbuild" # SUBTRACT LINK32 /pdb:none --- 86,90 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:".\testbench.exe" /pdbtype:sept /libpath:"..\..\stackless\src\PCbuild" # SUBTRACT LINK32 /pdb:none *************** *** 112,116 **** !ELSEIF "$(CFG)" == "testbench - Win32 Debug" ! # ADD CPP /I "C:\codebase\main\development\3rdparty\Include" /I "C:\codebase\main\development\3rdparty\PC" /I "C:\codebase\main\development\3rdparty\stackless" /I "C:\codebase\main\development\3rdparty\simwrapper" /Yc"stdafx.h" !ENDIF --- 112,116 ---- !ELSEIF "$(CFG)" == "testbench - Win32 Debug" ! # ADD CPP /I "C:\codebase\main\development\3rdparty\stackless\src\Include" /I "C:\codebase\main\development\3rdparty\stackless\src\PC" /I "C:\codebase\main\development\3rdparty\stackless\src\stackless" /I "C:\codebase\main\development\3rdparty\stackless\src\simwrapper" /Yc"stdafx.h" !ENDIF *************** *** 125,129 **** !ELSEIF "$(CFG)" == "testbench - Win32 Debug" ! # ADD CPP /I "C:\codebase\main\development\3rdparty\Include" /I "C:\codebase\main\development\3rdparty\PC" /I "C:\codebase\main\development\3rdparty\stackless" /I "C:\codebase\main\development\3rdparty\simwrapper" !ENDIF --- 125,129 ---- !ELSEIF "$(CFG)" == "testbench - Win32 Debug" ! # ADD CPP /I "C:\codebase\main\development\3rdparty\stackless\src\Include" /I "C:\codebase\main\development\3rdparty\stackless\src\PC" /I "C:\codebase\main\development\3rdparty\stackless\src\stackless" /I "C:\codebase\main\development\3rdparty\stackless\src\simwrapper" !ENDIF _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 23 02:34:40 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 23 Apr 2004 02:34:40 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/unittests test_miscell.py, 1.3, 1.4 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/unittests In directory centera.de:/tmp/cvs-serv4949/dev/Stackless/unittests Modified Files: test_miscell.py Log Message: I did a complete rewrite of Stackless pickling. There is *no longer* any patched type. All post-pickled builtin types are now installed into copy_reg. This is done through a module _wrap in stackless. The implementation use sshadow type objects which act like the real types, but they have __reduce__, __new__, __setstate__. This works just great now. One missing spot is pickleing of def f():yield 42 pickle.dumps(type(f()).next) This needs a slot wrapper which is missing. Besides that, I have thought out a second rewrite of pickling which uses a simple special object, which is much smaller and can serve the same service. This will generalize pickling even much more and will make it easier to adopt to all those many new types in Zope, for instance. Stay tuned! Index: test_miscell.py =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/unittests/test_miscell.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_miscell.py 18 Apr 2004 15:14:37 -0000 1.3 --- test_miscell.py 23 Apr 2004 00:34:38 -0000 1.4 *************** *** 7,11 **** def runtask(): x = 0 ! # provoke pickling of an xrange object dummy = xrange(10) for ii in xrange(1000): --- 7,11 ---- def runtask(): x = 0 ! # evoke pickling of an xrange object dummy = xrange(10) for ii in xrange(1000): _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Wed Apr 7 19:23:42 2004 From: tismer at centera.de (Christian Tismer) Date: Wed, 07 Apr 2004 19:23:42 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Python exceptions.c, 1.3, 1.4 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Python In directory centera.de:/tmp/cvs-serv15965/src/2.3/dev/Python Modified Files: exceptions.c Log Message: cured a really bad bug in the Windows stack switching code. This turned up, after I de-virtualized the cstack operations, and less registers were used. Also clarified a possibly dangling pointer from cstack to tasklet. And TaskletExit inherits from SystemExit, now. Index: exceptions.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Python/exceptions.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** exceptions.c 14 Jan 2004 19:11:08 -0000 1.3 --- exceptions.c 7 Apr 2004 17:23:40 -0000 1.4 *************** *** 1676,1683 **** {"StopIteration", &PyExc_StopIteration, &PyExc_Exception, StopIteration__doc__}, - #ifdef STACKLESS - {"TaskletExit", &PyExc_TaskletExit, &PyExc_Exception, - TaskletExit__doc__}, - #endif {"StandardError", &PyExc_StandardError, &PyExc_Exception, StandardError__doc__}, --- 1676,1679 ---- *************** *** 1688,1691 **** --- 1684,1691 ---- {"SystemExit", &PyExc_SystemExit, &PyExc_Exception, SystemExit__doc__, SystemExit_methods}, + #ifdef STACKLESS + {"TaskletExit", &PyExc_TaskletExit, &PyExc_SystemExit, + TaskletExit__doc__}, + #endif {"KeyboardInterrupt", &PyExc_KeyboardInterrupt, 0, KeyboardInterrupt__doc__}, {"ImportError", &PyExc_ImportError, 0, ImportError__doc__}, _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 25 01:29:42 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 25 Apr 2004 01:29:42 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev Makefile.pre.in, 1.28, 1.29 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev In directory centera.de:/tmp/cvs-serv10482 Modified Files: Makefile.pre.in Log Message: I did a big cleanup. Tried to reformat everything using 8-tabs, roemoved dead code, and tried to make all Python source file whitespace compatible with the Stackless' version. I hope I didn't make too many mistakes... Index: Makefile.pre.in =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Makefile.pre.in,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Makefile.pre.in 18 Apr 2004 20:30:09 -0000 1.28 --- Makefile.pre.in 24 Apr 2004 23:29:39 -0000 1.29 *************** *** 527,533 **** Stackless/slp_platformselect.h \ Stackless/stackless.h \ - Stackless/stacklesseval.h \ Stackless/stackless_api.h \ - Stackless/stackless_frame.h \ Stackless/stackless_impl.h \ Stackless/stackless_structs.h \ --- 527,531 ---- _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 21:01:10 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 21:01:10 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/PCbuild pythoncore.dsp, 1.58, 1.59 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/PCbuild In directory centera.de:/tmp/cvs-serv8760/PCbuild Modified Files: pythoncore.dsp Log Message: Merging the whole Stackless back into 2.2.3 !!! built a chain of initializers using a macro, to make it easier to comment parts out. Index: pythoncore.dsp =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/PCbuild/pythoncore.dsp,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** pythoncore.dsp 29 Apr 2004 17:58:58 -0000 1.58 --- pythoncore.dsp 29 Apr 2004 19:01:08 -0000 1.59 *************** *** 177,188 **** # Begin Source File - SOURCE=..\Stackless\stackless.h - # End Source File - # Begin Source File - - SOURCE=..\Stackless\stackless_api.h - # End Source File - # Begin Source File - SOURCE=..\Stackless\core\stackless_impl.h # End Source File --- 177,180 ---- *************** *** 201,208 **** # Begin Source File - SOURCE=..\Stackless\core\stackless_version.h - # End Source File - # Begin Source File - SOURCE=..\Stackless\core\stacklesseval.c # End Source File --- 193,196 ---- *************** *** 260,263 **** --- 248,263 ---- SOURCE=..\Stackless\readme.txt # End Source File + # Begin Source File + + SOURCE=..\Stackless\stackless.h + # End Source File + # Begin Source File + + SOURCE=..\Stackless\stackless_api.h + # End Source File + # Begin Source File + + SOURCE=..\Stackless\stackless_version.h + # End Source File # End Group # Begin Source File _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Fri Apr 23 04:15:49 2004 From: tismer at centera.de (Christian Tismer) Date: Fri, 23 Apr 2004 04:15:49 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless prickelpit.c, 1.65, 1.66 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv8200/dev/Stackless Modified Files: prickelpit.c Log Message: gargll!!! still small Linux probs... Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** prickelpit.c 23 Apr 2004 02:12:24 -0000 1.65 --- prickelpit.c 23 Apr 2004 02:15:47 -0000 1.66 *************** *** 1052,1056 **** mod_dict = PyModule_GetDict(mod); } ! if (mod_dict != NULL && PyDict_Update(mod_dict, dict)) Py_DECREF(mod); return mod; --- 1052,1056 ---- mod_dict = PyModule_GetDict(mod); } ! if ((mod_dict != NULL) && PyDict_Update(mod_dict, dict)) Py_DECREF(mod); return mod; _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 20:13:44 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 20:13:44 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/pickling safe_pickle.c, 1.3, 1.4 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/pickling In directory centera.de:/tmp/cvs-serv7009/Stackless/pickling Modified Files: safe_pickle.c Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: safe_pickle.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/pickling/safe_pickle.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** safe_pickle.c 24 Apr 2004 23:29:39 -0000 1.3 --- safe_pickle.c 29 Apr 2004 18:13:42 -0000 1.4 *************** *** 4,8 **** #include "compile.h" ! #include "stackless_impl.h" /* safe pickling */ --- 4,8 ---- #include "compile.h" ! #include "core/stackless_impl.h" /* safe pickling */ _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 04:41:24 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 04:41:24 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless channelobject.c, 1.42, 1.43 prickelpit.c, 1.69, 1.70 scheduling.c, 1.90, 1.91 stacklesseval.c, 1.142, 1.143 stacklessmodule.c, 1.166, 1.167 taskletobject.c, 1.108, 1.109 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless In directory centera.de:/tmp/cvs-serv17468/dev/Stackless Modified Files: channelobject.c prickelpit.c scheduling.c stacklesseval.c stacklessmodule.c taskletobject.c Log Message: lots of bug fixes. unittests/runAll.py now finishes without any additional refcouints. Did a lot of bug fixes due to the new, more explicit protocol. Fixed pickling for dict iterators (Ippolito bug). Fixed generator pickling (Tismer bug). Fixed autoscheduling (Tismer bug). Index: channelobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/channelobject.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** channelobject.c 24 Apr 2004 23:29:39 -0000 1.42 --- channelobject.c 29 Apr 2004 02:41:22 -0000 1.43 *************** *** 349,356 **** NOTIFY_SEND(self, sender, 0, NULL); ! retval = Py_None; ! Py_INCREF(retval); ! ! return slp_schedule_task(sender, receiver, 1, retval); } else { --- 349,353 ---- NOTIFY_SEND(self, sender, 0, NULL); ! return slp_schedule_task(sender, receiver, 1, Py_None); } else { *************** *** 366,370 **** slp_channel_insert(self, sender, 1); NOTIFY_SEND(self, sender, 1, NULL); - Py_INCREF(arg); receiver = ts->st.current; --- 363,366 ---- *************** *** 421,426 **** sender->tempval = NULL; - Py_INCREF(Py_None); - return slp_schedule_task(sender, receiver, 0, Py_None); } --- 417,420 ---- *************** *** 443,447 **** sender->tempval = NULL; - Py_INCREF(arg); receiver = ts->st.current; --- 437,440 ---- *************** *** 715,720 **** sender->flags.blocked = 0; result = sender->tempval; - sender->tempval = Py_None; Py_INCREF(Py_None); /* move sender to the end of runnables */ slp_current_insert(sender); --- 708,713 ---- sender->flags.blocked = 0; result = sender->tempval; Py_INCREF(Py_None); + sender->tempval = Py_None; /* move sender to the end of runnables */ slp_current_insert(sender); *************** *** 802,807 **** NOTIFY_RECV(self, receiver, 0, NULL); result = sender->tempval; - sender->tempval = Py_None; Py_INCREF(Py_None); /* move sender to the end of runnables */ slp_current_insert(sender); --- 795,800 ---- NOTIFY_RECV(self, receiver, 0, NULL); result = sender->tempval; Py_INCREF(Py_None); + sender->tempval = Py_None; /* move sender to the end of runnables */ slp_current_insert(sender); Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/prickelpit.c,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** prickelpit.c 24 Apr 2004 23:29:39 -0000 1.69 --- prickelpit.c 29 Apr 2004 02:41:22 -0000 1.70 *************** *** 44,47 **** --- 44,58 ---- } + static int + generic_init(PyObject *ob, PyObject *args, PyObject *kwds) + { + + initproc init = ob->ob_type->tp_base->tp_init; + + if (init) + return init(ob, args, kwds); + return 0; + } + static PyObject * generic_setstate(PyObject *self, PyObject *args) *************** *** 53,57 **** } ! /* just in case that setstate is not called, we need to protect* */ static void --- 64,95 ---- } ! /* redirecting cls.__new__ */ ! ! static PyObject * ! _new_wrapper(PyObject *self, PyObject *args, PyObject *kwds) ! { ! PyTypeObject *type; ! PyObject *newfunc, *res = NULL; ! ! if (self == NULL || !PyType_Check(self)) ! Py_FatalError("__new__() called with non-type 'self'"); ! type = (PyTypeObject *)self; ! if (!PyTuple_Check(args) || PyTuple_GET_SIZE(args) < 1) { ! PyErr_Format(PyExc_TypeError, ! "%s.__new__(): not enough arguments", ! type->tp_name); ! return NULL; ! } ! if (is_wrong_type(type)) return NULL; ! ! newfunc = PyObject_GetAttrString((PyObject *) type->tp_base, "__new__"); ! if (newfunc != NULL) { ! res = PyObject_Call(newfunc, args, kwds); ! Py_DECREF(newfunc); ! } ! return res; ! } ! ! /* just in case that setstate gets not called, we need to protect* */ static void *************** *** 87,92 **** \ static PyMethodDef prefix##_methods[] = { \ ! {"__reduce__", (PyCFunction)reduce, METH_NOARGS, NULL}, \ ! {"__setstate__", (PyCFunction)setstate, METH_O, NULL}, \ {NULL, NULL} \ }; \ --- 125,133 ---- \ static PyMethodDef prefix##_methods[] = { \ ! {"__reduce__", (PyCFunction)reduce, METH_NOARGS, NULL}, \ ! {"__setstate__", (PyCFunction)setstate, METH_O, NULL}, \ ! {"__new__", (PyCFunction)_new_wrapper, METH_KEYWORDS, \ ! PyDoc_STR("wwwwwaaaaaT.__new__(S, ...) -> " \ ! "a new object with type S, a subtype of T")}, \ {NULL, NULL} \ }; \ *************** *** 129,133 **** 0, /* tp_descr_set */ \ 0, /* tp_dictoffset */ \ ! 0, /* tp_init */ \ 0, /* tp_alloc */ \ newfunc, /* tp_new */ \ --- 170,174 ---- 0, /* tp_descr_set */ \ 0, /* tp_dictoffset */ \ ! generic_init, /* tp_init */ \ 0, /* tp_alloc */ \ newfunc, /* tp_new */ \ *************** *** 135,148 **** }; - static PyObject *builtins = NULL; - static PyObject *import_str = NULL; - static PyObject *types_mod = NULL; static PyObject *pickle_reg = NULL; static int init_type(PyTypeObject *t) { ! PyMethodDescrObject *meth; ! PyObject *args, *retval = NULL; int ret = 0; char *name = strrchr(t->tp_name, '.')+1; --- 176,194 ---- }; static PyObject *types_mod = NULL; static PyObject *pickle_reg = NULL; + static struct PyMethodDef _new_methoddef[] = { + {"__new__", (PyCFunction)_new_wrapper, METH_KEYWORDS, + PyDoc_STR("T.__new__(S, ...) -> " + "a new object with type S, a subtype of T.__base__")}, + {0} + }; + static int init_type(PyTypeObject *t) { ! PyMethodDescrObject *reduce; ! PyWrapperDescrObject *init; ! PyObject *args, *retval = NULL, *func; int ret = 0; char *name = strrchr(t->tp_name, '.')+1; *************** *** 156,166 **** if (PyObject_SetAttrString(types_mod, name, (PyObject *) t)) return -1; ! /* patch the method descriptor to require the base type */ if (PyType_Ready(t)) return -1; ! meth = (PyMethodDescrObject *) PyDict_GetItemString(t->tp_dict, "__reduce__"); ! meth->d_type = t->tp_base; /* register with copy_reg */ ! args = Py_BuildValue("(OO)", t->tp_base, meth); if (pickle_reg != NULL && (retval = PyObject_Call(pickle_reg, args, NULL)) == NULL) --- 202,219 ---- if (PyObject_SetAttrString(types_mod, name, (PyObject *) t)) return -1; ! /* patch the method descriptors to require the base type */ if (PyType_Ready(t)) return -1; ! init = (PyWrapperDescrObject *) PyDict_GetItemString(t->tp_dict, ! "__init__"); ! init->d_type = t->tp_base; ! reduce = (PyMethodDescrObject *) PyDict_GetItemString(t->tp_dict, "__reduce__"); ! reduce->d_type = t->tp_base; ! /* insert the __new__ replacement which is special */ ! func = PyCFunction_New(_new_methoddef, (PyObject *)t); ! if (func == NULL || PyDict_SetItemString(t->tp_dict, "__new__", func)) ! return -1; /* register with copy_reg */ ! args = Py_BuildValue("(OO)", t->tp_base, reduce); if (pickle_reg != NULL && (retval = PyObject_Call(pickle_reg, args, NULL)) == NULL) *************** *** 171,174 **** --- 224,249 ---- } + /* helper to execute a bit of code which simplifies things */ + + static PyObject * + run_script(char *src, char *retname) + { + PyObject *globals = PyDict_New(); + PyObject *retval; + + if (globals == NULL) + return NULL; + if (PyDict_SetItemString(globals, "__builtins__", + PyEval_GetBuiltins()) != 0) + return NULL; + retval = PyRun_String(src, Py_file_input, globals, globals); + if (retval != NULL) { + Py_DECREF(retval); + retval = PyMapping_GetItemString(globals, retname); + } + Py_DECREF(globals); + return retval; + } + /****************************************************** *************** *** 722,733 **** PyFrameObject *f; PyCodeObject *f_code; ! PyObject *dict = PyImport_GetModuleDict(); if (is_wrong_type(type)) return NULL; if (!PyArg_ParseTuple(args, frametuplenewfmt, &PyCode_Type, &f_code)) return NULL; ! f = PyFrame_New (ts, (PyCodeObject *) f_code, dict, dict); if (f != NULL) f->ob_type = &wrap_PyFrame_Type; return (PyObject *) f; } --- 797,818 ---- PyFrameObject *f; PyCodeObject *f_code; ! PyObject *globals; if (is_wrong_type(type)) return NULL; if (!PyArg_ParseTuple(args, frametuplenewfmt, &PyCode_Type, &f_code)) return NULL; ! if (ts->frame != NULL && PyFrame_Check(ts->frame)) { ! globals = ts->frame->f_globals; ! Py_INCREF(globals); ! } ! else ! globals = Py_BuildValue("{sO}", "__builtins__", ! PyEval_GetBuiltins()); ! if (globals == NULL) ! return NULL; ! f = PyFrame_New(ts, (PyCodeObject *) f_code, globals, globals); if (f != NULL) f->ob_type = &wrap_PyFrame_Type; + Py_DECREF(globals); return (PyObject *) f; } *************** *** 1042,1049 **** module_reduce(PyObject * m) { ! PyObject *globals = NULL; ! PyObject *import = NULL; PyObject *modules = PyImport_GetModuleDict(); - PyObject *tup = NULL; char *name = PyModule_GetName(m); --- 1127,1132 ---- module_reduce(PyObject * m) { ! static PyObject *import = NULL; PyObject *modules = PyImport_GetModuleDict(); char *name = PyModule_GetName(m); *************** *** 1052,1104 **** /* is this module maybe not imported? */ if (PyDict_GetItemString(modules, name) == NULL) ! return Py_BuildValue("(O(sO)())", &wrap_PyModule_Type, PyModule_GetName(m), PyModule_GetDict(m)); ! globals = PyEval_GetGlobals(); ! if (globals != NULL) { ! Py_INCREF(globals); ! } ! ! /* Get the __import__ function from the builtins */ ! if (PyDict_Check(builtins)) { ! import = PyDict_GetItem(builtins, import_str); if (import == NULL) ! PyErr_SetObject(PyExc_KeyError, import_str); ! else ! Py_INCREF(import); } ! else ! import = PyObject_GetAttr(builtins, import_str); ! if (import == NULL) ! goto err; ! ! tup = Py_BuildValue("(O(s))", import, name); ! /* this would be *much* shorter, but the search result is quite arbitrary ! tup = PyObject_GetAttrString(m, "__name__"); ! */ ! err: ! Py_XDECREF(globals); ! Py_XDECREF(import); ! return tup; } static PyObject * module_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! PyObject *mod, *mod_dict = NULL, *dict; char *name; if (is_wrong_type(type)) return NULL; ! if (!PyArg_ParseTuple(args, "sO!", &name, &PyDict_Type, &dict)) return NULL; mod = PyModule_New(name); ! if (mod != NULL) { ! mod->ob_type = type; mod_dict = PyModule_GetDict(mod); ! } ! if (mod_dict != NULL && PyDict_Update(mod_dict, dict)) { Py_DECREF(mod); } return mod; --- 1135,1186 ---- /* is this module maybe not imported? */ if (PyDict_GetItemString(modules, name) == NULL) ! return Py_BuildValue("(O(s)O)", &wrap_PyModule_Type, PyModule_GetName(m), PyModule_GetDict(m)); ! if (import == NULL) { ! import = run_script("ret = __import__", "ret"); if (import == NULL) ! return NULL; } ! return Py_BuildValue("(O(s))", import, name); ! /* would be shorter, but the search result is quite arbitrary: ! tup = PyObject_GetAttrString(m, "__name__"); ! */ } + typedef struct { + PyObject_HEAD + PyObject *md_dict; + } PyModuleObject; + static PyObject * module_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! PyObject *mod, *mod_dict = NULL, *dict = NULL; char *name; if (is_wrong_type(type)) return NULL; ! ! /* ! * This is a funny case, like "int(derivednumber)". Instead of creating ! * a module, we have to produce its name string, instead, since this is ! * the way to create a fresh basic module: ! */ ! if (PyTuple_GET_SIZE(args) == 1 && ! PyModule_Check(PyTuple_GET_ITEM(args, 0)) ) { ! mod = PyTuple_GET_ITEM(args, 0); ! return PyObject_GetAttrString(mod, "__name__"); ! } ! else if (!PyArg_ParseTuple(args, "s|O!:module", &name, ! &PyDict_Type, &dict)) return NULL; mod = PyModule_New(name); ! if (mod != NULL) mod_dict = PyModule_GetDict(mod); ! if (mod_dict && dict && PyDict_Update(mod_dict, dict)) { Py_DECREF(mod); + mod = NULL; } return mod; *************** *** 1228,1232 **** self = Py_None; if (clas == NULL) ! fmt = "(O(OO))"; tup = Py_BuildValue(fmt, &wrap_PyMethod_Type, func, self, clas); return tup; --- 1310,1314 ---- self = Py_None; if (clas == NULL) ! fmt = "(O(OO)())"; tup = Py_BuildValue(fmt, &wrap_PyMethod_Type, func, self, clas); return tup; *************** *** 1301,1304 **** --- 1383,1387 ---- return NULL; } + Py_DECREF(res); } } *************** *** 1862,1865 **** --- 1945,1949 ---- } else { + PyObject *builtins = PyEval_GetBuiltins(); PyObject *getattr = PyDict_GetItemString(builtins, "getattr"); if (getattr == NULL) goto finally; *************** *** 1913,1922 **** pickle_reg = PyObject_GetAttrString(copy_reg, "pickle"); } - builtins = PyEval_GetBuiltins(); - if (builtins == NULL) - return -1; - import_str = PyString_InternFromString("__import__"); - if (import_str == NULL) - return -1; PyErr_Clear(); if (0 --- 1997,2000 ---- Index: scheduling.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/scheduling.c,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** scheduling.c 24 Apr 2004 23:29:39 -0000 1.90 --- scheduling.c 29 Apr 2004 02:41:22 -0000 1.91 *************** *** 131,136 **** PyCStackObject **cstprev; ! if (next == prev) return retval; /* stackless != 0 => try soft. stackless < 0 => don't hard switch */ --- 131,138 ---- PyCStackObject **cstprev; ! if (next == prev) { ! Py_XINCREF(retval); return retval; + } /* stackless != 0 => try soft. stackless < 0 => don't hard switch */ *************** *** 153,156 **** --- 155,159 ---- prev->f.frame = ts->frame; assert(prev->tempval == NULL); + Py_XINCREF(retval); prev->tempval = retval; cstprev = &prev->cstate; *************** *** 239,248 **** * we check if we can do a non-recursive transfer. * ! * retval == 0 --> can't do it ! * retval == 1 --> ready to take off ! * retval == -1 --> exception occoured ! * ! * In order to save stack space, we don't call ! * the stack switch, but leave it to the caller. */ --- 242,248 ---- * we check if we can do a non-recursive transfer. * ! * retval == retval --> can't do it ! * retval == wrapped retval --> ready to take off ! * retval == NULL --> exception occoured */ *************** *** 252,258 **** return retval; /* we can't handle escape from a channel with soft switching, yet */ ! if (next->flags.blocked) { ! return 0; ! } ts->st.ticker = ts->st.interval; --- 252,257 ---- return retval; /* we can't handle escape from a channel with soft switching, yet */ ! if (next->flags.blocked) ! return retval; ts->st.ticker = ts->st.interval; *************** *** 262,265 **** --- 261,265 ---- prev->flags = ts->st.flags; assert(prev->tempval == NULL); + Py_XINCREF(retval); prev->tempval = retval; if (prev->cstate != ts->st.initial_stub) { *************** *** 289,292 **** --- 289,293 ---- prev->f.frame = ts->frame; } + if (next->topframe != NULL && next->topframe->f_back == NULL) { /* this is a new tasklet. Provide the runner */ Index: stacklesseval.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklesseval.c,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** stacklesseval.c 25 Apr 2004 03:09:02 -0000 1.142 --- stacklesseval.c 29 Apr 2004 02:41:22 -0000 1.143 *************** *** 418,422 **** return NULL; } - /* initialize pickling of running generators */ if (!initialized) { --- 418,421 ---- *************** *** 479,482 **** --- 478,485 ---- retval = Py_None; f->f_execute = PyEval_EvalFrame; + + /* make refcount compatible to frames for tasklet unpickling */ + Py_INCREF(f->f_back); + Py_INCREF(gen); ((gen_callback_frame *) f->f_back)->gen = gen; *************** *** 494,498 **** --- 497,504 ---- gen_callback_frame *gcf = (gen_callback_frame*) f; genobject *gen = gcf->gen; + gen->gi_running = 0; + /* make refcount compatible to frames for tasklet unpickling */ + Py_DECREF(f); /* Don't keep the reference to f_back any longer than necessary. It *************** *** 638,645 **** indicates that a different frame will be run. Semantics of an appearing Py_UnwindToken: ! The true return value is in its tempval field. ! We always use the topmost tstate frame and bail out when we see the frame that issued the ! originating dispatcher call (which may be a NULL frame). */ --- 644,651 ---- indicates that a different frame will be run. Semantics of an appearing Py_UnwindToken: ! The true return value is in its tempval field. ! We always use the topmost tstate frame and bail out when we see the frame that issued the ! originating dispatcher call (which may be a NULL frame). */ Index: stacklessmodule.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/stacklessmodule.c,v retrieving revision 1.166 retrieving revision 1.167 diff -C2 -d -r1.166 -r1.167 *** stacklessmodule.c 24 Apr 2004 23:29:39 -0000 1.166 --- stacklessmodule.c 29 Apr 2004 02:41:22 -0000 1.167 *************** *** 57,66 **** PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *prev = ts->st.current, *next = prev->next; if (ts->st.main == NULL) return PyStackless_Schedule_M(retval, remove); ! if (remove && do_remove_current()) ! return NULL; ! Py_INCREF(retval); ! return slp_schedule_task(prev, next, stackless, retval); } --- 57,77 ---- PyThreadState *ts = PyThreadState_GET(); PyTaskletObject *prev = ts->st.current, *next = prev->next; + PyObject *ret = NULL; if (ts->st.main == NULL) return PyStackless_Schedule_M(retval, remove); ! Py_XINCREF(retval); /* could be current */ ! if (remove) { ! if (do_remove_current()) ! goto final; ! if (prev == next) { ! /* main has been revived */ ! next = ts->st.current; ! assert(next == ts->st.main); ! } ! } ! ret = slp_schedule_task(prev, next, stackless, retval); ! final: ! Py_XDECREF(retval); ! return ret; } *************** *** 188,192 **** interrupt_timeout_return(void) { - PyObject *retval; PyThreadState *ts = PyThreadState_GET(); --- 199,202 ---- *************** *** 199,203 **** ts->st.ticker = ts->st.interval; ts->st.flags.pending_irq = 1; ! Py_INCREF(Py_None); return Py_None; } --- 209,213 ---- ts->st.ticker = ts->st.interval; ts->st.flags.pending_irq = 1; ! /* no incref, just a flag */ return Py_None; } *************** *** 207,214 **** Py_INCREF(ts->st.main); slp_current_insert(ts->st.main); - retval = Py_None; - Py_INCREF(retval); ! return slp_schedule_task(ts->st.current, ts->st.main, 1, retval); } --- 217,222 ---- Py_INCREF(ts->st.main); slp_current_insert(ts->st.main); ! return slp_schedule_task(ts->st.current, ts->st.main, 1, Py_None); } *************** *** 248,255 **** slp_current_remove(); Py_DECREF(ts->st.main); /* now let them run until the end. */ retval = slp_schedule_task(ts->st.main, ts->st.current, 0, ! retval); ts->st.interrupt = NULL; --- 256,264 ---- slp_current_remove(); Py_DECREF(ts->st.main); + Py_DECREF(retval); /* now let them run until the end. */ retval = slp_schedule_task(ts->st.main, ts->st.current, 0, ! Py_None); ts->st.interrupt = NULL; *************** *** 665,669 **** static char _get_refinfo__doc__[] = ! "_get_refinfo -- return (maximum referenced object, refcount, ref_total, computed total)"; extern PyObject * _Py_RefChain; --- 674,679 ---- static char _get_refinfo__doc__[] = ! "_get_refinfo -- return (maximum referenced object,\n" ! "refcount, ref_total, computed total)"; extern PyObject * _Py_RefChain; *************** *** 685,688 **** --- 695,717 ---- } + static char _get_all_objects__doc__[] = + "_get_all_objects -- return a list with all objects but the list."; + + static PyObject * + _get_all_objects(PyObject *self) + { + PyObject *lis, *ob; + lis = PyList_New(0); + if (lis) { + ob = lis->_ob_next; + while (ob != lis && ob->ob_type != NULL) { + if (PyList_Append(lis, ob)) + return NULL; + ob = ob->_ob_next; + } + } + return lis; + } + #endif *************** *** 726,729 **** --- 755,760 ---- {"_get_refinfo", (PCF)_get_refinfo, METH_NOARGS, _get_refinfo__doc__}, + {"_get_all_objects", (PCF)_get_all_objects, METH_NOARGS, + _get_all_objects__doc__}, #endif {"__reduce__", (PCF)slpmodule_reduce, METH_NOARGS, NULL}, Index: taskletobject.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/taskletobject.c,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** taskletobject.c 24 Apr 2004 23:29:39 -0000 1.108 --- taskletobject.c 29 Apr 2004 02:41:22 -0000 1.109 *************** *** 155,159 **** PyObject *_hold = (PyObject *) x; \ x = NULL; \ ! Py_DECREF(_hold); \ } /* --- 155,159 ---- PyObject *_hold = (PyObject *) x; \ x = NULL; \ ! Py_XDECREF(_hold); \ } /* *************** *** 164,169 **** kill_finally(t); t->topframe = NULL; - ZAP(t->f.frame); } ZAP(t->tempval); /* unlink task from cstate */ --- 164,169 ---- kill_finally(t); t->topframe = NULL; } + ZAP(t->f.frame); ZAP(t->tempval); /* unlink task from cstate */ *************** *** 233,242 **** t->f.frame = NULL; t->topframe = NULL; t->tempval = func; t->tsk_weakreflist = NULL; } - Py_XINCREF(func); - t->cstate = ts->st.initial_stub; - Py_INCREF(t->cstate); return t; } --- 233,242 ---- t->f.frame = NULL; t->topframe = NULL; + Py_XINCREF(func); t->tempval = func; t->tsk_weakreflist = NULL; + Py_INCREF(ts->st.initial_stub); + t->cstate = ts->st.initial_stub; } return t; } *************** *** 407,411 **** /* * we count running frames which *have* added ! *to recursion_depth */ ++t->recursion_depth; --- 407,411 ---- /* * we count running frames which *have* added ! * to recursion_depth */ ++t->recursion_depth; *************** *** 577,581 **** if (PyTasklet_Insert(task)) return NULL; - Py_INCREF(retval); return slp_schedule_task(ts->st.current, task, stackless, retval); } --- 577,580 ---- *************** *** 793,799 **** { PyThreadState *ts = PyThreadState_GET(); ts->frame = f->f_back; ! return PyStackless_Schedule_nr(retval, 1); } --- 792,809 ---- { PyThreadState *ts = PyThreadState_GET(); + PyTaskletObject *parent = ts->st.current; + PyTaskletObject *self = parent->prev; + PyObject *ret; ts->frame = f->f_back; ! Py_DECREF(f); ! ! slp_current_remove(); /* reference used in tempval */ ! Py_XDECREF(self->tempval); ! self->tempval = (PyObject *) parent; ! ret = slp_schedule_task(parent, self, 1, retval); ! /* a value that we must consume */ ! Py_DECREF(retval); ! return ret; } *************** *** 934,938 **** PyThreadState *ts = PyThreadState_GET(); PyObject *tb = NULL; - PyObject *retval; if (ts->st.main == NULL) --- 944,947 ---- *************** *** 977,984 **** self->tempval = NULL; } - Py_INCREF(Py_None); - retval = Py_None; ! return slp_schedule_task(ts->st.current, self, stackless, retval); } --- 986,991 ---- self->tempval = NULL; } ! return slp_schedule_task(ts->st.current, self, stackless, Py_None); } _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Sun Apr 18 21:51:29 2004 From: tismer at centera.de (Christian Tismer) Date: Sun, 18 Apr 2004 21:51:29 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/PCbuild pythoncore.dsp, 1.54, 1.55 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/PCbuild In directory centera.de:/tmp/cvs-serv4029/dev/PCbuild Modified Files: pythoncore.dsp Log Message: a first shot at safe pickling, see the new file safe_pickle.c Index: pythoncore.dsp =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/PCbuild/pythoncore.dsp,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** pythoncore.dsp 18 Apr 2004 14:07:33 -0000 1.54 --- pythoncore.dsp 18 Apr 2004 19:51:27 -0000 1.55 *************** *** 125,128 **** --- 125,132 ---- # Begin Source File + SOURCE=..\Stackless\safe_pickle.c + # End Source File + # Begin Source File + SOURCE=..\Stackless\scheduling.c # End Source File _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:32:42 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:32:42 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/module - New directory Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/module In directory centera.de:/tmp/cvs-serv4838/module Log Message: Directory /home/cvs/slpdev/src/2.3/dev/Stackless/module added to the repository _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins From tismer at centera.de Thu Apr 29 19:59:01 2004 From: tismer at centera.de (Christian Tismer) Date: Thu, 29 Apr 2004 19:59:01 +0200 Subject: [Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/pickling prickelpit.c, 1.70, 1.71 Message-ID: Update of /home/cvs/slpdev/src/2.3/dev/Stackless/pickling In directory centera.de:/tmp/cvs-serv5382/Stackless/pickling Modified Files: prickelpit.c Log Message: broke the stackless files into logical groups, like in the MSVC folders. Index: prickelpit.c =================================================================== RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/pickling/prickelpit.c,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** prickelpit.c 29 Apr 2004 02:41:22 -0000 1.70 --- prickelpit.c 29 Apr 2004 17:58:59 -0000 1.71 *************** *** 4,12 **** #include "compile.h" ! #include "stackless_impl.h" ! #include "prickelpit.h" /* platform specific constants */ ! #include "slp_platformselect.h" /****************************************************** --- 4,12 ---- #include "compile.h" ! #include "core/stackless_impl.h" ! #include "pickling/prickelpit.h" /* platform specific constants */ ! #include "platf/slp_platformselect.h" /****************************************************** _______________________________________________ Stackless-checkins mailing list Stackless-checkins at stackless.com http://www.stackless.com/mailman/listinfo/stackless-checkins