GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-45953: Statically initialize the small ints. by ericsnowcurrently · Pull Request #30092 · python/cpython

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented Dec 13, 2021 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

The array of small PyLong objects has been statically declared. Here I also statically initialize them. Consequently they are no longer initialized dynamically during runtime init.

I've also moved them under a new sub-struct in _PyRuntimeState, in preparation for static allocation and initialization of other global objects.

FWIW, I considered adding a script for generating the array initializer, but figured that can be done separately if valuable.

https://bugs.python.org/issue45953

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ericsnowcurrently added 2 commits December 13, 2021 12:56
@ericsnowcurrently
Add struct _Py_global_objects.
0d9794a
@ericsnowcurrently
Add _Py_global_objects.singletons.
3b0abc9
@ericsnowcurrently ericsnowcurrently added the skip news label Dec 13, 2021
@ericsnowcurrently
ericsnowcurrently requested a review from a team as a code owner December 13, 2021 20:43
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Dec 13, 2021
@bedevere-bot bedevere-bot added the awaiting core review label Dec 13, 2021
@ericsnowcurrently
ericsnowcurrently requested review from markshannon and removed request for a team December 13, 2021 20:44
@ericsnowcurrently ericsnowcurrently mentioned this pull request Dec 13, 2021
[global objects] static allocation/init for the small ints faster-cpython/ideas#179
Closed
gvanrossum
gvanrossum approved these changes Dec 13, 2021
View reviewed changes

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

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.

LGTM. I have a nit in a comment but it was present in the original before the move as well.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Include/internal/pycore_global_objects.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Dec 13, 2021
ericsnowcurrently added 5 commits December 13, 2021 15:19
@ericsnowcurrently
Add _Py_global_objects_reset().
c5e5702
@ericsnowcurrently
Move the small ints to _Py_global_objects.
1432a35
@ericsnowcurrently
Drop an unneeded include.
e7d41f2
@ericsnowcurrently
Move a build-time check to the right file.
fca595b
@ericsnowcurrently
Statically initialize the small ints.
8f10ad0
@ericsnowcurrently
ericsnowcurrently force-pushed the global-objects-small-ints branch from a20f308 to 8f10ad0 Compare December 13, 2021 22:20
ericsnowcurrently added 5 commits December 13, 2021 15:22
@ericsnowcurrently
Fix a comment.
564a77c
@ericsnowcurrently
Clean up the initializer.
9959c5a
@ericsnowcurrently
Separate the global objects from the type-specific helpers.
c4c85e7
@ericsnowcurrently
Separate the int helpers.
c017103
@ericsnowcurrently
Do not clear _PyRuntime.global_objects in _PyRuntimeState_reset().
f2821bd
@ericsnowcurrently
ericsnowcurrently merged commit 121f1f8 into python:main Dec 14, 2021
@bedevere-bot bedevere-bot removed the awaiting merge label Dec 14, 2021
@ericsnowcurrently
ericsnowcurrently deleted the global-objects-small-ints branch December 14, 2021 01:04
@kumaraditya303 kumaraditya303 mentioned this pull request Jan 20, 2022
bpo-46443: deepfreeze use preallocated small ints #30715
Merged
@ericsnowcurrently ericsnowcurrently mentioned this pull request Nov 8, 2022
Statically allocate interpreter states as much as possible. #90111
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gvanrossum gvanrossum gvanrossum approved these changes
@markshannon markshannon Awaiting requested review from markshannon

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@ericsnowcurrently @gvanrossum @the-knights-who-say-ni @bedevere-bot
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.