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

Stackless issue #283: concentrate platform dependent code in slp_transfer.c and eliminate pycore_slp_platformselect.h #283

Merged

Conversation

akruis
Copy link

@akruis akruis commented Jul 1, 2021

In order to simplify changes of the hard-switching implementation (see #278) I propose to move all platform dependent source
files to Stackless/platf and to concentrate platform specific source code in "Stackless/platf/slp_transfer.c".

Because this source file would be the sole consumer of the header "pycore_slp_platformselect.h" we can also
integrate this header into "slp_transfer.c".

This change has two benefits:

  1. The rest of Stackless is now clean portable C-code.
  2. Stackless-Python provided include files (*.h files below "Include") are no longer platform specific. make install no longer installs platform specific files. Same for Windows packages.

Because of 2) it is no longer a problem to add the source of Stackman or Tealet somewhere below "Stackless/".

This pull request depends on pull request #281 and pull request #282.

Anselm Kruis added 12 commits June 30, 2021 14:31
Per tasklet profiling and tracing state information is no stored in the
tasklet itself. This increases the size of tasklet objects a bit, but
saves a lot of code.
They were removed by the previous commit.
Previously "pycore_slp_platformselect.h" was included by many *.c files
and by "pycore_slp_pystate.h". I try to get rid of most platform
specific code and concentrate the remaining platform specific code
within a single C source "slp_transfer.c".

Current state: work in progress
Decouple the cleanup logic for initial stubs of sub-interpreters from
the stack handling. Previously this logic depended on the value of
SLP_CSTACK_GOODGAP being positive.
slp38-eliminate-platformselect.h
Extract the platform specific stack handling form "slp_eval_frame" into
a new function "slp_cstack_set_base_and_goodgap" in slp_transfer.c.
Move the definition of SLP_DO_NOT_OPTIMIZE_AWAY from pycore_stackless.h
to slp_transfer.c, because it is only used there.
Integrate include "pycore_slp_platformselect.h" into slp_transfer.c and
remove this include.
Move "slp_transfer.c" form "Stackless/core" to "Stackless/platf",
because it depends on the platform.
Move all pycore_slp_switch_*.h includes from Include/internal to
Stackless/platf. These headers are included by "slp_transfer.c" only.
Copy link
Collaborator

@kristjanvalur kristjanvalur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds very sensible.

@akruis akruis merged commit 6a4c86b into stackless-dev:main-slp Jul 9, 2021
akruis pushed a commit that referenced this pull request Jul 11, 2021
The list of Stackless code directories needed an update.
akruis pushed a commit that referenced this pull request Jul 11, 2021
slp_transfer.c and eliminate pycore_slp_platformselect.h

Restore the definition of SLP_CSTACK_MAXCACHE.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants