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 — The code generated by the JIT for loading 16 bit and 32 bit constants is inefficient. · Issue #140683 · python/cpython

The code generated by the JIT for loading 16 bit and 32 bit constants is inefficient. #140683

New issue
Copy link
New issue
Copy link
Closed
Closed
The code generated by the JIT for loading 16 bit and 32 bit constants is inefficient.#140683
Copy link
Labels
3.15bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetopic-JIT

Description

@markshannon
markshannon
opened on Oct 27, 2025
Issue body actions

This affects both x86-64 and AArch64.

Most guard micro-ops are checking against 16 or 32 bit version numbers, so this is an important use case.

The code we generate is too large and, on AArch64, performs extra memory accesses.

Constant x86-64 now x86-64 ideal AArch64 now AArch64 ideal
16 bit 1 10 byte instruction 1 5 byte instruction 2 instructions + 1 memory load 1 instruction
32 bit 1 10 byte instruction 1 5 byte instruction 2 instructions + 1 memory load 2 instructions

Linked PRs

  • GH-140683: JIT: Improve machine code for loading smaller constants on AArch64. #142511
Reacted by Mikhail Efimov, balmasexy, Sergey Miryanov and Gregory P. Smith

Activity

  1. markshannon
    added
    performancePerformance or resource usagePerformance or resource usage
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    topic-JIT
    3.15bugs and security fixesbugs and security fixes
    on Oct 27, 2025
  2. brandtbucher commented on Oct 27, 2025

    @brandtbucher
    brandtbucher
    on Oct 27, 2025
    Member
    More actions

    Is the plan to handle this in the textual assembly transformation step? Or by relaxing the relocations at runtime?

  3. markshannon commented on Oct 28, 2025

    @markshannon
    markshannon
    on Oct 28, 2025
    MemberAuthor
    More actions

    I think this needs to handled all the way through the tools chain, including the code generator to avoid Clang generating the load instructions. Or it might be possible to fix that with different compiler flags. I'll need to experiment. Have you given this any thought?

  4. markshannon
    added a commit that references this issue on Dec 11, 2025

    GH-140683: JIT: Improve machine code for loading smaller constants on…

    4eab90f
  5. fatelei
    added a commit that references this issue on Dec 12, 2025

    pythonGH-140683: JIT: Improve machine code for loading smaller consta…

    cc13eb0
  6. sergey-miryanov commented on May 4, 2026

    @sergey-miryanov
    sergey-miryanov
    on May 4, 2026
    Contributor
    More actions

    Completed via #142511

  7. sergey-miryanov
    closed this as completedon May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetopic-JIT

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.