Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Replace Stackless hard switching with libteatet #279

Draft
wants to merge 37 commits into
base: 2.7-slp
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b3fac7b
Add the tealet project to the file structure
kristjanvalur Jun 2, 2013
9a80a79
Initial replacement of switching. Remove CState structure.
kristjanvalur Jul 8, 2013
83a6b7f
Initial running version
kristjanvalur Jul 8, 2013
c6201ff
Now runs testsuite but fails in test-external
kristjanvalur Jul 9, 2013
750a1e7
Clear del_post_switch in the new taskelt stub.
kristjanvalur Jul 10, 2013
a13f6e5
Fix PyTasklet_New_M
kristjanvalur Jul 19, 2013
79af2ab
don't treat cstate/initial stub as PyObjects
kristjanvalur Jul 19, 2013
bee3bf2
Fix the tealet model.
kristjanvalur Jul 19, 2013
ca37c6e
Fix unittests to run. Correcly assert relatedness.
kristjanvalur Jul 19, 2013
896f9fb
PyTasklet_New_M is no longer needed.
kristjanvalur Jul 19, 2013
ddaa211
Add feature to allocate extra data to tealets by giving an extra size.
kristjanvalur Jul 20, 2013
73398f6
rename struct _tasklet to struct PyTaskletObject.
kristjanvalur Jul 20, 2013
082c272
Reorganize. Put the tealet switching code into stackless_tealet.c/.h
kristjanvalur Jul 20, 2013
c366b48
Make the running of the stub from main explicit about setting the 'main'
kristjanvalur Jul 20, 2013
cba21c7
Fix handling of extra_data (and id) when duplicating tealets
kristjanvalur Jul 21, 2013
d176dca
Link susptended tasklet tealets in a chain.
kristjanvalur Jul 21, 2013
3ae9c9f
fix slp_kill_tasks_with_stacks()
kristjanvalur Jul 21, 2013
1add5d3
clean up unused stuff.
kristjanvalur Jul 21, 2013
ffcb696
Remove the platf/ files from the solution, and from being included.
kristjanvalur Jul 21, 2013
29394d7
Clean up tealet state when python thread state is cleared.
kristjanvalur Jul 21, 2013
781bb42
Clean up initial stub for test_outside()
kristjanvalur Jul 21, 2013
440a93d
Fix 'runcount' during tasklet kill and cleanup.
kristjanvalur Jul 22, 2013
04cf382
Don't recreate a 'stub' every time stackless is entered, just keep th…
kristjanvalur Jul 29, 2013
4abd89c
Add stack arithmetic support to tealets, to measure stack pos.
kristjanvalur Jul 29, 2013
3098540
Re-implement stack spilling for pickling.
kristjanvalur Jul 29, 2013
9694d49
Re-enable stack spilling for eval loop.
kristjanvalur Jul 29, 2013
e924909
Recreate initial stub if found higher on the stack.
kristjanvalur Jul 29, 2013
5a01335
Change a todo comment.
kristjanvalur Jul 29, 2013
7bb7ab6
Minor cleanup
kristjanvalur Jul 29, 2013
627c5f6
Remove the old "platf" directory.
kristjanvalur Jul 29, 2013
561f49a
Create new branch
kristjanvalur Jul 29, 2013
fadd0f3
Merge with 2.7-slp
kristjanvalur Jul 29, 2013
d5d606a
fix incorrect merge
kristjanvalur Jul 29, 2013
2f8941a
Simplify the main tasklet handling. Instead of having to deal with
kristjanvalur Aug 18, 2013
a5896de
Merge with 2.7-slp
kristjanvalur Sep 3, 2013
5e05326
Cosmetic cleanup after merge
kristjanvalur Sep 3, 2013
acdc044
Fix merge. Tasklet's thread state is now in task->tstate
kristjanvalur Sep 3, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Modules/cPickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "cStringIO.h"
#include "structmember.h"
#include "core/stackless_impl.h"
#include "platf/slp_platformselect.h"

PyDoc_STRVAR(cPickle_module_documentation,
"C implementation and optimization of the Python pickle module.");
Expand Down Expand Up @@ -2571,9 +2570,9 @@ save(Picklerobject *self, PyObject *args, int pers_save)
int res = -1;
int tmp;

