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 — GH-104584: Allow optimizers to opt out of optimizing. by markshannon · Pull Request #105244 · python/cpython

Conversation

@markshannon

@markshannon markshannon commented Jun 2, 2023 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: Pluggable optimizer API #104584

Sorry, something went wrong.

Uh oh!

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

All reactions
@markshannon
Allow optimizers to opt out of optimizing.
39b5f04
@markshannon markshannon added the skip news label Jun 2, 2023
@markshannon
markshannon requested a review from carljm June 2, 2023 15:41
@bedevere-bot bedevere-bot added the awaiting core review label Jun 2, 2023
@bedevere-bot bedevere-bot mentioned this pull request Jun 2, 2023
Pluggable optimizer API #104584
Closed
@markshannon markshannon mentioned this pull request Jun 2, 2023
GH-104584: Optimizer API #105100
Merged
carljm
carljm approved these changes Jun 2, 2023
View reviewed changes
Comment thread Python/optimizer.c
Comment on lines +164 to +165
_PyFrame_SetStackPointer(frame, stack_pointer);
return frame;

@carljm carljm Jun 2, 2023

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.

We could also complicate the signature of _PyOptimizer_BackEdge to signal this case back to the caller so we could avoid the stack pointer write, and the caller could just continue regular interpretation instead of needing to goto resume_frame and update interpreter state from the frame again. But probably not worth it I guess, if optimizers declining to optimize should be rare?

Sorry, something went wrong.

Uh oh!

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

All reactions

@markshannon markshannon Jun 5, 2023

Copy link
Copy Markdown
Member Author

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.

Most calls to _PyOptimizer_BackEdge will return the same frame. We could add a check for it in JUMP_BACKWARD, but I think we would still need to save the stack pointer.
Even if we could avoid it, I suspect a single unconditional write is faster than the additional logic to avoid it.

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Jun 2, 2023
@markshannon
markshannon merged commit e8ecb9e into python:main Jun 5, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Jun 5, 2023
@markshannon
markshannon deleted the allow-optimizer-to-not-optimize branch September 26, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@carljm carljm carljm approved these changes

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.

3 participants

@markshannon @carljm @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.