Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all jump opcodes relative #91276

Closed
iritkatriel opened this issue Mar 25, 2022 · 5 comments
Closed

Make all jump opcodes relative #91276

iritkatriel opened this issue Mar 25, 2022 · 5 comments
Assignees
Labels
3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@iritkatriel
Copy link
Member

iritkatriel commented Mar 25, 2022

BPO 47120
Nosy @markshannon, @corona10, @brandtbucher, @iritkatriel
PRs
  • bpo-47120: Replace the JUMP_ABSOLUTE opcode by the relative JUMP_BACKWARD #32115
  • gh-91276: Make JUMP_IF_TRUE_OR_POP/JUMP_IF_FALSE_OR_POP relative #32215
  • bpo-47120: make JUMP_NO_INTERRUPT relative #32221
  • bpo-47120: define virtual opcodes in opcode.py. Better organization of jump opcodes. #32353
  • bpo-47120: make POP_JUMP_IF_NONE/NOT_NONE relative #32359
  • bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NONE/NOT_NONE relative #32400
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/iritkatriel'
    closed_at = None
    created_at = <Date 2022-03-25.14:30:53.931>
    labels = ['interpreter-core', '3.11', 'performance']
    title = 'Make all jump opcodes relative'
    updated_at = <Date 2022-04-07.14:59:34.889>
    user = 'https://github.com/iritkatriel'

    bugs.python.org fields:

    activity = <Date 2022-04-07.14:59:34.889>
    actor = 'iritkatriel'
    assignee = 'iritkatriel'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2022-03-25.14:30:53.931>
    creator = 'iritkatriel'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 47120
    keywords = ['patch']
    message_count = 4.0
    messages = ['416003', '416431', '416466', '416772']
    nosy_count = 4.0
    nosy_names = ['Mark.Shannon', 'corona10', 'brandtbucher', 'iritkatriel']
    pr_nums = ['32115', '32215', '32221', '32353', '32359', '32400']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue47120'
    versions = ['Python 3.11']

    Linked PRs

    @iritkatriel
    Copy link
    Member Author

    For some of our jump opcodes target is absolute, so it can easily require EXTENDED_ARGS. Our analysis [1] shows that turning all absolute jumps into relative jumps will eliminate almost all EXTENDED_ARGS on jumps.

    This will require a _BACK version for each jump type, which negates the oparg.

    [1] faster-cpython/ideas#235 (reply in thread)

    @iritkatriel iritkatriel added the 3.11 only security fixes label Mar 25, 2022
    @iritkatriel iritkatriel self-assigned this Mar 25, 2022
    @iritkatriel iritkatriel added interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage 3.11 only security fixes labels Mar 25, 2022
    @iritkatriel iritkatriel self-assigned this Mar 25, 2022
    @iritkatriel iritkatriel added interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage labels Mar 25, 2022
    @iritkatriel iritkatriel changed the title Make all jumps relative Make all jump opcodes relative Mar 25, 2022
    @iritkatriel iritkatriel changed the title Make all jumps relative Make all jump opcodes relative Mar 25, 2022
    @markshannon
    Copy link
    Member

    New changeset a00518d by Irit Katriel in branch 'main':
    bpo-47120: Replace the JUMP_ABSOLUTE opcode by the relative JUMP_BACKWARD (GH-32115)
    a00518d

    @brandtbucher
    Copy link
    Member

    Another benefit of this work is that we'll be able to remove first_instr from the eval loop.

    @iritkatriel
    Copy link
    Member Author

    New changeset 0aa8d5c by Irit Katriel in branch 'main':
    bpo-47120: make JUMP_NO_INTERRUPT relative (GH-32221)
    0aa8d5c

    @iritkatriel
    Copy link
    Member Author

    This is complete.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants