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-93678: apply remove_redundant_jumps in optimize_cfg by iritkatriel · Pull Request #96274 · python/cpython

Conversation

@iritkatriel

@iritkatriel iritkatriel commented Aug 25, 2022 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Fixes #93678.

Apply remove_redundant_jumps in optimise_cfg because it belongs there. Later in move_cold_blocks_to_end, we may need to apply it again.

Added an assertion just before assembly stage that there are no redundant jumps.

Also tidy up an unrelated error handling issue I spotted.

  • Issue: Direct unit tests for compiler optimisations #93678

Sorry, something went wrong.

Uh oh!

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

All reactions
@iritkatriel
pythongh-93678: apply remove_redundant_jumps in optimize_cfg
79a0268
@iritkatriel iritkatriel added type-feature A feature request or enhancement tests Tests in the Lib/test dir skip news interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Aug 25, 2022
@iritkatriel
iritkatriel requested review from brandtbucher and markshannon as code owners August 25, 2022 17:40
@bedevere-bot bedevere-bot added the awaiting core review label Aug 25, 2022
mdboom
mdboom reviewed Aug 25, 2022
View reviewed changes
Comment thread Lib/test/test_peepholer.py Resolved

Uh oh!

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

@iritkatriel iritkatriel self-assigned this Aug 26, 2022
@iritkatriel iritkatriel mentioned this pull request Aug 30, 2022
gh-93554: Conditional jumps only jump forward #96318
Merged
@iritkatriel
Merge remote-tracking branch 'upstream/main' into optimize_stage
d249b04
markshannon
markshannon reviewed Aug 30, 2022
View reviewed changes

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

One minor refactoring suggestion.
Otherwise, looks good.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Python/compile.c Resolved

Uh oh!

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

Comment thread Python/compile.c Resolved

Uh oh!

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

@iritkatriel
assert_no_redundant_jumps --> no_redundant_jumps
d0ffa15
@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 30, 2022
@bedevere-bot

bedevere-bot commented Aug 30, 2022

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit d0ffa15 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 30, 2022
@iritkatriel

iritkatriel commented Aug 30, 2022

Copy link
Copy Markdown
Member Author

One minor refactoring suggestion.
Otherwise, looks good.

So the way it is now, the Gentoo Non-Debug build fails because no_redundant_jumps is not defined:

Python/compile.c:8647:12: error: implicit declaration of function ‘no_redundant_jumps’; did you mean ‘remove_redundant_jumps’? [-Werror=implicit-function-declaration]
 8647 |     assert(no_redundant_jumps(g));
      |            ^~~~~~~~~~~~~~~~~~

If I remove the #ifdef Py_DEBUG from the definition of no_redundant_jumps then I get warnings about it not being used on my local build.

All reactions

Sorry, something went wrong.

Uh oh!

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

@iritkatriel
ASSERT_NO_REDUNDANT_JUMPS macro
e47688a
@iritkatriel

iritkatriel commented Aug 30, 2022

Copy link
Copy Markdown
Member Author

@markshannon how about this version?

All reactions

Sorry, something went wrong.

Uh oh!

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

@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 30, 2022
@bedevere-bot

bedevere-bot commented Aug 30, 2022

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit e47688a 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 30, 2022
@iritkatriel

iritkatriel commented Aug 31, 2022

Copy link
Copy Markdown
Member Author

@markshannon how about this version?

Buildbots are fine with it.

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon

markshannon commented Aug 31, 2022

Copy link
Copy Markdown
Member

I'd rather fix the underlying issue.
Why does the Gentoo Non-Debug build have asserts on? That doesn't sound like non-debug to me.

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon

markshannon commented Aug 31, 2022

Copy link
Copy Markdown
Member

Changing the #ifdef Py_DEBUG to #ifndef NDEBUG should work, but I thought #ifdef Py_DEBUG implied #ifndef NDEBUG ande vice-versa.

Am I wrong, or the gentoo non-debug build mis-configured somehow?

All reactions

Sorry, something went wrong.

Uh oh!

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

@gpshead

gpshead commented Aug 31, 2022

Copy link
Copy Markdown
Member

NDEBUG can always be used independent of Py_DEBUG. (ex: we regularly build Python and the world -UNDEBUG mode at work in the default build that people test against)

All reactions

Sorry, something went wrong.

Uh oh!

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

@gpshead

gpshead commented Aug 31, 2022

Copy link
Copy Markdown
Member

as for how it happened in this case, CFLAGS adds -UNDEBUG in https://github.com/python/buildmaster-config/blob/0669211daf34f86e879868364efe15683da0e069/master/custom/factories.py#L277

All reactions

Sorry, something went wrong.

Uh oh!

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

iritkatriel added 2 commits August 31, 2022 23:48
@iritkatriel
Revert "ASSERT_NO_REDUNDANT_JUMPS macro"
6803fb5
This reverts commit e47688a.
@iritkatriel
Py_DEBUG --> NDEBUG
566d9c0
iritkatriel and others added 2 commits August 31, 2022 23:52
@iritkatriel
ifdef --> ifndef
9c06493
@iritkatriel
Merge branch 'main' into optimize_stage
065d97d
@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 31, 2022
@bedevere-bot

bedevere-bot commented Aug 31, 2022

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 065d97d 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 31, 2022
@markshannon
markshannon self-requested a review September 1, 2022 09:58
markshannon
markshannon approved these changes Sep 1, 2022
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Sep 1, 2022
@iritkatriel
iritkatriel merged commit 894cafd into python:main Sep 1, 2022
@bedevere-bot bedevere-bot removed the awaiting merge label Sep 1, 2022
@iritkatriel
iritkatriel deleted the optimize_stage branch October 18, 2022 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mdboom mdboom mdboom left review comments
@markshannon markshannon markshannon approved these changes
@brandtbucher brandtbucher Awaiting requested review from brandtbucher

Uh oh!

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

Assignees

@iritkatriel iritkatriel

Labels

interpreter-core (Objects, Python, Grammar, and Parser dirs) skip news tests Tests in the Lib/test dir type-feature A feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Direct unit tests for compiler optimisations

Uh oh!

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

5 participants

@iritkatriel @bedevere-bot @markshannon @gpshead @mdboom
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.