Skip to content

Commit 9f43a6b

Browse files
committed
fix
1 parent c62e632 commit 9f43a6b

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

Python/optimizer_analysis.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,10 @@ optimize_to_bool(
342342
if (truthiness >= 0) {
343343
PyObject *load = truthiness ? Py_True : Py_False;
344344
if (insert_mode) {
345-
ADD_OP(_INSERT_1_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)load);
345+
ADD_OP(_INSERT_1_LOAD_CONST_INLINE_BORROW, 0, PyStackRef_TagBorrow(load));
346346
} else {
347347
ADD_OP(_POP_TOP, 0, 0);
348-
ADD_OP(_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)load);
348+
ADD_OP(_LOAD_CONST_INLINE_BORROW, 0, PyStackRef_TagBorrow(load));
349349
}
350350
*result_ptr = sym_new_const(ctx, load);
351351
return 1;
@@ -402,11 +402,11 @@ lookup_attr(JitOptContext *ctx, _PyBloomFilter *dependencies, _PyUOpInstruction
402402
if (pop) {
403403
ADD_OP(_POP_TOP, 0, 0);
404404
ADD_OP(immortal ? _LOAD_CONST_INLINE_BORROW : _LOAD_CONST_INLINE,
405-
0, (uintptr_t)lookup);
405+
0, immortal ? PyStackRef_TagBorrow(lookup) : (uintptr_t)lookup);
406406
}
407407
else {
408408
ADD_OP(immortal ? _INSERT_1_LOAD_CONST_INLINE_BORROW : _INSERT_1_LOAD_CONST_INLINE,
409-
0, (uintptr_t)lookup);
409+
0, immortal ? PyStackRef_TagBorrow(lookup) : (uintptr_t)lookup);
410410
}
411411
PyType_Watch(TYPE_WATCHER_ID, (PyObject *)type);
412412
_Py_BloomFilter_Add(dependencies, type);

Python/optimizer_cases.c.h

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

Tools/cases_generator/optimizer_generator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,20 +241,20 @@ def replace_opcode_if_evaluates_pure(
241241
# (a -- res), usually for unary ops
242242
0: [("_POP_TOP", "0, 0"),
243243
("_LOAD_CONST_INLINE_BORROW",
244-
"0, (uintptr_t)result")],
244+
"0, PyStackRef_TagBorrow(result)")],
245245
# (left -- res, left)
246246
# usually for unary ops with passthrough references
247247
1: [("_INSERT_1_LOAD_CONST_INLINE_BORROW",
248-
"0, (uintptr_t)result")],
248+
"0, PyStackRef_TagBorrow(result)")],
249249
},
250250
2: {
251251
# (a, b -- res), usually for binary ops
252252
0: [("_POP_TWO_LOAD_CONST_INLINE_BORROW",
253-
"0, (uintptr_t)result")],
253+
"0, PyStackRef_TagBorrow(result)")],
254254
# (left, right -- res, left, right)
255255
# usually for binary ops with passthrough references
256256
2: [("_INSERT_2_LOAD_CONST_INLINE_BORROW",
257-
"0, (uintptr_t)result")],
257+
"0, PyStackRef_TagBorrow(result)")],
258258
},
259259
}
260260

0 commit comments

Comments
 (0)