X Tutup
Skip to content

GH-145692: Convert DEOPT_IFs to EXIT_IFs#145751

Open
markshannon wants to merge 1 commit intopython:mainfrom
markshannon:convert-deopts-to-exits
Open

GH-145692: Convert DEOPT_IFs to EXIT_IFs#145751
markshannon wants to merge 1 commit intopython:mainfrom
markshannon:convert-deopts-to-exits

Conversation

@markshannon
Copy link
Member

@markshannon markshannon commented Mar 10, 2026

This PR, in theory, allows more code to be jitted.
EXIT_IF branches to a side exit, allowing it to be jitted once it has warmed up, where DEOPT_IF always exits to the interpreter.

In practice this doesn't seem to make much difference, but it does unblock other work to jit more code.
Performance is generally neutral, less than 1% faster or slower across 5 different platforms.

@markshannon markshannon changed the title GH-145692: Convert DEOPT_IFs to EXIT_IFs. GH-145692: Convert DEOPT_IFs to EXIT_IFs Mar 10, 2026
Copy link
Member

@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me, just a comment on two areas.

EXIT_IF(!_PyLong_IsNonNegativeCompact((PyLongObject *)sub));
Py_ssize_t index = ((PyLongObject*)sub)->long_value.ob_digit[0];
DEOPT_IF(!LOCK_OBJECT(list));
EXIT_IF(!LOCK_OBJECT(list));
Copy link
Member

Choose a reason for hiding this comment

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

Not sure we have any reprise for things that fail on LOCK_OBJECT (ie a side trace wouldn't help). So I would't bother with it for this and below.

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

X Tutup