URL |
Status |
Linked |
Edit |
PR 2594 |
merged |
eric.snow,
2017-07-05 21:10
|
|
PR 3379 |
merged |
eric.snow,
2017-09-06 04:14
|
|
PR 3397 |
merged |
eric.snow,
2017-09-06 22:31
|
|
PR 3458 |
merged |
eric.snow,
2017-09-08 17:37
|
|
PR 3498 |
merged |
vstinner,
2017-09-11 15:04
|
|
PR 3499 |
merged |
vstinner,
2017-09-11 15:09
|
|
PR 3506 |
merged |
eric.snow,
2017-09-11 22:54
|
|
PR 3507 |
merged |
eric.snow,
2017-09-11 23:08
|
|
PR 3567 |
merged |
eric.snow,
2017-09-14 07:15
|
|
PR 4532 |
merged |
vstinner,
2017-11-23 23:11
|
|
msg297780 - (view) |
Author: Eric Snow (eric.snow) * |
Date: 2017-07-05 20:30 |
CPython's C code makes extensive use of global variables. The globals fall into one of several categories:
* (effectively) constants (incl. static types)
* freelists, caches, and counters
* used exclusively in main or in REPL
* process-global state
* module state
* Python runtime state
Those in the last category are not explicitly organized nor easily discoverable. Among other things, this has an impact on efforts that change the runtime (e.g. my multi-core Python project). To improve the situation I'd like to do the following:
1. group the (stateful) runtime globals into various topical structs
2. consolidate the topical structs under a single top-level _PyRuntimeState struct
3. add a check-c-globals.py script that helps identify runtime globals
One side effect of consolidating these globals is a significant performance improvement of CPython. Presumably this is due to the caching behavior of a single struct vs. that of dozens of separate globals.
I have a patch and will put up a PR momentarily.
|
msg297782 - (view) |
Author: Eric Snow (eric.snow) * |
Date: 2017-07-05 21:12 |
One thing I'd like to also try is to use a freelist embedded in _PyRuntimeState for the PyInterpreterState and PyThreadState linked lists.
|
msg297794 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) * |
Date: 2017-07-06 03:42 |
See also issue29881.
|
msg297848 - (view) |
Author: Antoine Pitrou (pitrou) * |
Date: 2017-07-06 22:08 |
After looking at the PR, I'm a bit skeptical about this. Suddenly a lot of things which are implementation details get moved to the public include files, which makes things more confusing from my POV. I also don't know why all globals should be consolidated in a single place (it is not a widespread policy in other projects AFAIK, but I may be mistaken).
Perhaps it would be more reasonable to consolidate the globals in each .c file independently, without trying to join all of them together in one place nor expose them in the public include files.
|
msg297851 - (view) |
Author: Nick Coghlan (ncoghlan) * |
Date: 2017-07-07 01:59 |
The core motivation driving the original refactoring was to better understand and consolidate our runtime state in order to clarify what the GIL is actually protecting (aside from the reference counts). That then turned out to have surprising performance benefits (presumably by way of loading all of this state permanently into the CPU cache and then keeping it there).
The changes to the public include files arise more from the fact we don't currently have a common place to put internal CPython headers for declarations we want to share across compilation modules.
I agree the latter is confusing, and it could be worth having a separate "Include/internal/CPython.h" header that outright failed the build if you attempted to include it without Py_BUILD_CORE set.
(This also ties into my comments on the PR, where I believe the current approach of mixing public and private state in the same structs will cause problems with compilers generating incorrect field offsets in extension modules and embedding applications)
|
msg301428 - (view) |
Author: Eric Snow (eric.snow) * |
Date: 2017-09-06 01:26 |
New changeset 76d5abc8684bac4f2fc7cccfe2cd940923357351 by Eric Snow in branch 'master':
bpo-30860: Consolidate stateful runtime globals. (#2594)
https://github.com/python/cpython/commit/76d5abc8684bac4f2fc7cccfe2cd940923357351
|
msg301435 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2017-09-06 03:06 |
Sadly, Windows doesn't like much your big change.
Just one example:
2>C:\buildbot.python.org\3.x.kloth-win64\build\Include\Python-ast.h(563): warning C4005: 'Yield': macro redefinition [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\pythoncore.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\um\winbase.h(97): note: see previous definition of 'Yield'
bltinmodule.c
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/954/steps/compile/logs/stdio
|
msg301436 - (view) |
Author: Benjamin Peterson (benjamin.peterson) * |
Date: 2017-09-06 03:37 |
I'm also a bit skeptical about the header design in this PR. We should not to have a monolithic _Python.h header, and it should not be sometimes included in Python.h. Rather, code that needs the internal headers should include them directly. In fact, this PR regresses that by moving all the internal headers into Include/...
|
msg301438 - (view) |
Author: Eric Snow (eric.snow) * |
Date: 2017-09-06 04:43 |
New changeset 05351c1bd8b70d1878527762174cdaaba3572395 by Eric Snow in branch 'master':
Revert "bpo-30860: Consolidate stateful runtime globals." (#3379)
https://github.com/python/cpython/commit/05351c1bd8b70d1878527762174cdaaba3572395
|
msg301599 - (view) |
Author: Nick Coghlan (ncoghlan) * |
Date: 2017-09-07 17:58 |
Regarding the accidental exposure of _Py_CheckRecursionLimit, the main active usage of the stable ABI that we're aware of is Riverbank's C/C++ binding generator for PyQt: http://pyqt.sourceforge.net/Docs/sip4/directives.html#directive-%Module (see the use_limited_api option for the linked directive)
I checked with Phil Thomson (sip's maintainer), and the bindings sip generates don't use either of the public macros that access this nominally private value.
|
msg301679 - (view) |
Author: Eric Snow (eric.snow) * |
Date: 2017-09-08 05:51 |
New changeset 2ebc5ce42a8a9e047e790aefbf9a94811569b2b6 by Eric Snow in branch 'master':
bpo-30860: Consolidate stateful runtime globals. (#3397)
https://github.com/python/cpython/commit/2ebc5ce42a8a9e047e790aefbf9a94811569b2b6
|
msg301735 - (view) |
Author: Eric Snow (eric.snow) * |
Date: 2017-09-08 21:27 |
FYI, the merged code introduced a bunch of new warnings on Windows. I'm looking into it.
|
msg301884 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2017-09-11 16:31 |
The commit 2ebc5ce42a8a9e047e790aefbf9a94811569b2b6 introduced reference leaks: see bpo-31420 which tracks them.
|
msg301885 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2017-09-11 16:34 |
New changeset 4866957e86594935ec2e6434b6e470ebeb0c79b4 by Victor Stinner in branch 'master':
bpo-30860: Add Include/internal/ in "make tags" (#3498)
https://github.com/python/cpython/commit/4866957e86594935ec2e6434b6e470ebeb0c79b4
|
msg301927 - (view) |
Author: Eric Snow (eric.snow) * |
Date: 2017-09-12 00:02 |
New changeset ba6d5d1defd7a281c8c8804e4b4cfd7370886236 by Eric Snow in branch 'master':
bpo-30860: Always provide serialno. (#3507)
https://github.com/python/cpython/commit/ba6d5d1defd7a281c8c8804e4b4cfd7370886236
|
msg301931 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2017-09-12 00:59 |
New changeset 8728018624f257c7cfe44014742ae46134047f49 by Victor Stinner (Eric Snow) in branch 'master':
bpo-30860: Fix a refleak. (#3506)
https://github.com/python/cpython/commit/8728018624f257c7cfe44014742ae46134047f49
|
msg301935 - (view) |
Author: Eric Snow (eric.snow) * |
Date: 2017-09-12 01:30 |
New changeset fc1bf872e9d31f3e837f686210f94e57ad3d6582 by Eric Snow in branch 'master':
bpo-30860: Move windows.h include out of internal/*.h. (#3458)
https://github.com/python/cpython/commit/fc1bf872e9d31f3e837f686210f94e57ad3d6582
|
msg302153 - (view) |
Author: Eric Snow (eric.snow) * |
Date: 2017-09-14 07:35 |
New changeset dae0276bb6bc7281d59fb0b8f1aab31634ee80dc by Eric Snow in branch 'master':
bpo-30860: Fix a refleak. (#3567)
https://github.com/python/cpython/commit/dae0276bb6bc7281d59fb0b8f1aab31634ee80dc
|
msg302216 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2017-09-14 21:48 |
New changeset ccb3c7654cc3d031fb93bf443a6ef9cfb11f6b43 by Victor Stinner in branch 'master':
bpo-30860: Fix deadcode in obmalloc.c (#3499)
https://github.com/python/cpython/commit/ccb3c7654cc3d031fb93bf443a6ef9cfb11f6b43
|
msg306888 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2017-11-24 11:09 |
New changeset 9e87e7776f7ace66baaf7247233afdabd00c2b44 by Victor Stinner in branch 'master':
bpo-32096: Remove obj and mem from _PyRuntime (#4532)
https://github.com/python/cpython/commit/9e87e7776f7ace66baaf7247233afdabd00c2b44
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:48 | admin | set | github: 75043 |
2017-11-24 11:09:30 | vstinner | set | messages:
+ msg306888 |
2017-11-23 23:11:54 | vstinner | set | pull_requests:
+ pull_request4468 |
2017-09-14 23:57:39 | eric.snow | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
2017-09-14 21:48:39 | vstinner | set | messages:
+ msg302216 |
2017-09-14 07:36:00 | eric.snow | set | messages:
+ msg302153 |
2017-09-14 07:15:42 | eric.snow | set | pull_requests:
+ pull_request3556 |
2017-09-12 01:30:46 | eric.snow | set | messages:
+ msg301935 |
2017-09-12 00:59:24 | vstinner | set | messages:
+ msg301931 |
2017-09-12 00:02:29 | eric.snow | set | messages:
+ msg301927 |
2017-09-11 23:08:44 | eric.snow | set | pull_requests:
+ pull_request3501 |
2017-09-11 22:54:11 | eric.snow | set | pull_requests:
+ pull_request3499 |
2017-09-11 16:34:38 | vstinner | set | messages:
+ msg301885 |
2017-09-11 16:31:25 | vstinner | set | messages:
+ msg301884 |
2017-09-11 15:09:18 | vstinner | set | pull_requests:
+ pull_request3493 |
2017-09-11 15:04:08 | vstinner | set | pull_requests:
+ pull_request3492 |
2017-09-08 21:27:12 | eric.snow | set | messages:
+ msg301735 |
2017-09-08 17:37:06 | eric.snow | set | keywords:
+ patch pull_requests:
+ pull_request3452 |
2017-09-08 05:51:30 | eric.snow | set | messages:
+ msg301679 |
2017-09-07 17:58:21 | ncoghlan | set | messages:
+ msg301599 |
2017-09-06 22:31:03 | eric.snow | set | pull_requests:
+ pull_request3403 |
2017-09-06 04:43:11 | eric.snow | set | messages:
+ msg301438 |
2017-09-06 04:22:25 | eric.snow | set | pull_requests:
- pull_request3387 |
2017-09-06 04:14:37 | eric.snow | set | pull_requests:
+ pull_request3388 |
2017-09-06 04:08:50 | eric.snow | set | pull_requests:
+ pull_request3387 |
2017-09-06 03:37:55 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages:
+ msg301436
|
2017-09-06 03:06:58 | vstinner | set | messages:
+ msg301435 |
2017-09-06 01:26:18 | eric.snow | set | messages:
+ msg301428 |
2017-07-07 01:59:22 | ncoghlan | set | messages:
+ msg297851 |
2017-07-06 22:08:39 | pitrou | set | nosy:
+ pitrou messages:
+ msg297848
|
2017-07-06 13:54:01 | jkloth | set | nosy:
+ jkloth
|
2017-07-06 03:42:10 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages:
+ msg297794
|
2017-07-05 21:12:49 | eric.snow | set | messages:
+ msg297782 |
2017-07-05 21:10:39 | eric.snow | set | pull_requests:
+ pull_request2665 |
2017-07-05 20:30:30 | eric.snow | create | |