Skip to content

Commit 5e5024a

Browse files
committed
gh-155486: optimize exact integer guard in JIT
1 parent 7d9c91c commit 5e5024a

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

Python/optimizer_bytecodes.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ dummy_func(void) {
217217
}
218218
}
219219

220+
op(_GUARD_TOS_EXACT_INT, (value -- value)) {
221+
if (sym_matches_type(value, &PyLong_Type)) {
222+
ADD_OP(_NOP, 0, 0);
223+
}
224+
sym_set_type(value, &PyLong_Type);
225+
}
226+
220227
op(_GUARD_NOS_INT, (left, unused -- left, unused)) {
221228
if (sym_is_compact_int(left)) {
222229
ADD_OP(_NOP, 0, 0);

Python/optimizer_cases.c.h

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)