#ifdef STACKLESS
#if defined STACKLESS
/* but we save the stack after a fixed watermark */
if (CSTACK_SAVE_NOW(PyThreadState_GET(), self)) {
if (slp_cstack_save_now(PyThreadState_GET())) {
res = slp_safe_pickling((int(*)(PyObject *, PyObject *, int))&save,
(PyObject *)self, args, pers_save);
goto finally;
Expand Down
153 changes: 78 additions & 75 deletions PCbuild/pythoncore.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
/>
</Platforms>
<ToolFiles>
<DefaultToolFile
FileName="masm.rules"
/>
</ToolFiles>
<Configurations>
<Configuration
Expand All @@ -31,6 +34,9 @@
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
Expand Down Expand Up @@ -105,6 +111,9 @@
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
Expand Down Expand Up @@ -181,6 +190,9 @@
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
Expand Down Expand Up @@ -258,6 +270,9 @@
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
Expand Down Expand Up @@ -336,6 +351,9 @@
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
Expand Down Expand Up @@ -410,6 +428,9 @@
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
Expand Down Expand Up @@ -486,6 +507,9 @@
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
Expand Down Expand Up @@ -560,6 +584,9 @@
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
Expand Down Expand Up @@ -655,11 +682,11 @@
>
</File>
<File
RelativePath="..\Include\bytes_methods.h"
RelativePath="..\Include\bytearrayobject.h"
>
</File>
<File
RelativePath="..\Include\bytearrayobject.h"
RelativePath="..\Include\bytes_methods.h"
>
</File>
<File
Expand Down Expand Up @@ -1411,11 +1438,11 @@
>
</File>
<File
RelativePath="..\Objects\bytes_methods.c"
RelativePath="..\Objects\bytearrayobject.c"
>
</File>
<File
RelativePath="..\Objects\bytearrayobject.c"
RelativePath="..\Objects\bytes_methods.c"
>
</File>
<File
Expand Down Expand Up @@ -1937,10 +1964,6 @@
RelativePath="..\Stackless\core\cframeobject.c"
>
</File>
<File
RelativePath="..\Stackless\core\slp_transfer.c"
>
</File>
<File
RelativePath="..\Stackless\core\stackless_impl.h"
>
Expand All @@ -1954,155 +1977,135 @@
>
</File>
<File
RelativePath="..\Stackless\core\stackless_tstate.h"
RelativePath="..\Stackless\core\stackless_tealet.c"
>
</File>
<File
RelativePath="..\Stackless\core\stackless_util.c"
RelativePath="..\Stackless\core\stackless_tealet.h"
>
</File>
<File
RelativePath="..\Stackless\core\stacklesseval.c"
>
</File>
</Filter>
<Filter
Name="platf"
>
<File
RelativePath="..\Stackless\platf\slp_platformselect.h"
>
</File>
<File
RelativePath="..\Stackless\platf\switch_amd64_unix.h"
RelativePath="..\Stackless\core\stackless_tstate.h"
>
</File>
<File
RelativePath="..\Stackless\platf\switch_arm32_gcc.h"
RelativePath="..\Stackless\core\stackless_util.c"
>
</File>
<File
RelativePath="..\Stackless\platf\switch_arm_thumb_gcc.h"
RelativePath="..\Stackless\core\stacklesseval.c"
>
</File>
</Filter>
<Filter
Name="pickling"
>
<File
RelativePath="..\Stackless\platf\switch_ppc_macosx.h"
RelativePath="..\Stackless\pickling\prickelpit.c"
>
</File>
<File
RelativePath="..\Stackless\platf\switch_ppc_unix.h"
RelativePath="..\Stackless\pickling\prickelpit.h"
>
</File>
<File
RelativePath="..\Stackless\platf\switch_s390_unix.h"
RelativePath="..\Stackless\pickling\safe_pickle.c"
>
</File>
</Filter>
<Filter
Name="tealet"
>
<File
RelativePath="..\Stackless\platf\switch_sparc_sun_gcc.h"
RelativePath="..\Stackless\tealet\slp_platformselect.h"
>
</File>
<File
RelativePath="..\Stackless\platf\switch_x64_masm.asm"
RelativePath="..\Stackless\tealet\switch_x64_msvc.asm"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
Name="MASM"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
Description="Running ml64"
CommandLine="ml64 /nologo /c /Zi /Fo &quot;$(IntDir)\$(InputName) .obj&quot; &quot;$(InputPath)&quot;"
Outputs="$(IntDir)\$(InputName) .obj"
Name="MASM"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="PGInstrument|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
Name="MASM"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="PGUpdate|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
Description="Running ml64"
CommandLine="ml64 /nologo /c /Zi /Fo &quot;$(IntDir)\$(InputName) .obj&quot; &quot;$(InputPath)&quot;"
Outputs="$(IntDir)\$(InputName) .obj"
Name="MASM"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Stackless\tealet\switch_x64_msvc.h"
>
</File>
<File
RelativePath="..\Stackless\tealet\switch_x86_msvc.asm"
>
<FileConfiguration
Name="PGInstrument|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
Name="MASM"
/>
</FileConfiguration>
<FileConfiguration
Name="PGInstrument|x64"
Name="Debug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
Description="Running ml64"
CommandLine="ml64 /nologo /c /Zi /Fo &quot;$(IntDir)\$(InputName) .obj&quot; &quot;$(InputPath)&quot;"
Outputs="$(IntDir)\$(InputName) .obj"
Name="MASM"
/>
</FileConfiguration>
<FileConfiguration
Name="PGUpdate|Win32"
Name="PGInstrument|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
Name="MASM"
/>
</FileConfiguration>
<FileConfiguration
Name="PGUpdate|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
Description="Running ml64"
CommandLine="ml64 /nologo /c /Zi /Fo &quot;$(IntDir)\$(InputName) .obj&quot; &quot;$(InputPath)&quot;"
Outputs="$(IntDir)\$(InputName) .obj"
Name="MASM"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Stackless\platf\switch_x64_msvc.h"
>
</File>
<File
RelativePath="..\Stackless\platf\switch_x86_msvc.h"
>
</File>
<File
RelativePath="..\Stackless\platf\switch_x86_unix.h"
RelativePath="..\Stackless\tealet\switch_x86_msvc.h"
>
</File>
</Filter>
<Filter
Name="pickling"
>
<File
RelativePath="..\Stackless\pickling\prickelpit.c"
RelativePath="..\Stackless\tealet\tealet.c"
>
</File>
<File
RelativePath="..\Stackless\pickling\prickelpit.h"
>
</File>
<File
RelativePath="..\Stackless\pickling\safe_pickle.c"
RelativePath="..\Stackless\tealet\tealet.h"
>
</File>
</Filter>
Expand Down
3 changes: 1 addition & 2 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "opcode.h"
#include "structmember.h"
#include "core/stackless_impl.h"
#include "platf/slp_platformselect.h" /* for stack saving */

#include <ctype.h>

Expand Down Expand Up @@ -906,7 +905,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
return NULL;

#ifdef STACKLESS
if (CSTACK_SAVE_NOW(tstate, f))
if (slp_cstack_save_now(tstate))
return slp_eval_frame_newstack(f, throwflag, retval);

/* push frame */
Expand Down
Loading