-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
bpo-45696: Deep-freeze #29118
Merged
Merged
bpo-45696: Deep-freeze #29118
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
a04d702
Add placeholders for stdlib modules.
ericsnowcurrently 033acab
Add the frozen stdlib modules.
ericsnowcurrently 0591cbd
Freeze the stdlib modules loaded during startup.
ericsnowcurrently 72666d4
Group the import-related configs.
ericsnowcurrently ce71894
Add the -X frozen_modules CLI option.
ericsnowcurrently ab500e2
Ignore frozen modules depending on "-X frozen_modules".
ericsnowcurrently 932e563
Remember the stdlib dir during startup.
ericsnowcurrently 2bb2a43
First part of deepfreeze
gvanrossum cb6c74d
Add _Py_GetMainConfig().
ericsnowcurrently e94240e
Let _Py_GetStdlibDir() fall back to a config.
ericsnowcurrently e106e41
Add _PyConfig_InitImportConfig().
ericsnowcurrently 80506bb
Identify whether or not the executed is running installed.
ericsnowcurrently 9ac5b11
Default to "off" if in development.
ericsnowcurrently acfc2a2
Remember if built with --enable-optimizations.
ericsnowcurrently ef653fb
Default to "on" for PGO builds.
ericsnowcurrently f70319b
Make deepfreeze actually work
gvanrossum a381ccf
Add a NEWS entry.
ericsnowcurrently 47e3917
Generate all deepfreeze items in Makefile.pre.in
gvanrossum 20992e9
Don't use GET_CODE in the extern declarations
gvanrossum 692959b
Merge branch 'pr-28107' into deepfreeze
gvanrossum 77812d6
Exclude encodings module for now
gvanrossum 80cf00f
Regenerate Python/frozen.c
gvanrossum 1d29e95
Make [deep]freeze process mess noisy
gvanrossum 9818c44
Regenerated MSVC project files
gvanrossum 9e817b2
Merge branch 'main' into deepfreeze
gvanrossum 2d89d0a
Make deep-freezing work again
gvanrossum 8d029ae
Make deep-freezing *really* work
gvanrossum 27518ff
Merge branch 'main' into deepfreeze
gvanrossum 5e98069
Fix test_ctypes and struct_frozen example in docs
gvanrossum 239ee0b
Merge branch 'main' into deepfreeze
gvanrossum 34b6da4
Undo some badly merged files
gvanrossum 2c54cf0
Add dependency on bootstrap for _bootstrap_python
gvanrossum 502b566
Remove Programs/_bootstrap_python in 'make clean'
gvanrossum 6733acd
Move _bootstrap_python to toplevel dir, to get build working
gvanrossum 70d10f8
Regenerate Makefile.pre.in
gvanrossum 11182f8
Use 'make' shortcuts in deep-freeze rules
gvanrossum b4103cb
Fix test_import, test_regrtest, test_trace
gvanrossum b7abc3e
Fix out-of-tree builds
gvanrossum 6e11529
📜🤖 Added by blurb_it.
blurb-it[bot] fa52af4
Open files in UTF-8 mode
gvanrossum e4f31d0
Solve out-of-tree build differently
gvanrossum 76fb82d
Use _bootstrap_python to create pybuilddir.txt and sysconfig
gvanrossum cb69845
Remove Python/deepfreeze contents
gvanrossum 0c9de73
Merge remote-tracking branch 'origin/main' into deepfreeze
gvanrossum c747a0f
Don't use $@ and $<, they don't work on FreeBSD
gvanrossum f40d138
Fix out of tree builds by adding $(srcdir)
gvanrossum 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
There are no files selected for viewing
This file contains 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 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 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 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 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 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
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Build/2021-11-03-00-19-50.bpo-45696.eKs46f.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Skip the marshal step for frozen modules by generating C code that produces a set of ready-to-use code objects. This speeds up startup time by another 10% or more. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
/* Frozen modules bootstrap */ | ||
|
||
/* This file is linked with "bootstrap Python" | ||
which is used (only) to run Tools/scripts/deepfreeze.py. */ | ||
|
||
#include "Python.h" | ||
#include "pycore_import.h" | ||
|
||
/* Includes for frozen modules: */ | ||
#include "frozen_modules/importlib._bootstrap.h" | ||
#include "frozen_modules/importlib._bootstrap_external.h" | ||
#include "frozen_modules/zipimport.h" | ||
/* End includes */ | ||
|
||
/* Note that a negative size indicates a package. */ | ||
|
||
static const struct _frozen bootstrap_modules[] = { | ||
{"_frozen_importlib", _Py_M__importlib__bootstrap, (int)sizeof(_Py_M__importlib__bootstrap)}, | ||
{"_frozen_importlib_external", _Py_M__importlib__bootstrap_external, (int)sizeof(_Py_M__importlib__bootstrap_external)}, | ||
{"zipimport", _Py_M__zipimport, (int)sizeof(_Py_M__zipimport)}, | ||
{0, 0, 0} /* bootstrap sentinel */ | ||
}; | ||
static const struct _frozen stdlib_modules[] = { | ||
{0, 0, 0} /* stdlib sentinel */ | ||
}; | ||
static const struct _frozen test_modules[] = { | ||
{0, 0, 0} /* test sentinel */ | ||
}; | ||
const struct _frozen *_PyImport_FrozenBootstrap = bootstrap_modules; | ||
const struct _frozen *_PyImport_FrozenStdlib = stdlib_modules; | ||
const struct _frozen *_PyImport_FrozenTest = test_modules; | ||
|
||
static const struct _module_alias aliases[] = { | ||
{"_frozen_importlib", "importlib._bootstrap"}, | ||
{"_frozen_importlib_external", "importlib._bootstrap_external"}, | ||
{0, 0} /* aliases sentinel */ | ||
}; | ||
const struct _module_alias *_PyImport_FrozenAliases = aliases; | ||
|
||
|
||
/* Embedding apps may change this pointer to point to their favorite | ||
collection of frozen modules: */ | ||
|
||
const struct _frozen *PyImport_FrozenModules = NULL; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This directory contains the generated .c files for all the deep-frozen | ||
modules. Python/frozen.c depends on these files. | ||
|
||
None of these files are committed into the repo. | ||
|
||
See Tools/scripts/freeze_modules.py for more info. |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is essentially identical to Python/frozen.c if we cut out the non-bootstrap parts, right? So could we just use frozen.c with something like
#ifndef FROZEN_BOOTRAP
around the non-bootstrap parts?Otherwise I recommend generating the parts of this file with Tools/scripts/freeze_modules.py, the same as with frozen.c. If we don't then this will break when someone adds another module to the
BOOTSTRAP
list in freeze_modules.py.