Skip to content

gh-154701: prevent executor self-links in JIT cold exits - #155323

Open
cocolato wants to merge 3 commits into
python:mainfrom
cocolato:gh-154701
Open

gh-154701: prevent executor self-links in JIT cold exits#155323
cocolato wants to merge 3 commits into
python:mainfrom
cocolato:gh-154701

Conversation

@cocolato

@cocolato cocolato commented Aug 7, 2026

Copy link
Copy Markdown
Member

ADD_OP(_GUARD_TYPE_ITER, 0, (uintptr_t)type);
uop_buffer_last(&ctx->out_buffer)->target = orig_target;
}
ADD_OP(_ITER_NEXT_INLINE, 0, (uintptr_t)type->tp_iternext);

After the FOR_ITER guard fails, the side exit targets the same bytecode location where the current executor is installed. _COLD_EXIT then links that exit back to the current executor itself, creating a self-loop that can never make forward progress.

Detach the self-linked executor and restore the original bytecode before falling back to Tier 1 can solve this issue.

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants