Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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

Closed
markshannon opened this issue Jun 26, 2023 · 2 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@markshannon
Copy link
Member

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

@markshannon markshannon added the type-bug An unexpected behavior, bug, or error label Jun 26, 2023
@markshannon markshannon 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. Jun 26, 2023
@gvanrossum
Copy link
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.)

@markshannon
Copy link
Member Author

Fixed by #106141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants