Skip to content

Commit f927209

Browse files
committed
Add a new uop
1 parent 85ab405 commit f927209

File tree

6 files changed

+75
-11
lines changed

6 files changed

+75
-11
lines changed

Include/internal/pycore_uop_ids.h

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

Include/internal/pycore_uop_metadata.h

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

Python/bytecodes.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5358,6 +5358,15 @@ dummy_func(
53585358
value = PyStackRef_FromPyObjectBorrow(ptr);
53595359
}
53605360

5361+
tier2 op(_SWAP_CALL_ONE_LOAD_CONST_INLINE_BORROW, (ptr/4, callable, null, arg -- value, a)) {
5362+
PyStackRef_CLOSE(arg);
5363+
(void)null; // Silence compiler warnings about unused variables
5364+
DEAD(null);
5365+
PyStackRef_CLOSE(callable);
5366+
value = PyStackRef_FromPyObjectBorrow(ptr);
5367+
a = arg;
5368+
}
5369+
53615370
tier2 op(_LOAD_CONST_UNDER_INLINE, (ptr/4, old -- value, new)) {
53625371
new = old;
53635372
DEAD(old);

Python/executor_cases.c.h

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

Python/optimizer_bytecodes.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,11 @@ dummy_func(void) {
561561
value = PyJitRef_Borrow(sym_new_const(ctx, ptr));
562562
}
563563

564+
op(_SWAP_CALL_ONE_LOAD_CONST_INLINE_BORROW, (ptr/4, unused, unused, arg -- value, a)) {
565+
value = PyJitRef_Borrow(sym_new_const(ctx, ptr));
566+
a = arg;
567+
}
568+
564569
op(_POP_TOP, (value -- )) {
565570
PyTypeObject *typ = sym_get_type(value);
566571
if (PyJitRef_IsBorrowed(value) ||
@@ -973,7 +978,7 @@ dummy_func(void) {
973978
PyObject* type = (PyObject *)sym_get_type(arg);
974979
if (type) {
975980
res = sym_new_const(ctx, type);
976-
REPLACE_OP(this_instr, _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW, 0,
981+
REPLACE_OP(this_instr, _SWAP_CALL_ONE_LOAD_CONST_INLINE_BORROW, 0,
977982
(uintptr_t)type);
978983
}
979984
else {

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)