Skip to content
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
2 changes: 1 addition & 1 deletion Include/internal/pycore_optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ typedef struct _jit_opt_tuple {

typedef struct {
uint8_t tag;
bool not;
bool not_;
uint16_t value;
} JitOptTruthiness;

Expand Down
16 changes: 8 additions & 8 deletions Python/optimizer_symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ _Py_uop_sym_is_const(JitOptContext *ctx, JitOptSymbol *sym)
if (truthiness < 0) {
return false;
}
make_const(sym, (truthiness ^ sym->truthiness.not) ? Py_True : Py_False);
make_const(sym, (truthiness ^ sym->truthiness.not_) ? Py_True : Py_False);
return true;
}
return false;
Expand All @@ -138,7 +138,7 @@ _Py_uop_sym_get_const(JitOptContext *ctx, JitOptSymbol *sym)
if (truthiness < 0) {
return NULL;
}
PyObject *res = (truthiness ^ sym->truthiness.not) ? Py_True : Py_False;
PyObject *res = (truthiness ^ sym->truthiness.not_) ? Py_True : Py_False;
make_const(sym, res);
return res;
}
Expand Down Expand Up @@ -289,7 +289,7 @@ _Py_uop_sym_set_const(JitOptContext *ctx, JitOptSymbol *sym, PyObject *const_val
}
JitOptSymbol *value = allocation_base(ctx) + sym->truthiness.value;
PyTypeObject *type = _Py_uop_sym_get_type(value);
if (const_val == (sym->truthiness.not ? Py_False : Py_True)) {
if (const_val == (sym->truthiness.not_ ? Py_False : Py_True)) {
// value is truthy. This is only useful for bool:
if (type == &PyBool_Type) {
_Py_uop_sym_set_const(ctx, value, Py_True);
Expand Down Expand Up @@ -496,7 +496,7 @@ _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptSymbol *sym)
if (truthiness < 0) {
return truthiness;
}
truthiness ^= sym->truthiness.not;
truthiness ^= sym->truthiness.not_;
make_const(sym, truthiness ? Py_True : Py_False);
return truthiness;
}
Expand Down Expand Up @@ -590,8 +590,8 @@ JitOptSymbol *
_Py_uop_sym_new_truthiness(JitOptContext *ctx, JitOptSymbol *value, bool truthy)
{
// It's clearer to invert this in the signature:
bool not = !truthy;
if (value->tag == JIT_SYM_TRUTHINESS_TAG && value->truthiness.not == not) {
bool not_ = !truthy;
if (value->tag == JIT_SYM_TRUTHINESS_TAG && value->truthiness.not_ == not_) {
return value;
}
JitOptSymbol *res = sym_new(ctx);
Expand All @@ -601,11 +601,11 @@ _Py_uop_sym_new_truthiness(JitOptContext *ctx, JitOptSymbol *value, bool truthy)
int truthiness = _Py_uop_sym_truthiness(ctx, value);
if (truthiness < 0) {
res->tag = JIT_SYM_TRUTHINESS_TAG;
res->truthiness.not = not;
res->truthiness.not_ = not_;
res->truthiness.value = (uint16_t)(value - allocation_base(ctx));
}
else {
make_const(res, (truthiness ^ not) ? Py_True : Py_False);
make_const(res, (truthiness ^ not_) ? Py_True : Py_False);
}
return res;
}
Expand Down
Loading