Skip to content

Eval breaker isn't checked when the optimizer produces small region executors in loops. #106101

Closed

Description

@markshannon

For tier2 optimization, the VM replaces the JUMP_BACKWARD instruction with ENTER_EXECUTOR.
If the executor does not execute the whole loop it may not check the eval-breaker, resulting in uninterruptable loops.

The obvious fix is to add an eval-breaker check to ENTER_EXECUTOR.
I think that is also the correct fix.
Adding extra checks of the eval break is always correct. The effect on performance should be low, as we hope that transfers of control from the interpreter to optimized code will be relatively rare.

Discovered here

Activity

  1. changed the title [-]Eval breaker isn't check if optimizer produces small region executors in loops.[/-] [+]Eval breaker isn't checked when the optimizer produces small region executors in loops.[/+] on Jun 26, 2023
  2. gvanrossum commented on Jun 26, 2023

    @gvanrossum
    Member

    I have a fix where each time upon entry into the Tier 2 interpreter we repeat the code from CHECK_EVAL_BREAKER():
    9df20bb

    (I can't literally insert a call to the CHECK_EVAL_BREAKER() macro because that macro goes to a label; I could repeat that label but what it does is a little murky (it may either execute goto error or DISPATCH(). Either way it looks fragile.)

  3. markshannon commented on Jul 4, 2023

    @markshannon
    MemberAuthor

    Fixed by #106141

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

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions