8000 GH-131798: Narrow types more aggressively in the JIT by brandtbucher · Pull Request #134373 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-131798: Narrow types more aggressively in the JIT #134373

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

Merged
merged 7 commits into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix the crashes
  • Loading branch information
brandtbucher committed May 20, 2025
commit 0974ec9cdf2ec5a1888c18ee14d2afe41bcf280f
16 changes: 8 additions & 8 deletions Python/optimizer_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,14 +523,7 @@ optimize_uops(

}

const uint16_t op_without_pop[MAX_UOP_ID] = {
[_POP_TOP] = _NOP,
[_POP_TOP_LOAD_CONST_INLINE] = _LOAD_CONST_INLINE,
[_POP_TOP_LOAD_CONST_INLINE_BORROW] = _LOAD_CONST_INLINE_BORROW,
[_POP_TWO_LOAD_CONST_INLINE_BORROW] = _POP_TOP_LOAD_CONST_INLINE_BORROW,
};

const uint16_t op_without_push[MAX_UOP_ID] = {
const uint16_t op_without_push[MAX_UOP_ID + 1] = {
[_COPY] = _NOP,
[_LOAD_CONST_INLINE] = _NOP,
[_LOAD_CONST_INLINE_BORROW] = _NOP,
Expand All @@ -542,6 +535,13 @@ const uint16_t op_without_push[MAX_UOP_ID] = {
[_POP_TWO_LOAD_CONST_INLINE_BORROW] = _POP_TWO,
};

const uint16_t op_without_pop[MAX_UOP_ID + 1] = {
[_POP_TOP] = _NOP,
[_POP_TOP_LOAD_CONST_INLINE] = _LOAD_CONST_INLINE,
[_POP_TOP_LOAD_CONST_INLINE_BORROW] = _LOAD_CONST_INLINE_BORROW,
[_POP_TWO_LOAD_CONST_INLINE_BORROW] = _POP_TOP_LOAD_CONST_INLINE_BORROW,
};


static int
remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
Expand Down
2 changes: 1 addition & 1 deletion Python/optimizer_symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ _Py_uop_sym_set_const(JitOptContext *ctx, JitOptSymbol *sym, PyObject *const_val
PyObject *item = PyTuple_GET_ITEM(const_val, i);
_Py_uop_sym_set_const(ctx, sym_item, item);
}
_Py_uop_sym_set_const(ctx, sym, const_val);
make_const(sym, const_val);
return;
}
}
Expand Down
Loading
0