Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Decoding instructions should handle ENTER_EXECUTOR #107265

Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
@gvanrossum

Description

@gvanrossum

There's a variety of places where we walk over an array of instructions, using some variant of

for (inti=0;i<num_instructions;) {intopcode=instructions[i].op.code;// <decode EXTENDED_ARG>opcode=_PyOpcode_Deopt[opcode];// or _Py_GetBaseOpcode(code, i)// <handle opcode>i+=1+_PyOpcode_Caches[opcode];// or _PyInstruction_GetLength(code, i)}

All these make the mistake that ifopcode isENTER_EXECUTOR, it may obscure an underlyingJUMP_BACKWARD instruction, which has a cache entry.

I fixed this ingh-107256 for_PyInstruction_GetLength() and it was first reported ingh-107082, but there are a number of other occurrences. Basically every time we consult_PyOpcode_Caches we should ensure that the index is notENTER_EXECUTOR.

CC:@markshannon


Places where I found this:

  • _PyInstruction_GetLength
  • code_richcompare
  • code_hash
  • _Py_GetBaseOpcode[should not be "fixed", it would break callers that need the oparg]
  • mark_stacks
  • _PyFrame_OpAlreadyRan
  • de_instrument?
  • initialize_tools?
  • remove_tools?
  • _PyCode_Quicken?

There are possibly others.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp