You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Share global string identifiers in deepfreeze #90868
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:
assignee=Noneclosed_at=<Date2022-02-25.18:08:29.439>created_at=<Date2022-02-10.14:18:03.087>labels= ['3.11', 'performance']
title='Share global string identifiers in deepfreeze'updated_at=<Date2022-03-28.09:14:38.402>user='https://github.com/kumaraditya303'
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.
which fails with a compilation error because that identifier is not yet defined. Is there a good way to convince make to regenerate the global objects without this sort of circular dependency? Am I missing a step?
which fails with a compilation error because that identifier is not yet defined. Is there a good way to convince make to regenerate the global objects without this sort of circular dependency? Am I missing a step?
Activity
kumaraditya303 commentedon Feb 10, 2022
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.
See faster-cpython/ideas#218
See faster-cpython/ideas#230
kumaraditya303 commentedon Feb 10, 2022
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:
gvanrossum commentedon Feb 25, 2022
New changeset eb002db by Kumar Aditya in branch 'main':
bpo-46712: Share global string identifiers in deepfreeze (GH-31261)
eb002db
ericsnowcurrently commentedon Mar 1, 2022
New changeset 21099fc by Eric Snow in branch 'main':
bpo-46712: Let generate_global_objects.py Run on Earlier Python Versions (gh-31637)
21099fc
sweeneyde commentedon Mar 21, 2022
In bpo-47067, there was concern about the addition of the makefile target from PR 31637:
After a new
&_Py_ID(__orig_class__)is added to Objects/genericaliasobject.c, runningmake regen-global-objectsstartswhich 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?ericsnowcurrently commentedon Mar 22, 2022
I'm looking into this. A temporary workaround is to run Tools/scripts/generate-global-objects.py directly.
ericsnowcurrently commentedon Mar 23, 2022
New changeset febf54b by Eric Snow in branch 'main':
bpo-46712: Do not Regen Deep-Frozen Modules before Generating Global Objects (gh-32061)
febf54b
bpo-46712: share more global strings in deepfreeze (gh-32152)
gh-90868: Adjust the Generated Objects (gh-99223)
gh-90868: Add _PyStaticObject_CheckRefcnt() function (#99261)