10000 GH-130415: Use boolean guards to narrow types to values in the JIT by brandtbucher · Pull Request #130659 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-130415: Use boolean guards to narrow types to values in the JIT #130659

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 13 commits into from
Mar 2, 2025
Prev Previous commit
Next Next commit
Fix some compiler warnings
  • Loading branch information
brandtbucher committed Feb 28, 2025
commit cbd4569dee37b5b2686b17b2ada6605a4739030e
5 changes: 3 additions & 2 deletions Python/optimizer_symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ _Py_uop_abstractcontext_fini(JitOptContext *ctx)
void
_Py_uop_abstractcontext_init(JitOptContext *ctx)
{
static_assert(sizeof(JitOptSymbol) <= 2*sizeof(uint64_t));
static_assert(sizeof(JitOptSymbol) <= 2 * sizeof(uint64_t), "JitOptSymbol has grown");
ctx->limit = ctx->locals_and_stack + MAX_ABSTRACT_INTERP_SIZE;
ctx->n_consumed = ctx->locals_and_stack;
#ifdef Py_DEBUG // Aids debugging a little. There should never be NULL in the abstract interpreter.
Expand Down Expand Up @@ -718,6 +718,7 @@ _Py_uop_symbols_test(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
_Py_uop_abstractcontext_init(ctx);
PyObject *val_42 = NULL;
PyObject *val_43 = NULL;
PyObject *tuple = NULL;

// Use a single 'sym' variable so copy-pasting tests is easier.
JitOptSymbol *sym = _Py_uop_sym_new_unknown(ctx);
Expand Down Expand Up @@ -821,7 +822,7 @@ _Py_uop_symbols_test(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
"tuple item does not match value used to create tuple"
);
PyObject *pair[2] = { val_42, val_43 };
PyObject *tuple = _PyTuple_FromArray(pair, 2);
tuple = _PyTuple_FromArray(pair, 2);
sym = _Py_uop_sym_new_const(ctx, tuple);
TEST_PREDICATE(
_Py_uop_sym_get_const(ctx, _Py_uop_sym_tuple_getitem(ctx, sym, 1)) == val_43,
Expand Down
0