Repository navigation
Share global string identifiers in deepfreeze #90868
Description
Activity
Since bpo-46541, the global strings are statically allocated so they can now be referenced by deep-frozen modules just like any other singleton. Sharing identifiers with deepfreeze will reduce the duplicated strings hence it would save space.
I have refactored generate_global_objects.py, and now instead of hard-coding every identifier manually, it now scans *.c files extracts the identifiers used in it and then generate the header file. This has multiple advantages:
- No need to manually add identifiers, as soon as it is used in a c file it is added to the global identifiers struct.
- It simplifies the codegen a lot.
- Remove the need of special casing certain file for checking now it is just a set of identifiers and auto removes unused global strings.
- addedperformancePerformance or resource usagePerformance or resource usage
on Feb 25, 2022 - addedperformancePerformance or resource usagePerformance or resource usage
on Feb 25, 2022 In bpo-47067, there was concern about the addition of the makefile target from PR 31637:
regen-global-objects: regen-deepfreezeAfter a new
&_Py_ID(__orig_class__)is added to Objects/genericaliasobject.c, runningmake regen-global-objectsstartsgcc -pthread -c [snipped] -DPy_BUILD_CORE -o [Objects/genericaliasobject.o](https://github.com/python/cpython/blob/main/Objects/genericaliasobject.o) [Objects/genericaliasobject.c](https://github.com/python/cpython/blob/main/Objects/genericaliasobject.c)which fails with a compilation error because that identifier is not yet defined. Is there a good way to convince
maketo regenerate the global objects without this sort of circular dependency? Am I missing a step?After a new
&_Py_ID(__orig_class__)is added to Objects/genericaliasobject.c, runningmake regen-global-objectsstartsgcc -pthread -c [snipped] -DPy_BUILD_CORE -o [Objects/genericaliasobject.o](https://github.com/python/cpython/blob/main/Objects/genericaliasobject.o) [Objects/genericaliasobject.c](https://github.com/python/cpython/blob/main/Objects/genericaliasobject.c)which fails with a compilation error because that identifier is not yet defined. Is there a good way to convince
maketo regenerate the global objects without this sort of circular dependency? Am I missing a step?I'm looking into this. A temporary workaround is to run Tools/scripts/generate-global-objects.py directly.
- added a commit that references this issue
on Nov 8, 2022 - added a commit that references this issue
on Nov 9, 2022
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: