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-131798: JIT: optimize _LOAD_COMMON_CONSTANT by trdthg · Pull Request #146104 · python/cpython

Conversation

@trdthg

@trdthg trdthg commented Mar 18, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Try to learn and make a small contribution :D

  • Issue: Better uop coverage in the JIT optimizer #131798

Sorry, something went wrong.

Uh oh!

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

Fidget-Spinner reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@trdthg
trdthg requested review from Fidget-Spinner, markshannon, savannahostrowski and tomasr8 as code owners March 18, 2026 11:30
@bedevere-app

bedevere-app Bot commented Mar 18, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

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

@python-cla-bot

python-cla-bot Bot commented Mar 18, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot added the awaiting review label Mar 18, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Mar 18, 2026
Better uop coverage in the JIT optimizer #131798
Open
Fidget-Spinner
Fidget-Spinner approved these changes Mar 18, 2026
View reviewed changes

@Fidget-Spinner Fidget-Spinner 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.

Thanks, this LGTM! Please remove the news entry, we don't need it as it's not a user facing code.

Sorry, something went wrong.

Uh oh!

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

trdthg reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Mar 18, 2026
@trdthg
trdthg force-pushed the trdthg/feature/jit-load-common-constant branch from 068d2bb to 19fc90f Compare March 18, 2026 11:40
@bedevere-app

bedevere-app Bot commented Mar 18, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Fidget-Spinner Fidget-Spinner added the skip news label Mar 18, 2026
@Fidget-Spinner

Fidget-Spinner commented Mar 18, 2026

Copy link
Copy Markdown
Member

_LOAD_COMMON_CONSTANT x86_64 dissasembly in jit_stencils-x86_64-unknown-linux-gnu.h:

    // 0000000000000000 <_JIT_ENTRY>:
    // 0: 49 8b 47 10                   movq    0x10(%r15), %rax
    // 4: 48 b9 00 00 00 00 00 00 00 00 movabsq $0x0, %rcx
    // 0000000000000006:  R_X86_64_64  _JIT_OPARG
    // e: 0f b7 c9                      movzwl  %cx, %ecx
    // 11: 48 8b bc c8 60 68 03 00       movq    0x36860(%rax,%rcx,8), %rdi
    // 19: 8b 07                         movl    (%rdi), %eax
    // 1b: 85 c0                         testl   %eax, %eax
    // 1d: 78 06                         js      0x25 <_JIT_ENTRY+0x25>
    // 1f: ff c0                         incl    %eax
    // 21: 89 07                         movl    %eax, (%rdi)
    // 23: eb 04                         jmp     0x29 <_JIT_ENTRY+0x29>
    // 25: 48 83 cf 01                   orq     $0x1, %rdi

I think this is prior to our CFG optimizations in the backend, so it's not 100% accurate, but pretty close.

_LOAD_CONST_INLINE_BORROW:

    // 
    // _LOAD_CONST_INLINE_BORROW_r01.o:       file format elf64-x86-64
    // 
    // Disassembly of section .text:
    // 
    // 0000000000000000 <_JIT_ENTRY>:
    // 0: 48 bf 00 00 00 00 00 00 00 00 movabsq $0x0, %rdi
    // 0000000000000002:  R_X86_64_64  _JIT_OPERAND0
    // a: 48 83 cf 01                   orq     $0x1, %rdi

This is a really nice reduction. Good job!

All reactions

Sorry, something went wrong.

Uh oh!

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

Fidget-Spinner
Fidget-Spinner reviewed Mar 18, 2026
View reviewed changes
Comment thread Lib/test/test_capi/test_opt.py Resolved

Uh oh!

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

@trdthg
pythongh-131798: JIT: optimize _LOAD_COMMON_CONSTANT
b37ec56
@trdthg
trdthg force-pushed the trdthg/feature/jit-load-common-constant branch from 19fc90f to b37ec56 Compare March 18, 2026 12:30
@Fidget-Spinner

Fidget-Spinner commented Mar 18, 2026

Copy link
Copy Markdown
Member

We generally don't force push, because all PRs in CPython are squash-merged. So just push normal commits, thanks!

trdthg reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

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

Fidget-Spinner
Fidget-Spinner approved these changes Mar 18, 2026
View reviewed changes

@Fidget-Spinner Fidget-Spinner left a comment •
edited
Loading

Uh oh!

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

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.

Once again, LGTM. Thanks for this!

Sorry, something went wrong.

Uh oh!

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

trdthg and AIdjis reacted with heart emoji
All reactions
  • ❤️ 2 reactions
@Fidget-Spinner
Fidget-Spinner merged commit 98977ca into python:main Mar 19, 2026
66 checks passed

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting merge label Mar 19, 2026
@pablogsal pablogsal mentioned this pull request Apr 4, 2026
gh-130273: Fix traceback color output with unicode characters #142529
Merged
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@trdthg @ljfp
pythongh-131798: JIT: optimize _LOAD_COMMON_CONSTANT (pythonGH-146104)
b6c4818
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Fidget-Spinner Fidget-Spinner Fidget-Spinner approved these changes
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@tomasr8 tomasr8 Awaiting requested review from tomasr8 tomasr8 is a code owner
@savannahostrowski savannahostrowski Awaiting requested review from savannahostrowski

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.

2 participants

@trdthg @Fidget-Spinner
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.