mirror of
https://github.com/python/cpython.git
synced 2026-06-18 07:32:45 +00:00
gh-148211: decompose _SHUFFLE_3_LOAD_CONST_INLINE_BORROW in JIT (GH-148816)
This commit is contained in:
parent
be968c7210
commit
2b6a13710f
7 changed files with 1029 additions and 1167 deletions
|
|
@ -6107,13 +6107,6 @@ dummy_func(
|
|||
value = PyStackRef_FromPyObjectBorrow(ptr);
|
||||
}
|
||||
|
||||
tier2 op(_SHUFFLE_3_LOAD_CONST_INLINE_BORROW, (ptr/4, callable, null, arg -- res, a, c)) {
|
||||
res = PyStackRef_FromPyObjectBorrow(ptr);
|
||||
a = arg;
|
||||
c = callable;
|
||||
INPUTS_DEAD();
|
||||
}
|
||||
|
||||
tier2 op(_START_EXECUTOR, (executor/4 --)) {
|
||||
#ifndef _Py_JIT
|
||||
assert(current_executor == (_PyExecutorObject*)executor);
|
||||
|
|
|
|||
100
Python/executor_cases.c.h
generated
100
Python/executor_cases.c.h
generated
|
|
@ -22337,106 +22337,6 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r03: {
|
||||
CHECK_CURRENT_CACHED_VALUES(0);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
_PyStackRef arg;
|
||||
_PyStackRef callable;
|
||||
_PyStackRef res;
|
||||
_PyStackRef a;
|
||||
_PyStackRef c;
|
||||
arg = stack_pointer[-1];
|
||||
callable = stack_pointer[-3];
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND0_64();
|
||||
res = PyStackRef_FromPyObjectBorrow(ptr);
|
||||
a = arg;
|
||||
c = callable;
|
||||
_tos_cache2 = c;
|
||||
_tos_cache1 = a;
|
||||
_tos_cache0 = res;
|
||||
SET_CURRENT_CACHED_VALUES(3);
|
||||
stack_pointer += -3;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
break;
|
||||
}
|
||||
|
||||
case _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r13: {
|
||||
CHECK_CURRENT_CACHED_VALUES(1);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
_PyStackRef arg;
|
||||
_PyStackRef callable;
|
||||
_PyStackRef res;
|
||||
_PyStackRef a;
|
||||
_PyStackRef c;
|
||||
_PyStackRef _stack_item_0 = _tos_cache0;
|
||||
arg = _stack_item_0;
|
||||
callable = stack_pointer[-2];
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND0_64();
|
||||
res = PyStackRef_FromPyObjectBorrow(ptr);
|
||||
a = arg;
|
||||
c = callable;
|
||||
_tos_cache2 = c;
|
||||
_tos_cache1 = a;
|
||||
_tos_cache0 = res;
|
||||
SET_CURRENT_CACHED_VALUES(3);
|
||||
stack_pointer += -2;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
break;
|
||||
}
|
||||
|
||||
case _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r23: {
|
||||
CHECK_CURRENT_CACHED_VALUES(2);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
_PyStackRef arg;
|
||||
_PyStackRef callable;
|
||||
_PyStackRef res;
|
||||
_PyStackRef a;
|
||||
_PyStackRef c;
|
||||
_PyStackRef _stack_item_0 = _tos_cache0;
|
||||
_PyStackRef _stack_item_1 = _tos_cache1;
|
||||
arg = _stack_item_1;
|
||||
callable = stack_pointer[-1];
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND0_64();
|
||||
res = PyStackRef_FromPyObjectBorrow(ptr);
|
||||
a = arg;
|
||||
c = callable;
|
||||
_tos_cache2 = c;
|
||||
_tos_cache1 = a;
|
||||
_tos_cache0 = res;
|
||||
SET_CURRENT_CACHED_VALUES(3);
|
||||
stack_pointer += -1;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
break;
|
||||
}
|
||||
|
||||
case _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r33: {
|
||||
CHECK_CURRENT_CACHED_VALUES(3);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
_PyStackRef arg;
|
||||
_PyStackRef callable;
|
||||
_PyStackRef res;
|
||||
_PyStackRef a;
|
||||
_PyStackRef c;
|
||||
_PyStackRef _stack_item_0 = _tos_cache0;
|
||||
_PyStackRef _stack_item_1 = _tos_cache1;
|
||||
_PyStackRef _stack_item_2 = _tos_cache2;
|
||||
arg = _stack_item_2;
|
||||
callable = _stack_item_0;
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND0_64();
|
||||
res = PyStackRef_FromPyObjectBorrow(ptr);
|
||||
a = arg;
|
||||
c = callable;
|
||||
_tos_cache2 = c;
|
||||
_tos_cache1 = a;
|
||||
_tos_cache0 = res;
|
||||
SET_CURRENT_CACHED_VALUES(3);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
break;
|
||||
}
|
||||
|
||||
case _START_EXECUTOR_r00: {
|
||||
CHECK_CURRENT_CACHED_VALUES(0);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
|
|
|
|||
|
|
@ -2330,7 +2330,10 @@ dummy_func(void) {
|
|||
goto error;
|
||||
}
|
||||
if (_Py_IsImmortal(temp)) {
|
||||
ADD_OP(_SHUFFLE_3_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)temp);
|
||||
ADD_OP(_SWAP, 2, 0);
|
||||
optimize_pop_top(ctx, this_instr, null);
|
||||
ADD_OP(_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)temp);
|
||||
ADD_OP(_SWAP, 3, 0);
|
||||
}
|
||||
res = sym_new_const(ctx, temp);
|
||||
Py_DECREF(temp);
|
||||
|
|
|
|||
20
Python/optimizer_cases.c.h
generated
20
Python/optimizer_cases.c.h
generated
|
|
@ -4514,11 +4514,13 @@
|
|||
|
||||
case _CALL_LEN: {
|
||||
JitOptRef arg;
|
||||
JitOptRef null;
|
||||
JitOptRef callable;
|
||||
JitOptRef res;
|
||||
JitOptRef a;
|
||||
JitOptRef c;
|
||||
arg = stack_pointer[-1];
|
||||
null = stack_pointer[-2];
|
||||
callable = stack_pointer[-3];
|
||||
res = sym_new_type(ctx, &PyLong_Type);
|
||||
Py_ssize_t length = sym_tuple_length(arg);
|
||||
|
|
@ -4544,7 +4546,10 @@
|
|||
goto error;
|
||||
}
|
||||
if (_Py_IsImmortal(temp)) {
|
||||
ADD_OP(_SHUFFLE_3_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)temp);
|
||||
ADD_OP(_SWAP, 2, 0);
|
||||
optimize_pop_top(ctx, this_instr, null);
|
||||
ADD_OP(_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)temp);
|
||||
ADD_OP(_SWAP, 3, 0);
|
||||
}
|
||||
res = sym_new_const(ctx, temp);
|
||||
CHECK_STACK_BOUNDS(-2);
|
||||
|
|
@ -5497,19 +5502,6 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _SHUFFLE_3_LOAD_CONST_INLINE_BORROW: {
|
||||
JitOptRef res;
|
||||
JitOptRef a;
|
||||
JitOptRef c;
|
||||
res = sym_new_not_null(ctx);
|
||||
a = sym_new_not_null(ctx);
|
||||
c = sym_new_not_null(ctx);
|
||||
stack_pointer[-3] = res;
|
||||
stack_pointer[-2] = a;
|
||||
stack_pointer[-1] = c;
|
||||
break;
|
||||
}
|
||||
|
||||
case _START_EXECUTOR: {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue