-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
bpo-45953: Statically allocate the main interpreter (and initial thread state). #29883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ericsnowcurrently
merged 78 commits into
python:main
from
ericsnowcurrently:preallocate-main
Jan 12, 2022
Merged
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
5e6eda9
Return void from _PyEval_InitState().
ericsnowcurrently de12b98
Fix a memory leak.
ericsnowcurrently 035eff3
Move thread-related interpreter state into a sub-struct.
ericsnowcurrently 1569a53
Factor out init_threadstate().
ericsnowcurrently 518e3f3
Do not initialize a thread state if already initialized.
ericsnowcurrently 9995a84
Avoid allocating the first thread state.
ericsnowcurrently f22d0da
Factor out init_interpreter().
ericsnowcurrently cf39d57
Preallocate the main interpreter.
ericsnowcurrently b840213
Add a note about expectations for init_interpreter().
ericsnowcurrently 3bf69b0
Add a NEWS entry.
ericsnowcurrently 4de466e
Add _PyInterpreterState_Main().
ericsnowcurrently 9bb32a6
Fix a check for the main interpreter.
ericsnowcurrently 385f298
Ensure no subinterpreters are created until after the main interprete…
ericsnowcurrently 354997f
Make sure the interpreter is fully initialized.
ericsnowcurrently 9bbf8a0
Use PyMem_RawCalloc() to allocate thread states.
ericsnow
8000
currently 8d1cf35
Make sure the thread state is fully initialized.
ericsnowcurrently 188aed8
Clear the preallocated states when "deleted".
ericsnowcurrently e0da483
Statically initialize the "preallocated" states.
ericsnowcurrently 46c7767
Fix a typo.
ericsnowcurrently 7ca8d1c
Stop memset'ing the statically initialized _PyRuntime.
ericsnowcurrently ed6c273
Fix typos.
ericsnowcurrently 29e1764
Only expose _PyThreadState_INIT in the internal API.
ericsnowcurrently 1a83910
If needed, "statically" initialize the preallocated thread state.
ericsnowcurrently 8631805
Check if _preallocated is initialized when initializing from other.
ericsnowcurrently a0569bb
init_interpreter_from_other -> init_interpreter_static_data.
ericsnowcurrently 4c3c0f9
"Statically" initialize the preallocated thread state.
ericsnowcurrently 47bfa7e
Clear _PyRuntime during finalization.
ericsnowcurrently dd69ffa
Track if interpreter or thread state has been initialized.
ericsnowcurrently ba75803
Zero-out states during re-init instead of fini.
ericsnowcurrently eef3194
Use Py_uintptr_t instead of ssize_t.
ericsnowcurrently 8703297
Add Py*State._initialized.
ericsnowcurrently d1eddad
Factor out init_threadstate().
ericsnowcurrently 8a8150c
Factor out free_threadstate().
ericsnowcurrently 7a37237
Factor out init_interpreter().
ericsnowcurrently b2073ac
Factor out free_interpreter().
ericsnowcurrently 21a522d
Factor out init_runtime().
ericsnowcurrently 7b376d4
Factor out _PyRuntimeState_reset().
ericsnowcurrently 562ee42
Merge branch 'main' into preallocate-main
ericsnowcurrently ed8f5cd
Add _PyInterpreterState_Main().
ericsnowcurrently 6da97b7
Drop an outdated comment.
ericsnowcurrently cf24942
Fix a check for the main interpreter.
ericsnowcurrently fac6af6
Merge branch 'main' into preallocate-main
ericsnowcurrently 4aa2073
Merge branch 'main' into preallocate-main
ericsnowcurrently f135168
Merge branch 'main' into preallocate-main
ericsnowcurrently 2b4ba04
Move *_reset() out of the Include/.
ericsnowcurrently 24d1de2
Pass the parent context to init_*_static_data().
ericsnowcurrently 84ae7db
Drop reset_*() and init_*_static_data().
ericsnowcurrently e9de30c
Drop _Py_global_objects_reset().
ericsnowcurrently 51a32ce
Drop _preallocated.initialized.
ericsnowcurrently 7104518
Drop _preallocated_used.
ericsnowcurrently f7a8389
Drop init of PyThreadState._preallocated for now.
ericsnowcurrently 18080a1
Note what could be pre-allocated.
ericsnowcurrently 0457119
Add Py*State._static.
ericsnowcurrently 923ca7a
Avoid an empty struct.
ericsnowcurrently 99c2ae1
Drop PyInterpreterState._preallocated.initialized.
ericsnowcurrently 3bc73ee
Drop an outdated comment.
ericsnowcurrently c1808ae
8000
code>
Drop outdated comments.
ericsnowcurrently Jan 4, 2022
7b98e59
Clarify what remains to be pre-allocated for _PyRuntimeState.
ericsnowcurrently 0383eae
Explain what _preallocated is for.
ericsnowcurrently c959db0
Clarify why some data isn't pre-allocated.
ericsnowcurrently 5b34b42
Fold _PyThreadState_INIT into _PyInterpreterState_INIT.
ericsnowcurrently 837bfe6
Fold _PyInterpreterState_INIT into _PyRuntimeState_INIT.
ericsnowcurrently ebefa35
Drop PyThreadState._preallocated.
ericsnowcurrently eb7a080
tstate -> initial_thread.
ericsnowcurrently 1ef4a39
Mirror the top-level structure in _preallocated.
ericsnowcurrently 771e574
Merge branch 'main' into preallocate-main
ericsnowcurrently b5c43f1
Clarify some comments.
ericsnowcurrently bfc3906
Fold in _PyRuntimeState._preallocated.
ericsnowcurrently 9b25c8b
Make "initial" const.
ericsnowcurrently e776c31
Fold in PyInterpreterState._preallocated.
ericsnowcurrently c6bda1f
Move the initial thread to the bottom of PyInterpreterState.
ericsnowcurrently 8ab6261
Split up _PyRuntimeState_INIT for less nesting and clutter.
ericsnowcurrently ff8de28
Fix a comment.
ericsnowcurrently b28afb3
Move the main interpreter to the bottom of _PyRuntimeState.
ericsnowcurrently 0d30300
Clarify some comments.
ericsnowcurrently e193794
Add a comment for the _static field.
ericsnowcurrently e9f1262
Move the comments about pre-allocated data down.
ericsnowcurrently a6a6471
Fix a typo.
ericsnowcurrently File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Note what could be pre-allocated.
- Loading branch information
commit 18080a1ca3f8af91b45520b74bbeea3e42990a89
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.