mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
GH-129709: Clean up tier two (GH-129710)
This commit is contained in:
parent
fbaa6c8ff0
commit
70e387c990
12 changed files with 97 additions and 348 deletions
2
Include/internal/pycore_uop_metadata.h
generated
2
Include/internal/pycore_uop_metadata.h
generated
|
@ -287,7 +287,7 @@ const uint16_t _PyUop_Flags[MAX_UOP_ID+1] = {
|
||||||
[_FATAL_ERROR] = 0,
|
[_FATAL_ERROR] = 0,
|
||||||
[_CHECK_VALIDITY_AND_SET_IP] = HAS_DEOPT_FLAG,
|
[_CHECK_VALIDITY_AND_SET_IP] = HAS_DEOPT_FLAG,
|
||||||
[_DEOPT] = 0,
|
[_DEOPT] = 0,
|
||||||
[_ERROR_POP_N] = HAS_ARG_FLAG | HAS_ESCAPES_FLAG,
|
[_ERROR_POP_N] = HAS_ARG_FLAG,
|
||||||
[_TIER2_RESUME_CHECK] = HAS_DEOPT_FLAG,
|
[_TIER2_RESUME_CHECK] = HAS_DEOPT_FLAG,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3526,6 +3526,7 @@ dummy_func(
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_MAYBE_EXPAND_METHOD, (callable[1], self_or_null[1], args[oparg] -- func[1], maybe_self[1], args[oparg])) {
|
op(_MAYBE_EXPAND_METHOD, (callable[1], self_or_null[1], args[oparg] -- func[1], maybe_self[1], args[oparg])) {
|
||||||
|
(void)args;
|
||||||
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
||||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||||
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
||||||
|
@ -3892,6 +3893,7 @@ dummy_func(
|
||||||
_CHECK_PERIODIC;
|
_CHECK_PERIODIC;
|
||||||
|
|
||||||
op(_CHECK_AND_ALLOCATE_OBJECT, (type_version/2, callable[1], null[1], args[oparg] -- init[1], self[1], args[oparg])) {
|
op(_CHECK_AND_ALLOCATE_OBJECT, (type_version/2, callable[1], null[1], args[oparg] -- init[1], self[1], args[oparg])) {
|
||||||
|
(void)args;
|
||||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||||
DEOPT_IF(!PyStackRef_IsNull(null[0]));
|
DEOPT_IF(!PyStackRef_IsNull(null[0]));
|
||||||
DEOPT_IF(!PyType_Check(callable_o));
|
DEOPT_IF(!PyType_Check(callable_o));
|
||||||
|
@ -4119,7 +4121,7 @@ dummy_func(
|
||||||
PyObject *res_o = PyLong_FromSsize_t(len_i);
|
PyObject *res_o = PyLong_FromSsize_t(len_i);
|
||||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||||
if (res_o == NULL) {
|
if (res_o == NULL) {
|
||||||
GOTO_ERROR(error);
|
ERROR_NO_POP();
|
||||||
}
|
}
|
||||||
PyStackRef_CLOSE(arg_stackref);
|
PyStackRef_CLOSE(arg_stackref);
|
||||||
DEAD(args);
|
DEAD(args);
|
||||||
|
@ -4364,6 +4366,7 @@ dummy_func(
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_MAYBE_EXPAND_METHOD_KW, (callable[1], self_or_null[1], args[oparg], kwnames_in -- func[1], maybe_self[1], args[oparg], kwnames_out)) {
|
op(_MAYBE_EXPAND_METHOD_KW, (callable[1], self_or_null[1], args[oparg], kwnames_in -- func[1], maybe_self[1], args[oparg], kwnames_out)) {
|
||||||
|
(void)args;
|
||||||
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
||||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||||
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
||||||
|
@ -5022,7 +5025,7 @@ dummy_func(
|
||||||
if (frame->lltrace >= 2) {
|
if (frame->lltrace >= 2) {
|
||||||
printf("SIDE EXIT: [UOp ");
|
printf("SIDE EXIT: [UOp ");
|
||||||
_PyUOpPrint(&next_uop[-1]);
|
_PyUOpPrint(&next_uop[-1]);
|
||||||
printf(", exit %u, temp %d, target %d -> %s]\n",
|
printf(", exit %lu, temp %d, target %d -> %s]\n",
|
||||||
exit - current_executor->exits, exit->temperature.value_and_backoff,
|
exit - current_executor->exits, exit->temperature.value_and_backoff,
|
||||||
(int)(target - _PyFrame_GetBytecode(frame)),
|
(int)(target - _PyFrame_GetBytecode(frame)),
|
||||||
_PyOpcode_OpName[target->op.code]);
|
_PyOpcode_OpName[target->op.code]);
|
||||||
|
@ -5032,11 +5035,11 @@ dummy_func(
|
||||||
exit->temperature = initial_temperature_backoff_counter();
|
exit->temperature = initial_temperature_backoff_counter();
|
||||||
Py_CLEAR(exit->executor);
|
Py_CLEAR(exit->executor);
|
||||||
}
|
}
|
||||||
|
tstate->previous_executor = (PyObject *)current_executor;
|
||||||
if (exit->executor == NULL) {
|
if (exit->executor == NULL) {
|
||||||
_Py_BackoffCounter temperature = exit->temperature;
|
_Py_BackoffCounter temperature = exit->temperature;
|
||||||
if (!backoff_counter_triggers(temperature)) {
|
if (!backoff_counter_triggers(temperature)) {
|
||||||
exit->temperature = advance_backoff_counter(temperature);
|
exit->temperature = advance_backoff_counter(temperature);
|
||||||
tstate->previous_executor = (PyObject *)current_executor;
|
|
||||||
GOTO_TIER_ONE(target);
|
GOTO_TIER_ONE(target);
|
||||||
}
|
}
|
||||||
_PyExecutorObject *executor;
|
_PyExecutorObject *executor;
|
||||||
|
@ -5049,20 +5052,13 @@ dummy_func(
|
||||||
int optimized = _PyOptimizer_Optimize(frame, target, &executor, chain_depth);
|
int optimized = _PyOptimizer_Optimize(frame, target, &executor, chain_depth);
|
||||||
if (optimized <= 0) {
|
if (optimized <= 0) {
|
||||||
exit->temperature = restart_backoff_counter(temperature);
|
exit->temperature = restart_backoff_counter(temperature);
|
||||||
if (optimized < 0) {
|
GOTO_TIER_ONE(optimized < 0 ? NULL : target);
|
||||||
GOTO_UNWIND();
|
|
||||||
}
|
|
||||||
tstate->previous_executor = (PyObject *)current_executor;
|
|
||||||
GOTO_TIER_ONE(target);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
exit->temperature = initial_temperature_backoff_counter();
|
|
||||||
}
|
}
|
||||||
|
exit->temperature = initial_temperature_backoff_counter();
|
||||||
}
|
}
|
||||||
exit->executor = executor;
|
exit->executor = executor;
|
||||||
}
|
}
|
||||||
Py_INCREF(exit->executor);
|
Py_INCREF(exit->executor);
|
||||||
tstate->previous_executor = (PyObject *)current_executor;
|
|
||||||
GOTO_TIER_TWO(exit->executor);
|
GOTO_TIER_TWO(exit->executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5130,7 +5126,7 @@ dummy_func(
|
||||||
if (frame->lltrace >= 2) {
|
if (frame->lltrace >= 2) {
|
||||||
printf("DYNAMIC EXIT: [UOp ");
|
printf("DYNAMIC EXIT: [UOp ");
|
||||||
_PyUOpPrint(&next_uop[-1]);
|
_PyUOpPrint(&next_uop[-1]);
|
||||||
printf(", exit %u, temp %d, target %d -> %s]\n",
|
printf(", exit %lu, temp %d, target %d -> %s]\n",
|
||||||
exit - current_executor->exits, exit->temperature.value_and_backoff,
|
exit - current_executor->exits, exit->temperature.value_and_backoff,
|
||||||
(int)(target - _PyFrame_GetBytecode(frame)),
|
(int)(target - _PyFrame_GetBytecode(frame)),
|
||||||
_PyOpcode_OpName[target->op.code]);
|
_PyOpcode_OpName[target->op.code]);
|
||||||
|
@ -5150,21 +5146,15 @@ dummy_func(
|
||||||
int optimized = _PyOptimizer_Optimize(frame, target, &executor, 0);
|
int optimized = _PyOptimizer_Optimize(frame, target, &executor, 0);
|
||||||
if (optimized <= 0) {
|
if (optimized <= 0) {
|
||||||
exit->temperature = restart_backoff_counter(exit->temperature);
|
exit->temperature = restart_backoff_counter(exit->temperature);
|
||||||
if (optimized < 0) {
|
GOTO_TIER_ONE(optimized < 0 ? NULL : target);
|
||||||
GOTO_UNWIND();
|
|
||||||
}
|
|
||||||
GOTO_TIER_ONE(target);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
exit->temperature = initial_temperature_backoff_counter();
|
|
||||||
}
|
}
|
||||||
|
exit->temperature = initial_temperature_backoff_counter();
|
||||||
}
|
}
|
||||||
GOTO_TIER_TWO(executor);
|
GOTO_TIER_TWO(executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
tier2 op(_START_EXECUTOR, (executor/4 --)) {
|
tier2 op(_START_EXECUTOR, (executor/4 --)) {
|
||||||
Py_DECREF(tstate->previous_executor);
|
Py_CLEAR(tstate->previous_executor);
|
||||||
tstate->previous_executor = NULL;
|
|
||||||
#ifndef _Py_JIT
|
#ifndef _Py_JIT
|
||||||
current_executor = (_PyExecutorObject*)executor;
|
current_executor = (_PyExecutorObject*)executor;
|
||||||
#endif
|
#endif
|
||||||
|
@ -5190,14 +5180,16 @@ dummy_func(
|
||||||
}
|
}
|
||||||
|
|
||||||
tier2 op(_DEOPT, (--)) {
|
tier2 op(_DEOPT, (--)) {
|
||||||
EXIT_TO_TIER1();
|
tstate->previous_executor = (PyObject *)current_executor;
|
||||||
|
GOTO_TIER_ONE(_PyFrame_GetBytecode(frame) + CURRENT_TARGET());
|
||||||
}
|
}
|
||||||
|
|
||||||
tier2 op(_ERROR_POP_N, (target/2 --)) {
|
tier2 op(_ERROR_POP_N, (target/2 --)) {
|
||||||
|
tstate->previous_executor = (PyObject *)current_executor;
|
||||||
assert(oparg == 0);
|
assert(oparg == 0);
|
||||||
frame->instr_ptr = _PyFrame_GetBytecode(frame) + target;
|
frame->instr_ptr = _PyFrame_GetBytecode(frame) + target;
|
||||||
SYNC_SP();
|
SYNC_SP();
|
||||||
GOTO_UNWIND();
|
GOTO_TIER_ONE(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Progress is guaranteed if we DEOPT on the eval breaker, because
|
/* Progress is guaranteed if we DEOPT on the eval breaker, because
|
||||||
|
|
|
@ -879,9 +879,6 @@ enter_tier_two:
|
||||||
#undef LOAD_IP
|
#undef LOAD_IP
|
||||||
#define LOAD_IP(UNUSED) (void)0
|
#define LOAD_IP(UNUSED) (void)0
|
||||||
|
|
||||||
#undef GOTO_ERROR
|
|
||||||
#define GOTO_ERROR(LABEL) goto LABEL ## _tier_two
|
|
||||||
|
|
||||||
#ifdef Py_STATS
|
#ifdef Py_STATS
|
||||||
// Disable these macros that apply to Tier 1 stats when we are in Tier 2
|
// Disable these macros that apply to Tier 1 stats when we are in Tier 2
|
||||||
#undef STAT_INC
|
#undef STAT_INC
|
||||||
|
@ -957,46 +954,17 @@ jump_to_error_target:
|
||||||
_PyOpcode_OpName[frame->instr_ptr->op.code]);
|
_PyOpcode_OpName[frame->instr_ptr->op.code]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
assert (next_uop[-1].format == UOP_FORMAT_JUMP);
|
assert(next_uop[-1].format == UOP_FORMAT_JUMP);
|
||||||
uint16_t target = uop_get_error_target(&next_uop[-1]);
|
uint16_t target = uop_get_error_target(&next_uop[-1]);
|
||||||
next_uop = current_executor->trace + target;
|
next_uop = current_executor->trace + target;
|
||||||
goto tier2_dispatch;
|
goto tier2_dispatch;
|
||||||
|
|
||||||
error_tier_two:
|
|
||||||
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
|
|
||||||
assert(next_uop[-1].format == UOP_FORMAT_TARGET);
|
|
||||||
frame->return_offset = 0; // Don't leave this random
|
|
||||||
Py_DECREF(current_executor);
|
|
||||||
tstate->previous_executor = NULL;
|
|
||||||
next_instr = frame->instr_ptr;
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
jump_to_jump_target:
|
jump_to_jump_target:
|
||||||
assert(next_uop[-1].format == UOP_FORMAT_JUMP);
|
assert(next_uop[-1].format == UOP_FORMAT_JUMP);
|
||||||
target = uop_get_jump_target(&next_uop[-1]);
|
target = uop_get_jump_target(&next_uop[-1]);
|
||||||
next_uop = current_executor->trace + target;
|
next_uop = current_executor->trace + target;
|
||||||
goto tier2_dispatch;
|
goto tier2_dispatch;
|
||||||
|
|
||||||
exit_to_tier1_dynamic:
|
|
||||||
next_instr = frame->instr_ptr;
|
|
||||||
goto goto_to_tier1;
|
|
||||||
exit_to_tier1:
|
|
||||||
assert(next_uop[-1].format == UOP_FORMAT_TARGET);
|
|
||||||
next_instr = next_uop[-1].target + _PyFrame_GetBytecode(frame);
|
|
||||||
goto_to_tier1:
|
|
||||||
#ifdef Py_DEBUG
|
|
||||||
if (frame->lltrace >= 2) {
|
|
||||||
printf("DEOPT: [UOp ");
|
|
||||||
_PyUOpPrint(&next_uop[-1]);
|
|
||||||
printf(" -> %s]\n",
|
|
||||||
_PyOpcode_OpName[next_instr->op.code]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
|
|
||||||
Py_DECREF(current_executor);
|
|
||||||
tstate->previous_executor = NULL;
|
|
||||||
DISPATCH();
|
|
||||||
|
|
||||||
#endif // _Py_JIT
|
#endif // _Py_JIT
|
||||||
|
|
||||||
#endif // _Py_TIER2
|
#endif // _Py_TIER2
|
||||||
|
|
|
@ -161,9 +161,6 @@ do { \
|
||||||
JUMP_TO_LABEL(start_frame); \
|
JUMP_TO_LABEL(start_frame); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
// Use this instead of 'goto error' so Tier 2 can go to a different label
|
|
||||||
#define GOTO_ERROR(LABEL) JUMP_TO_LABEL(LABEL)
|
|
||||||
|
|
||||||
/* Tuple access macros */
|
/* Tuple access macros */
|
||||||
|
|
||||||
#ifndef Py_DEBUG
|
#ifndef Py_DEBUG
|
||||||
|
@ -387,17 +384,19 @@ _PyFrame_SetStackPointer(frame, stack_pointer)
|
||||||
#define GOTO_TIER_TWO(EXECUTOR) \
|
#define GOTO_TIER_TWO(EXECUTOR) \
|
||||||
do { \
|
do { \
|
||||||
OPT_STAT_INC(traces_executed); \
|
OPT_STAT_INC(traces_executed); \
|
||||||
jit_func jitted = (EXECUTOR)->jit_code; \
|
_PyExecutorObject *_executor = (EXECUTOR); \
|
||||||
|
jit_func jitted = _executor->jit_code; \
|
||||||
|
/* Keep the shim frame alive via the executor: */ \
|
||||||
|
Py_INCREF(_executor); \
|
||||||
next_instr = jitted(frame, stack_pointer, tstate); \
|
next_instr = jitted(frame, stack_pointer, tstate); \
|
||||||
Py_DECREF(tstate->previous_executor); \
|
Py_DECREF(_executor); \
|
||||||
tstate->previous_executor = NULL; \
|
Py_CLEAR(tstate->previous_executor); \
|
||||||
frame = tstate->current_frame; \
|
frame = tstate->current_frame; \
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame); \
|
||||||
if (next_instr == NULL) { \
|
if (next_instr == NULL) { \
|
||||||
next_instr = frame->instr_ptr; \
|
next_instr = frame->instr_ptr; \
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame); \
|
|
||||||
goto error; \
|
goto error; \
|
||||||
} \
|
} \
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame); \
|
|
||||||
DISPATCH(); \
|
DISPATCH(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
|
@ -410,24 +409,25 @@ do { \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GOTO_TIER_ONE(TARGET) \
|
#define GOTO_TIER_ONE(TARGET) \
|
||||||
do { \
|
do { \
|
||||||
Py_DECREF(tstate->previous_executor); \
|
next_instr = (TARGET); \
|
||||||
tstate->previous_executor = NULL; \
|
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist); \
|
||||||
next_instr = target; \
|
Py_CLEAR(tstate->previous_executor); \
|
||||||
DISPATCH(); \
|
if (next_instr == NULL) { \
|
||||||
|
next_instr = frame->instr_ptr; \
|
||||||
|
goto error; \
|
||||||
|
} \
|
||||||
|
DISPATCH(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define CURRENT_OPARG() (next_uop[-1].oparg)
|
#define CURRENT_OPARG() (next_uop[-1].oparg)
|
||||||
|
|
||||||
#define CURRENT_OPERAND0() (next_uop[-1].operand0)
|
#define CURRENT_OPERAND0() (next_uop[-1].operand0)
|
||||||
#define CURRENT_OPERAND1() (next_uop[-1].operand1)
|
#define CURRENT_OPERAND1() (next_uop[-1].operand1)
|
||||||
|
#define CURRENT_TARGET() (next_uop[-1].target)
|
||||||
|
|
||||||
#define JUMP_TO_JUMP_TARGET() goto jump_to_jump_target
|
#define JUMP_TO_JUMP_TARGET() goto jump_to_jump_target
|
||||||
#define JUMP_TO_ERROR() goto jump_to_error_target
|
#define JUMP_TO_ERROR() goto jump_to_error_target
|
||||||
#define GOTO_UNWIND() goto error_tier_two
|
|
||||||
#define EXIT_TO_TIER1() goto exit_to_tier1
|
|
||||||
#define EXIT_TO_TIER1_DYNAMIC() goto exit_to_tier1_dynamic;
|
|
||||||
|
|
||||||
/* Stackref macros */
|
/* Stackref macros */
|
||||||
|
|
||||||
|
|
49
Python/executor_cases.c.h
generated
49
Python/executor_cases.c.h
generated
|
@ -4369,6 +4369,8 @@
|
||||||
callable = &stack_pointer[-2 - oparg];
|
callable = &stack_pointer[-2 - oparg];
|
||||||
func = &stack_pointer[-2 - oparg];
|
func = &stack_pointer[-2 - oparg];
|
||||||
maybe_self = &stack_pointer[-1 - oparg];
|
maybe_self = &stack_pointer[-1 - oparg];
|
||||||
|
args = &stack_pointer[-oparg];
|
||||||
|
(void)args;
|
||||||
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
||||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||||
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
||||||
|
@ -4936,7 +4938,9 @@
|
||||||
callable = &stack_pointer[-2 - oparg];
|
callable = &stack_pointer[-2 - oparg];
|
||||||
init = &stack_pointer[-2 - oparg];
|
init = &stack_pointer[-2 - oparg];
|
||||||
self = &stack_pointer[-1 - oparg];
|
self = &stack_pointer[-1 - oparg];
|
||||||
|
args = &stack_pointer[-oparg];
|
||||||
uint32_t type_version = (uint32_t)CURRENT_OPERAND0();
|
uint32_t type_version = (uint32_t)CURRENT_OPERAND0();
|
||||||
|
(void)args;
|
||||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||||
if (!PyStackRef_IsNull(null[0])) {
|
if (!PyStackRef_IsNull(null[0])) {
|
||||||
UOP_STAT_INC(uopcode, miss);
|
UOP_STAT_INC(uopcode, miss);
|
||||||
|
@ -4989,9 +4993,9 @@
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
_PyInterpreterFrame *shim = _PyFrame_PushTrampolineUnchecked(
|
_PyInterpreterFrame *shim = _PyFrame_PushTrampolineUnchecked(
|
||||||
tstate, (PyCodeObject *)&_Py_InitCleanup, 1, frame);
|
tstate, (PyCodeObject *)&_Py_InitCleanup, 1, frame);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
assert(_PyFrame_GetBytecode(shim)[0].op.code == EXIT_INIT_CHECK);
|
assert(_PyFrame_GetBytecode(shim)[0].op.code == EXIT_INIT_CHECK);
|
||||||
assert(_PyFrame_GetBytecode(shim)[1].op.code == RETURN_VALUE);
|
assert(_PyFrame_GetBytecode(shim)[1].op.code == RETURN_VALUE);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
|
||||||
/* Push self onto stack of shim */
|
/* Push self onto stack of shim */
|
||||||
shim->localsplus[0] = PyStackRef_DUP(self[0]);
|
shim->localsplus[0] = PyStackRef_DUP(self[0]);
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
@ -5317,7 +5321,7 @@
|
||||||
PyObject *res_o = PyLong_FromSsize_t(len_i);
|
PyObject *res_o = PyLong_FromSsize_t(len_i);
|
||||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||||
if (res_o == NULL) {
|
if (res_o == NULL) {
|
||||||
GOTO_ERROR(error);
|
JUMP_TO_ERROR();
|
||||||
}
|
}
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
PyStackRef_CLOSE(arg_stackref);
|
PyStackRef_CLOSE(arg_stackref);
|
||||||
|
@ -5723,6 +5727,8 @@
|
||||||
callable = &stack_pointer[-3 - oparg];
|
callable = &stack_pointer[-3 - oparg];
|
||||||
func = &stack_pointer[-3 - oparg];
|
func = &stack_pointer[-3 - oparg];
|
||||||
maybe_self = &stack_pointer[-2 - oparg];
|
maybe_self = &stack_pointer[-2 - oparg];
|
||||||
|
args = &stack_pointer[-1 - oparg];
|
||||||
|
(void)args;
|
||||||
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
||||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||||
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
||||||
|
@ -6339,16 +6345,14 @@
|
||||||
PyObject *exit_p = (PyObject *)CURRENT_OPERAND0();
|
PyObject *exit_p = (PyObject *)CURRENT_OPERAND0();
|
||||||
_PyExitData *exit = (_PyExitData *)exit_p;
|
_PyExitData *exit = (_PyExitData *)exit_p;
|
||||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
|
||||||
_Py_CODEUNIT *target = _PyFrame_GetBytecode(frame) + exit->target;
|
_Py_CODEUNIT *target = _PyFrame_GetBytecode(frame) + exit->target;
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
|
||||||
#if defined(Py_DEBUG) && !defined(_Py_JIT)
|
#if defined(Py_DEBUG) && !defined(_Py_JIT)
|
||||||
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
|
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
|
||||||
if (frame->lltrace >= 2) {
|
if (frame->lltrace >= 2) {
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
printf("SIDE EXIT: [UOp ");
|
printf("SIDE EXIT: [UOp ");
|
||||||
_PyUOpPrint(&next_uop[-1]);
|
_PyUOpPrint(&next_uop[-1]);
|
||||||
printf(", exit %u, temp %d, target %d -> %s]\n",
|
printf(", exit %lu, temp %d, target %d -> %s]\n",
|
||||||
exit - current_executor->exits, exit->temperature.value_and_backoff,
|
exit - current_executor->exits, exit->temperature.value_and_backoff,
|
||||||
(int)(target - _PyFrame_GetBytecode(frame)),
|
(int)(target - _PyFrame_GetBytecode(frame)),
|
||||||
_PyOpcode_OpName[target->op.code]);
|
_PyOpcode_OpName[target->op.code]);
|
||||||
|
@ -6361,11 +6365,11 @@
|
||||||
Py_CLEAR(exit->executor);
|
Py_CLEAR(exit->executor);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
|
tstate->previous_executor = (PyObject *)current_executor;
|
||||||
if (exit->executor == NULL) {
|
if (exit->executor == NULL) {
|
||||||
_Py_BackoffCounter temperature = exit->temperature;
|
_Py_BackoffCounter temperature = exit->temperature;
|
||||||
if (!backoff_counter_triggers(temperature)) {
|
if (!backoff_counter_triggers(temperature)) {
|
||||||
exit->temperature = advance_backoff_counter(temperature);
|
exit->temperature = advance_backoff_counter(temperature);
|
||||||
tstate->previous_executor = (PyObject *)current_executor;
|
|
||||||
GOTO_TIER_ONE(target);
|
GOTO_TIER_ONE(target);
|
||||||
}
|
}
|
||||||
_PyExecutorObject *executor;
|
_PyExecutorObject *executor;
|
||||||
|
@ -6380,20 +6384,13 @@
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
if (optimized <= 0) {
|
if (optimized <= 0) {
|
||||||
exit->temperature = restart_backoff_counter(temperature);
|
exit->temperature = restart_backoff_counter(temperature);
|
||||||
if (optimized < 0) {
|
GOTO_TIER_ONE(optimized < 0 ? NULL : target);
|
||||||
GOTO_UNWIND();
|
|
||||||
}
|
|
||||||
tstate->previous_executor = (PyObject *)current_executor;
|
|
||||||
GOTO_TIER_ONE(target);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
exit->temperature = initial_temperature_backoff_counter();
|
|
||||||
}
|
}
|
||||||
|
exit->temperature = initial_temperature_backoff_counter();
|
||||||
}
|
}
|
||||||
exit->executor = executor;
|
exit->executor = executor;
|
||||||
}
|
}
|
||||||
Py_INCREF(exit->executor);
|
Py_INCREF(exit->executor);
|
||||||
tstate->previous_executor = (PyObject *)current_executor;
|
|
||||||
GOTO_TIER_TWO(exit->executor);
|
GOTO_TIER_TWO(exit->executor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6524,7 +6521,7 @@
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
printf("DYNAMIC EXIT: [UOp ");
|
printf("DYNAMIC EXIT: [UOp ");
|
||||||
_PyUOpPrint(&next_uop[-1]);
|
_PyUOpPrint(&next_uop[-1]);
|
||||||
printf(", exit %u, temp %d, target %d -> %s]\n",
|
printf(", exit %lu, temp %d, target %d -> %s]\n",
|
||||||
exit - current_executor->exits, exit->temperature.value_and_backoff,
|
exit - current_executor->exits, exit->temperature.value_and_backoff,
|
||||||
(int)(target - _PyFrame_GetBytecode(frame)),
|
(int)(target - _PyFrame_GetBytecode(frame)),
|
||||||
_PyOpcode_OpName[target->op.code]);
|
_PyOpcode_OpName[target->op.code]);
|
||||||
|
@ -6547,14 +6544,9 @@
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
if (optimized <= 0) {
|
if (optimized <= 0) {
|
||||||
exit->temperature = restart_backoff_counter(exit->temperature);
|
exit->temperature = restart_backoff_counter(exit->temperature);
|
||||||
if (optimized < 0) {
|
GOTO_TIER_ONE(optimized < 0 ? NULL : target);
|
||||||
GOTO_UNWIND();
|
|
||||||
}
|
|
||||||
GOTO_TIER_ONE(target);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
exit->temperature = initial_temperature_backoff_counter();
|
|
||||||
}
|
}
|
||||||
|
exit->temperature = initial_temperature_backoff_counter();
|
||||||
}
|
}
|
||||||
GOTO_TIER_TWO(executor);
|
GOTO_TIER_TWO(executor);
|
||||||
break;
|
break;
|
||||||
|
@ -6563,9 +6555,8 @@
|
||||||
case _START_EXECUTOR: {
|
case _START_EXECUTOR: {
|
||||||
PyObject *executor = (PyObject *)CURRENT_OPERAND0();
|
PyObject *executor = (PyObject *)CURRENT_OPERAND0();
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
Py_DECREF(tstate->previous_executor);
|
Py_CLEAR(tstate->previous_executor);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
tstate->previous_executor = NULL;
|
|
||||||
#ifndef _Py_JIT
|
#ifndef _Py_JIT
|
||||||
current_executor = (_PyExecutorObject*)executor;
|
current_executor = (_PyExecutorObject*)executor;
|
||||||
#endif
|
#endif
|
||||||
|
@ -6599,18 +6590,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _DEOPT: {
|
case _DEOPT: {
|
||||||
EXIT_TO_TIER1();
|
tstate->previous_executor = (PyObject *)current_executor;
|
||||||
|
GOTO_TIER_ONE(_PyFrame_GetBytecode(frame) + CURRENT_TARGET());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case _ERROR_POP_N: {
|
case _ERROR_POP_N: {
|
||||||
oparg = CURRENT_OPARG();
|
oparg = CURRENT_OPARG();
|
||||||
uint32_t target = (uint32_t)CURRENT_OPERAND0();
|
uint32_t target = (uint32_t)CURRENT_OPERAND0();
|
||||||
|
tstate->previous_executor = (PyObject *)current_executor;
|
||||||
assert(oparg == 0);
|
assert(oparg == 0);
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
|
||||||
frame->instr_ptr = _PyFrame_GetBytecode(frame) + target;
|
frame->instr_ptr = _PyFrame_GetBytecode(frame) + target;
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
GOTO_TIER_ONE(NULL);
|
||||||
GOTO_UNWIND();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
26
Python/generated_cases.c.h
generated
26
Python/generated_cases.c.h
generated
|
@ -1278,6 +1278,8 @@
|
||||||
args = &stack_pointer[-oparg];
|
args = &stack_pointer[-oparg];
|
||||||
func = &stack_pointer[-2 - oparg];
|
func = &stack_pointer[-2 - oparg];
|
||||||
maybe_self = &stack_pointer[-1 - oparg];
|
maybe_self = &stack_pointer[-1 - oparg];
|
||||||
|
args = &stack_pointer[-oparg];
|
||||||
|
(void)args;
|
||||||
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
||||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||||
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
||||||
|
@ -1440,7 +1442,9 @@
|
||||||
callable = &stack_pointer[-2 - oparg];
|
callable = &stack_pointer[-2 - oparg];
|
||||||
init = &stack_pointer[-2 - oparg];
|
init = &stack_pointer[-2 - oparg];
|
||||||
self = &stack_pointer[-1 - oparg];
|
self = &stack_pointer[-1 - oparg];
|
||||||
|
args = &stack_pointer[-oparg];
|
||||||
uint32_t type_version = read_u32(&this_instr[2].cache);
|
uint32_t type_version = read_u32(&this_instr[2].cache);
|
||||||
|
(void)args;
|
||||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||||
if (!PyStackRef_IsNull(null[0])) {
|
if (!PyStackRef_IsNull(null[0])) {
|
||||||
UPDATE_MISS_STATS(CALL);
|
UPDATE_MISS_STATS(CALL);
|
||||||
|
@ -1491,9 +1495,9 @@
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
_PyInterpreterFrame *shim = _PyFrame_PushTrampolineUnchecked(
|
_PyInterpreterFrame *shim = _PyFrame_PushTrampolineUnchecked(
|
||||||
tstate, (PyCodeObject *)&_Py_InitCleanup, 1, frame);
|
tstate, (PyCodeObject *)&_Py_InitCleanup, 1, frame);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
assert(_PyFrame_GetBytecode(shim)[0].op.code == EXIT_INIT_CHECK);
|
assert(_PyFrame_GetBytecode(shim)[0].op.code == EXIT_INIT_CHECK);
|
||||||
assert(_PyFrame_GetBytecode(shim)[1].op.code == RETURN_VALUE);
|
assert(_PyFrame_GetBytecode(shim)[1].op.code == RETURN_VALUE);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
|
||||||
/* Push self onto stack of shim */
|
/* Push self onto stack of shim */
|
||||||
shim->localsplus[0] = PyStackRef_DUP(self[0]);
|
shim->localsplus[0] = PyStackRef_DUP(self[0]);
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
@ -2532,6 +2536,8 @@
|
||||||
args = &stack_pointer[-1 - oparg];
|
args = &stack_pointer[-1 - oparg];
|
||||||
func = &stack_pointer[-3 - oparg];
|
func = &stack_pointer[-3 - oparg];
|
||||||
maybe_self = &stack_pointer[-2 - oparg];
|
maybe_self = &stack_pointer[-2 - oparg];
|
||||||
|
args = &stack_pointer[-1 - oparg];
|
||||||
|
(void)args;
|
||||||
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
||||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||||
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
||||||
|
@ -3058,7 +3064,7 @@
|
||||||
PyObject *res_o = PyLong_FromSsize_t(len_i);
|
PyObject *res_o = PyLong_FromSsize_t(len_i);
|
||||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||||
if (res_o == NULL) {
|
if (res_o == NULL) {
|
||||||
GOTO_ERROR(error);
|
JUMP_TO_LABEL(error);
|
||||||
}
|
}
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
PyStackRef_CLOSE(arg_stackref);
|
PyStackRef_CLOSE(arg_stackref);
|
||||||
|
@ -5679,6 +5685,8 @@
|
||||||
callable = &stack_pointer[-2 - oparg];
|
callable = &stack_pointer[-2 - oparg];
|
||||||
func = &stack_pointer[-2 - oparg];
|
func = &stack_pointer[-2 - oparg];
|
||||||
maybe_self = &stack_pointer[-1 - oparg];
|
maybe_self = &stack_pointer[-1 - oparg];
|
||||||
|
args = &stack_pointer[-oparg];
|
||||||
|
(void)args;
|
||||||
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
||||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||||
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
||||||
|
@ -6082,6 +6090,8 @@
|
||||||
kwnames_in = stack_pointer[-1];
|
kwnames_in = stack_pointer[-1];
|
||||||
func = &stack_pointer[-3 - oparg];
|
func = &stack_pointer[-3 - oparg];
|
||||||
maybe_self = &stack_pointer[-2 - oparg];
|
maybe_self = &stack_pointer[-2 - oparg];
|
||||||
|
args = &stack_pointer[-1 - oparg];
|
||||||
|
(void)args;
|
||||||
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
if (PyStackRef_TYPE(callable[0]) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) {
|
||||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||||
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
PyObject *self = ((PyMethodObject *)callable_o)->im_self;
|
||||||
|
@ -6397,9 +6407,7 @@
|
||||||
int original_opcode = 0;
|
int original_opcode = 0;
|
||||||
if (tstate->tracing) {
|
if (tstate->tracing) {
|
||||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
|
||||||
int index = (int)(this_instr - _PyFrame_GetBytecode(frame));
|
int index = (int)(this_instr - _PyFrame_GetBytecode(frame));
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
|
||||||
original_opcode = code->_co_monitoring->lines->data[index*code->_co_monitoring->lines->bytes_per_entry];
|
original_opcode = code->_co_monitoring->lines->data[index*code->_co_monitoring->lines->bytes_per_entry];
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
} else {
|
} else {
|
||||||
|
@ -6672,9 +6680,7 @@
|
||||||
if (bytecode == NULL) {
|
if (bytecode == NULL) {
|
||||||
JUMP_TO_LABEL(error);
|
JUMP_TO_LABEL(error);
|
||||||
}
|
}
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
|
||||||
ptrdiff_t off = this_instr - _PyFrame_GetBytecode(frame);
|
ptrdiff_t off = this_instr - _PyFrame_GetBytecode(frame);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
|
||||||
frame->tlbc_index = ((_PyThreadStateImpl *)tstate)->tlbc_index;
|
frame->tlbc_index = ((_PyThreadStateImpl *)tstate)->tlbc_index;
|
||||||
frame->instr_ptr = bytecode + off;
|
frame->instr_ptr = bytecode + off;
|
||||||
// Make sure this_instr gets reset correctley for any uops that
|
// Make sure this_instr gets reset correctley for any uops that
|
||||||
|
@ -9492,11 +9498,7 @@
|
||||||
if (oparg) {
|
if (oparg) {
|
||||||
PyObject *lasti = PyStackRef_AsPyObjectBorrow(values[0]);
|
PyObject *lasti = PyStackRef_AsPyObjectBorrow(values[0]);
|
||||||
if (PyLong_Check(lasti)) {
|
if (PyLong_Check(lasti)) {
|
||||||
stack_pointer += -1;
|
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
|
||||||
frame->instr_ptr = _PyFrame_GetBytecode(frame) + PyLong_AsLong(lasti);
|
frame->instr_ptr = _PyFrame_GetBytecode(frame) + PyLong_AsLong(lasti);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
|
||||||
assert(!_PyErr_Occurred(tstate));
|
assert(!_PyErr_Occurred(tstate));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -9508,8 +9510,6 @@
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
JUMP_TO_LABEL(error);
|
JUMP_TO_LABEL(error);
|
||||||
}
|
}
|
||||||
stack_pointer += 1;
|
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
|
||||||
}
|
}
|
||||||
assert(exc && PyExceptionInstance_Check(exc));
|
assert(exc && PyExceptionInstance_Check(exc));
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
|
@ -9558,9 +9558,7 @@
|
||||||
if (bytecode == NULL) {
|
if (bytecode == NULL) {
|
||||||
JUMP_TO_LABEL(error);
|
JUMP_TO_LABEL(error);
|
||||||
}
|
}
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
|
||||||
ptrdiff_t off = this_instr - _PyFrame_GetBytecode(frame);
|
ptrdiff_t off = this_instr - _PyFrame_GetBytecode(frame);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
|
||||||
frame->tlbc_index = ((_PyThreadStateImpl *)tstate)->tlbc_index;
|
frame->tlbc_index = ((_PyThreadStateImpl *)tstate)->tlbc_index;
|
||||||
frame->instr_ptr = bytecode + off;
|
frame->instr_ptr = bytecode + off;
|
||||||
// Make sure this_instr gets reset correctley for any uops that
|
// Make sure this_instr gets reset correctley for any uops that
|
||||||
|
|
|
@ -385,9 +385,6 @@ dummy_func(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_BINARY_SUBSCR_INIT_CALL, (container, sub, getitem -- new_frame: _Py_UOpsAbstractFrame *)) {
|
op(_BINARY_SUBSCR_INIT_CALL, (container, sub, getitem -- new_frame: _Py_UOpsAbstractFrame *)) {
|
||||||
(void)container;
|
|
||||||
(void)sub;
|
|
||||||
(void)getitem;
|
|
||||||
new_frame = NULL;
|
new_frame = NULL;
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
}
|
}
|
||||||
|
@ -434,8 +431,6 @@ dummy_func(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_COMPARE_OP, (left, right -- res)) {
|
op(_COMPARE_OP, (left, right -- res)) {
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
if (oparg & 16) {
|
if (oparg & 16) {
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
}
|
}
|
||||||
|
@ -445,32 +440,22 @@ dummy_func(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_COMPARE_OP_INT, (left, right -- res)) {
|
op(_COMPARE_OP_INT, (left, right -- res)) {
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_COMPARE_OP_FLOAT, (left, right -- res)) {
|
op(_COMPARE_OP_FLOAT, (left, right -- res)) {
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_COMPARE_OP_STR, (left, right -- res)) {
|
op(_COMPARE_OP_STR, (left, right -- res)) {
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_IS_OP, (left, right -- res)) {
|
op(_IS_OP, (left, right -- res)) {
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_CONTAINS_OP, (left, right -- res)) {
|
op(_CONTAINS_OP, (left, right -- res)) {
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +507,6 @@ dummy_func(void) {
|
||||||
op(_LOAD_ATTR_INSTANCE_VALUE, (offset/1, owner -- attr)) {
|
op(_LOAD_ATTR_INSTANCE_VALUE, (offset/1, owner -- attr)) {
|
||||||
attr = sym_new_not_null(ctx);
|
attr = sym_new_not_null(ctx);
|
||||||
(void)offset;
|
(void)offset;
|
||||||
(void)owner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_CHECK_ATTR_MODULE_PUSH_KEYS, (dict_version/2, owner -- owner, mod_keys)) {
|
op(_CHECK_ATTR_MODULE_PUSH_KEYS, (dict_version/2, owner -- owner, mod_keys)) {
|
||||||
|
@ -583,26 +567,21 @@ dummy_func(void) {
|
||||||
|
|
||||||
op(_CHECK_ATTR_WITH_HINT, (owner -- owner, dict)) {
|
op(_CHECK_ATTR_WITH_HINT, (owner -- owner, dict)) {
|
||||||
dict = sym_new_not_null(ctx);
|
dict = sym_new_not_null(ctx);
|
||||||
(void)owner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_LOAD_ATTR_WITH_HINT, (hint/1, owner, dict -- attr)) {
|
op(_LOAD_ATTR_WITH_HINT, (hint/1, owner, dict -- attr)) {
|
||||||
attr = sym_new_not_null(ctx);
|
attr = sym_new_not_null(ctx);
|
||||||
(void)hint;
|
(void)hint;
|
||||||
(void)owner;
|
|
||||||
(void)dict;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_LOAD_ATTR_SLOT, (index/1, owner -- attr)) {
|
op(_LOAD_ATTR_SLOT, (index/1, owner -- attr)) {
|
||||||
attr = sym_new_not_null(ctx);
|
attr = sym_new_not_null(ctx);
|
||||||
(void)index;
|
(void)index;
|
||||||
(void)owner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_LOAD_ATTR_CLASS, (descr/4, owner -- attr)) {
|
op(_LOAD_ATTR_CLASS, (descr/4, owner -- attr)) {
|
||||||
attr = sym_new_not_null(ctx);
|
attr = sym_new_not_null(ctx);
|
||||||
(void)descr;
|
(void)descr;
|
||||||
(void)owner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_LOAD_ATTR_METHOD_WITH_VALUES, (descr/4, owner -- attr, self)) {
|
op(_LOAD_ATTR_METHOD_WITH_VALUES, (descr/4, owner -- attr, self)) {
|
||||||
|
@ -625,19 +604,16 @@ dummy_func(void) {
|
||||||
|
|
||||||
op(_LOAD_ATTR_PROPERTY_FRAME, (fget/4, owner -- new_frame: _Py_UOpsAbstractFrame *)) {
|
op(_LOAD_ATTR_PROPERTY_FRAME, (fget/4, owner -- new_frame: _Py_UOpsAbstractFrame *)) {
|
||||||
(void)fget;
|
(void)fget;
|
||||||
(void)owner;
|
|
||||||
new_frame = NULL;
|
new_frame = NULL;
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_INIT_CALL_BOUND_METHOD_EXACT_ARGS, (callable[1], self_or_null[1], unused[oparg] -- callable[1], self_or_null[1], unused[oparg])) {
|
op(_INIT_CALL_BOUND_METHOD_EXACT_ARGS, (callable[1], self_or_null[1], unused[oparg] -- callable[1], self_or_null[1], unused[oparg])) {
|
||||||
(void)callable;
|
|
||||||
callable[0] = sym_new_not_null(ctx);
|
callable[0] = sym_new_not_null(ctx);
|
||||||
self_or_null[0] = sym_new_not_null(ctx);
|
self_or_null[0] = sym_new_not_null(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_CHECK_FUNCTION_VERSION, (func_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
|
op(_CHECK_FUNCTION_VERSION, (func_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
|
||||||
(void)self_or_null;
|
|
||||||
if (sym_is_const(callable) && sym_matches_type(callable, &PyFunction_Type)) {
|
if (sym_is_const(callable) && sym_matches_type(callable, &PyFunction_Type)) {
|
||||||
assert(PyFunction_Check(sym_get_const(callable)));
|
assert(PyFunction_Check(sym_get_const(callable)));
|
||||||
REPLACE_OP(this_instr, _CHECK_FUNCTION_VERSION_INLINE, 0, func_version);
|
REPLACE_OP(this_instr, _CHECK_FUNCTION_VERSION_INLINE, 0, func_version);
|
||||||
|
@ -657,7 +633,6 @@ dummy_func(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)self_or_null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_CHECK_CALL_BOUND_METHOD_EXACT_ARGS, (callable, null, unused[oparg] -- callable, null, unused[oparg])) {
|
op(_CHECK_CALL_BOUND_METHOD_EXACT_ARGS, (callable, null, unused[oparg] -- callable, null, unused[oparg])) {
|
||||||
|
@ -667,7 +642,6 @@ dummy_func(void) {
|
||||||
|
|
||||||
op(_INIT_CALL_PY_EXACT_ARGS, (callable, self_or_null, args[oparg] -- new_frame: _Py_UOpsAbstractFrame *)) {
|
op(_INIT_CALL_PY_EXACT_ARGS, (callable, self_or_null, args[oparg] -- new_frame: _Py_UOpsAbstractFrame *)) {
|
||||||
int argcount = oparg;
|
int argcount = oparg;
|
||||||
(void)callable;
|
|
||||||
|
|
||||||
PyCodeObject *co = NULL;
|
PyCodeObject *co = NULL;
|
||||||
assert((this_instr + 2)->opcode == _PUSH_FRAME);
|
assert((this_instr + 2)->opcode == _PUSH_FRAME);
|
||||||
|
@ -695,16 +669,12 @@ dummy_func(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_MAYBE_EXPAND_METHOD, (callable, self_or_null, args[oparg] -- func, maybe_self, args[oparg])) {
|
op(_MAYBE_EXPAND_METHOD, (callable, self_or_null, args[oparg] -- func, maybe_self, args[oparg])) {
|
||||||
(void)callable;
|
|
||||||
(void)self_or_null;
|
|
||||||
(void)args;
|
(void)args;
|
||||||
func = sym_new_not_null(ctx);
|
func = sym_new_not_null(ctx);
|
||||||
maybe_self = sym_new_not_null(ctx);
|
maybe_self = sym_new_not_null(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_PY_FRAME_GENERAL, (callable, self_or_null, args[oparg] -- new_frame: _Py_UOpsAbstractFrame *)) {
|
op(_PY_FRAME_GENERAL, (callable, self_or_null, args[oparg] -- new_frame: _Py_UOpsAbstractFrame *)) {
|
||||||
(void)(self_or_null);
|
|
||||||
(void)(callable);
|
|
||||||
PyCodeObject *co = NULL;
|
PyCodeObject *co = NULL;
|
||||||
assert((this_instr + 2)->opcode == _PUSH_FRAME);
|
assert((this_instr + 2)->opcode == _PUSH_FRAME);
|
||||||
co = get_code_with_logging((this_instr + 2));
|
co = get_code_with_logging((this_instr + 2));
|
||||||
|
@ -717,27 +687,18 @@ dummy_func(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_PY_FRAME_KW, (callable, self_or_null, args[oparg], kwnames -- new_frame: _Py_UOpsAbstractFrame *)) {
|
op(_PY_FRAME_KW, (callable, self_or_null, args[oparg], kwnames -- new_frame: _Py_UOpsAbstractFrame *)) {
|
||||||
(void)callable;
|
|
||||||
(void)self_or_null;
|
|
||||||
(void)args;
|
|
||||||
(void)kwnames;
|
|
||||||
new_frame = NULL;
|
new_frame = NULL;
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_CHECK_AND_ALLOCATE_OBJECT, (type_version/2, callable, null, args[oparg] -- self, init, args[oparg])) {
|
op(_CHECK_AND_ALLOCATE_OBJECT, (type_version/2, callable, null, args[oparg] -- self, init, args[oparg])) {
|
||||||
(void)type_version;
|
(void)type_version;
|
||||||
(void)callable;
|
|
||||||
(void)null;
|
|
||||||
(void)args;
|
(void)args;
|
||||||
self = sym_new_not_null(ctx);
|
self = sym_new_not_null(ctx);
|
||||||
init = sym_new_not_null(ctx);
|
init = sym_new_not_null(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_CREATE_INIT_FRAME, (self, init, args[oparg] -- init_frame: _Py_UOpsAbstractFrame *)) {
|
op(_CREATE_INIT_FRAME, (self, init, args[oparg] -- init_frame: _Py_UOpsAbstractFrame *)) {
|
||||||
(void)self;
|
|
||||||
(void)init;
|
|
||||||
(void)args;
|
|
||||||
init_frame = NULL;
|
init_frame = NULL;
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
}
|
}
|
||||||
|
@ -806,7 +767,7 @@ dummy_func(void) {
|
||||||
corresponding_check_stack = this_instr;
|
corresponding_check_stack = this_instr;
|
||||||
}
|
}
|
||||||
|
|
||||||
op (_CHECK_STACK_SPACE_OPERAND, ( -- )) {
|
op (_CHECK_STACK_SPACE_OPERAND, (framesize/2 -- )) {
|
||||||
(void)framesize;
|
(void)framesize;
|
||||||
/* We should never see _CHECK_STACK_SPACE_OPERANDs.
|
/* We should never see _CHECK_STACK_SPACE_OPERANDs.
|
||||||
* They are only created at the end of this pass. */
|
* They are only created at the end of this pass. */
|
||||||
|
@ -848,7 +809,6 @@ dummy_func(void) {
|
||||||
|
|
||||||
op(_UNPACK_SEQUENCE, (seq -- values[oparg])) {
|
op(_UNPACK_SEQUENCE, (seq -- values[oparg])) {
|
||||||
/* This has to be done manually */
|
/* This has to be done manually */
|
||||||
(void)seq;
|
|
||||||
for (int i = 0; i < oparg; i++) {
|
for (int i = 0; i < oparg; i++) {
|
||||||
values[i] = sym_new_unknown(ctx);
|
values[i] = sym_new_unknown(ctx);
|
||||||
}
|
}
|
||||||
|
@ -856,7 +816,6 @@ dummy_func(void) {
|
||||||
|
|
||||||
op(_UNPACK_EX, (seq -- values[oparg & 0xFF], unused, unused[oparg >> 8])) {
|
op(_UNPACK_EX, (seq -- values[oparg & 0xFF], unused, unused[oparg >> 8])) {
|
||||||
/* This has to be done manually */
|
/* This has to be done manually */
|
||||||
(void)seq;
|
|
||||||
int totalargs = (oparg & 0xFF) + (oparg >> 8) + 1;
|
int totalargs = (oparg & 0xFF) + (oparg >> 8) + 1;
|
||||||
for (int i = 0; i < totalargs; i++) {
|
for (int i = 0; i < totalargs; i++) {
|
||||||
values[i] = sym_new_unknown(ctx);
|
values[i] = sym_new_unknown(ctx);
|
||||||
|
@ -865,7 +824,6 @@ dummy_func(void) {
|
||||||
|
|
||||||
op(_ITER_NEXT_RANGE, (iter -- iter, next)) {
|
op(_ITER_NEXT_RANGE, (iter -- iter, next)) {
|
||||||
next = sym_new_type(ctx, &PyLong_Type);
|
next = sym_new_type(ctx, &PyLong_Type);
|
||||||
(void)iter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_GUARD_IS_TRUE_POP, (flag -- )) {
|
op(_GUARD_IS_TRUE_POP, (flag -- )) {
|
||||||
|
@ -917,7 +875,6 @@ dummy_func(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_LOAD_SPECIAL, (owner -- attr, self_or_null)) {
|
op(_LOAD_SPECIAL, (owner -- attr, self_or_null)) {
|
||||||
(void)owner;
|
|
||||||
attr = sym_new_not_null(ctx);
|
attr = sym_new_not_null(ctx);
|
||||||
self_or_null = sym_new_unknown(ctx);
|
self_or_null = sym_new_unknown(ctx);
|
||||||
}
|
}
|
||||||
|
|
129
Python/optimizer_cases.c.h
generated
129
Python/optimizer_cases.c.h
generated
|
@ -645,16 +645,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _BINARY_SUBSCR_INIT_CALL: {
|
case _BINARY_SUBSCR_INIT_CALL: {
|
||||||
JitOptSymbol *getitem;
|
|
||||||
JitOptSymbol *sub;
|
|
||||||
JitOptSymbol *container;
|
|
||||||
_Py_UOpsAbstractFrame *new_frame;
|
_Py_UOpsAbstractFrame *new_frame;
|
||||||
getitem = stack_pointer[-1];
|
|
||||||
sub = stack_pointer[-2];
|
|
||||||
container = stack_pointer[-3];
|
|
||||||
(void)container;
|
|
||||||
(void)sub;
|
|
||||||
(void)getitem;
|
|
||||||
new_frame = NULL;
|
new_frame = NULL;
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
stack_pointer[-3] = (JitOptSymbol *)new_frame;
|
stack_pointer[-3] = (JitOptSymbol *)new_frame;
|
||||||
|
@ -816,12 +807,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _UNPACK_SEQUENCE: {
|
case _UNPACK_SEQUENCE: {
|
||||||
JitOptSymbol *seq;
|
|
||||||
JitOptSymbol **values;
|
JitOptSymbol **values;
|
||||||
seq = stack_pointer[-1];
|
|
||||||
values = &stack_pointer[-1];
|
values = &stack_pointer[-1];
|
||||||
/* This has to be done manually */
|
/* This has to be done manually */
|
||||||
(void)seq;
|
|
||||||
for (int i = 0; i < oparg; i++) {
|
for (int i = 0; i < oparg; i++) {
|
||||||
values[i] = sym_new_unknown(ctx);
|
values[i] = sym_new_unknown(ctx);
|
||||||
}
|
}
|
||||||
|
@ -869,12 +857,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _UNPACK_EX: {
|
case _UNPACK_EX: {
|
||||||
JitOptSymbol *seq;
|
|
||||||
JitOptSymbol **values;
|
JitOptSymbol **values;
|
||||||
seq = stack_pointer[-1];
|
|
||||||
values = &stack_pointer[-1];
|
values = &stack_pointer[-1];
|
||||||
/* This has to be done manually */
|
/* This has to be done manually */
|
||||||
(void)seq;
|
|
||||||
int totalargs = (oparg & 0xFF) + (oparg >> 8) + 1;
|
int totalargs = (oparg & 0xFF) + (oparg >> 8) + 1;
|
||||||
for (int i = 0; i < totalargs; i++) {
|
for (int i = 0; i < totalargs; i++) {
|
||||||
values[i] = sym_new_unknown(ctx);
|
values[i] = sym_new_unknown(ctx);
|
||||||
|
@ -1178,13 +1163,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _LOAD_ATTR_INSTANCE_VALUE: {
|
case _LOAD_ATTR_INSTANCE_VALUE: {
|
||||||
JitOptSymbol *owner;
|
|
||||||
JitOptSymbol *attr;
|
JitOptSymbol *attr;
|
||||||
owner = stack_pointer[-1];
|
|
||||||
uint16_t offset = (uint16_t)this_instr->operand0;
|
uint16_t offset = (uint16_t)this_instr->operand0;
|
||||||
attr = sym_new_not_null(ctx);
|
attr = sym_new_not_null(ctx);
|
||||||
(void)offset;
|
(void)offset;
|
||||||
(void)owner;
|
|
||||||
stack_pointer[-1] = attr;
|
stack_pointer[-1] = attr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1258,11 +1240,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _CHECK_ATTR_WITH_HINT: {
|
case _CHECK_ATTR_WITH_HINT: {
|
||||||
JitOptSymbol *owner;
|
|
||||||
JitOptSymbol *dict;
|
JitOptSymbol *dict;
|
||||||
owner = stack_pointer[-1];
|
|
||||||
dict = sym_new_not_null(ctx);
|
dict = sym_new_not_null(ctx);
|
||||||
(void)owner;
|
|
||||||
stack_pointer[0] = dict;
|
stack_pointer[0] = dict;
|
||||||
stack_pointer += 1;
|
stack_pointer += 1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
@ -1270,16 +1249,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _LOAD_ATTR_WITH_HINT: {
|
case _LOAD_ATTR_WITH_HINT: {
|
||||||
JitOptSymbol *dict;
|
|
||||||
JitOptSymbol *owner;
|
|
||||||
JitOptSymbol *attr;
|
JitOptSymbol *attr;
|
||||||
dict = stack_pointer[-1];
|
|
||||||
owner = stack_pointer[-2];
|
|
||||||
uint16_t hint = (uint16_t)this_instr->operand0;
|
uint16_t hint = (uint16_t)this_instr->operand0;
|
||||||
attr = sym_new_not_null(ctx);
|
attr = sym_new_not_null(ctx);
|
||||||
(void)hint;
|
(void)hint;
|
||||||
(void)owner;
|
|
||||||
(void)dict;
|
|
||||||
stack_pointer[-2] = attr;
|
stack_pointer[-2] = attr;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
@ -1287,13 +1260,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _LOAD_ATTR_SLOT: {
|
case _LOAD_ATTR_SLOT: {
|
||||||
JitOptSymbol *owner;
|
|
||||||
JitOptSymbol *attr;
|
JitOptSymbol *attr;
|
||||||
owner = stack_pointer[-1];
|
|
||||||
uint16_t index = (uint16_t)this_instr->operand0;
|
uint16_t index = (uint16_t)this_instr->operand0;
|
||||||
attr = sym_new_not_null(ctx);
|
attr = sym_new_not_null(ctx);
|
||||||
(void)index;
|
(void)index;
|
||||||
(void)owner;
|
|
||||||
stack_pointer[-1] = attr;
|
stack_pointer[-1] = attr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1303,24 +1273,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _LOAD_ATTR_CLASS: {
|
case _LOAD_ATTR_CLASS: {
|
||||||
JitOptSymbol *owner;
|
|
||||||
JitOptSymbol *attr;
|
JitOptSymbol *attr;
|
||||||
owner = stack_pointer[-1];
|
|
||||||
PyObject *descr = (PyObject *)this_instr->operand0;
|
PyObject *descr = (PyObject *)this_instr->operand0;
|
||||||
attr = sym_new_not_null(ctx);
|
attr = sym_new_not_null(ctx);
|
||||||
(void)descr;
|
(void)descr;
|
||||||
(void)owner;
|
|
||||||
stack_pointer[-1] = attr;
|
stack_pointer[-1] = attr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case _LOAD_ATTR_PROPERTY_FRAME: {
|
case _LOAD_ATTR_PROPERTY_FRAME: {
|
||||||
JitOptSymbol *owner;
|
|
||||||
_Py_UOpsAbstractFrame *new_frame;
|
_Py_UOpsAbstractFrame *new_frame;
|
||||||
owner = stack_pointer[-1];
|
|
||||||
PyObject *fget = (PyObject *)this_instr->operand0;
|
PyObject *fget = (PyObject *)this_instr->operand0;
|
||||||
(void)fget;
|
(void)fget;
|
||||||
(void)owner;
|
|
||||||
new_frame = NULL;
|
new_frame = NULL;
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
stack_pointer[-1] = (JitOptSymbol *)new_frame;
|
stack_pointer[-1] = (JitOptSymbol *)new_frame;
|
||||||
|
@ -1352,13 +1316,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _COMPARE_OP: {
|
case _COMPARE_OP: {
|
||||||
JitOptSymbol *right;
|
|
||||||
JitOptSymbol *left;
|
|
||||||
JitOptSymbol *res;
|
JitOptSymbol *res;
|
||||||
right = stack_pointer[-1];
|
|
||||||
left = stack_pointer[-2];
|
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
if (oparg & 16) {
|
if (oparg & 16) {
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
}
|
}
|
||||||
|
@ -1376,13 +1334,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _COMPARE_OP_FLOAT: {
|
case _COMPARE_OP_FLOAT: {
|
||||||
JitOptSymbol *right;
|
|
||||||
JitOptSymbol *left;
|
|
||||||
JitOptSymbol *res;
|
JitOptSymbol *res;
|
||||||
right = stack_pointer[-1];
|
|
||||||
left = stack_pointer[-2];
|
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
stack_pointer[-2] = res;
|
stack_pointer[-2] = res;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
|
@ -1391,13 +1343,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _COMPARE_OP_INT: {
|
case _COMPARE_OP_INT: {
|
||||||
JitOptSymbol *right;
|
|
||||||
JitOptSymbol *left;
|
|
||||||
JitOptSymbol *res;
|
JitOptSymbol *res;
|
||||||
right = stack_pointer[-1];
|
|
||||||
left = stack_pointer[-2];
|
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
stack_pointer[-2] = res;
|
stack_pointer[-2] = res;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
|
@ -1406,13 +1352,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _COMPARE_OP_STR: {
|
case _COMPARE_OP_STR: {
|
||||||
JitOptSymbol *right;
|
|
||||||
JitOptSymbol *left;
|
|
||||||
JitOptSymbol *res;
|
JitOptSymbol *res;
|
||||||
right = stack_pointer[-1];
|
|
||||||
left = stack_pointer[-2];
|
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
stack_pointer[-2] = res;
|
stack_pointer[-2] = res;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
|
@ -1421,13 +1361,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _IS_OP: {
|
case _IS_OP: {
|
||||||
JitOptSymbol *right;
|
|
||||||
JitOptSymbol *left;
|
|
||||||
JitOptSymbol *res;
|
JitOptSymbol *res;
|
||||||
right = stack_pointer[-1];
|
|
||||||
left = stack_pointer[-2];
|
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
stack_pointer[-2] = res;
|
stack_pointer[-2] = res;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
|
@ -1436,13 +1370,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _CONTAINS_OP: {
|
case _CONTAINS_OP: {
|
||||||
JitOptSymbol *right;
|
|
||||||
JitOptSymbol *left;
|
|
||||||
JitOptSymbol *res;
|
JitOptSymbol *res;
|
||||||
right = stack_pointer[-1];
|
|
||||||
left = stack_pointer[-2];
|
|
||||||
(void)left;
|
|
||||||
(void)right;
|
|
||||||
res = sym_new_type(ctx, &PyBool_Type);
|
res = sym_new_type(ctx, &PyBool_Type);
|
||||||
stack_pointer[-2] = res;
|
stack_pointer[-2] = res;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
|
@ -1635,11 +1563,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _ITER_NEXT_RANGE: {
|
case _ITER_NEXT_RANGE: {
|
||||||
JitOptSymbol *iter;
|
|
||||||
JitOptSymbol *next;
|
JitOptSymbol *next;
|
||||||
iter = stack_pointer[-1];
|
|
||||||
next = sym_new_type(ctx, &PyLong_Type);
|
next = sym_new_type(ctx, &PyLong_Type);
|
||||||
(void)iter;
|
|
||||||
stack_pointer[0] = next;
|
stack_pointer[0] = next;
|
||||||
stack_pointer += 1;
|
stack_pointer += 1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
@ -1653,11 +1578,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _LOAD_SPECIAL: {
|
case _LOAD_SPECIAL: {
|
||||||
JitOptSymbol *owner;
|
|
||||||
JitOptSymbol *attr;
|
JitOptSymbol *attr;
|
||||||
JitOptSymbol *self_or_null;
|
JitOptSymbol *self_or_null;
|
||||||
owner = stack_pointer[-1];
|
|
||||||
(void)owner;
|
|
||||||
attr = sym_new_not_null(ctx);
|
attr = sym_new_not_null(ctx);
|
||||||
self_or_null = sym_new_unknown(ctx);
|
self_or_null = sym_new_unknown(ctx);
|
||||||
stack_pointer[-1] = attr;
|
stack_pointer[-1] = attr;
|
||||||
|
@ -1764,16 +1686,10 @@
|
||||||
|
|
||||||
case _MAYBE_EXPAND_METHOD: {
|
case _MAYBE_EXPAND_METHOD: {
|
||||||
JitOptSymbol **args;
|
JitOptSymbol **args;
|
||||||
JitOptSymbol *self_or_null;
|
|
||||||
JitOptSymbol *callable;
|
|
||||||
JitOptSymbol *func;
|
JitOptSymbol *func;
|
||||||
JitOptSymbol *maybe_self;
|
JitOptSymbol *maybe_self;
|
||||||
args = &stack_pointer[-oparg];
|
args = &stack_pointer[-oparg];
|
||||||
self_or_null = stack_pointer[-1 - oparg];
|
|
||||||
callable = stack_pointer[-2 - oparg];
|
|
||||||
args = &stack_pointer[-oparg];
|
args = &stack_pointer[-oparg];
|
||||||
(void)callable;
|
|
||||||
(void)self_or_null;
|
|
||||||
(void)args;
|
(void)args;
|
||||||
func = sym_new_not_null(ctx);
|
func = sym_new_not_null(ctx);
|
||||||
maybe_self = sym_new_not_null(ctx);
|
maybe_self = sym_new_not_null(ctx);
|
||||||
|
@ -1787,17 +1703,11 @@
|
||||||
/* _MONITOR_CALL is not a viable micro-op for tier 2 */
|
/* _MONITOR_CALL is not a viable micro-op for tier 2 */
|
||||||
|
|
||||||
case _PY_FRAME_GENERAL: {
|
case _PY_FRAME_GENERAL: {
|
||||||
JitOptSymbol *self_or_null;
|
|
||||||
JitOptSymbol *callable;
|
|
||||||
_Py_UOpsAbstractFrame *new_frame;
|
_Py_UOpsAbstractFrame *new_frame;
|
||||||
self_or_null = stack_pointer[-1 - oparg];
|
|
||||||
callable = stack_pointer[-2 - oparg];
|
|
||||||
stack_pointer += -2 - oparg;
|
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
|
||||||
(void)(self_or_null);
|
|
||||||
(void)(callable);
|
|
||||||
PyCodeObject *co = NULL;
|
PyCodeObject *co = NULL;
|
||||||
assert((this_instr + 2)->opcode == _PUSH_FRAME);
|
assert((this_instr + 2)->opcode == _PUSH_FRAME);
|
||||||
|
stack_pointer += -2 - oparg;
|
||||||
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
co = get_code_with_logging((this_instr + 2));
|
co = get_code_with_logging((this_instr + 2));
|
||||||
if (co == NULL) {
|
if (co == NULL) {
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
|
@ -1811,12 +1721,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _CHECK_FUNCTION_VERSION: {
|
case _CHECK_FUNCTION_VERSION: {
|
||||||
JitOptSymbol *self_or_null;
|
|
||||||
JitOptSymbol *callable;
|
JitOptSymbol *callable;
|
||||||
self_or_null = stack_pointer[-1 - oparg];
|
|
||||||
callable = stack_pointer[-2 - oparg];
|
callable = stack_pointer[-2 - oparg];
|
||||||
uint32_t func_version = (uint32_t)this_instr->operand0;
|
uint32_t func_version = (uint32_t)this_instr->operand0;
|
||||||
(void)self_or_null;
|
|
||||||
if (sym_is_const(callable) && sym_matches_type(callable, &PyFunction_Type)) {
|
if (sym_is_const(callable) && sym_matches_type(callable, &PyFunction_Type)) {
|
||||||
assert(PyFunction_Check(sym_get_const(callable)));
|
assert(PyFunction_Check(sym_get_const(callable)));
|
||||||
REPLACE_OP(this_instr, _CHECK_FUNCTION_VERSION_INLINE, 0, func_version);
|
REPLACE_OP(this_instr, _CHECK_FUNCTION_VERSION_INLINE, 0, func_version);
|
||||||
|
@ -1866,7 +1773,6 @@
|
||||||
JitOptSymbol **callable;
|
JitOptSymbol **callable;
|
||||||
self_or_null = &stack_pointer[-1 - oparg];
|
self_or_null = &stack_pointer[-1 - oparg];
|
||||||
callable = &stack_pointer[-2 - oparg];
|
callable = &stack_pointer[-2 - oparg];
|
||||||
(void)callable;
|
|
||||||
callable[0] = sym_new_not_null(ctx);
|
callable[0] = sym_new_not_null(ctx);
|
||||||
self_or_null[0] = sym_new_not_null(ctx);
|
self_or_null[0] = sym_new_not_null(ctx);
|
||||||
break;
|
break;
|
||||||
|
@ -1896,7 +1802,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)self_or_null;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1909,13 +1814,10 @@
|
||||||
case _INIT_CALL_PY_EXACT_ARGS: {
|
case _INIT_CALL_PY_EXACT_ARGS: {
|
||||||
JitOptSymbol **args;
|
JitOptSymbol **args;
|
||||||
JitOptSymbol *self_or_null;
|
JitOptSymbol *self_or_null;
|
||||||
JitOptSymbol *callable;
|
|
||||||
_Py_UOpsAbstractFrame *new_frame;
|
_Py_UOpsAbstractFrame *new_frame;
|
||||||
args = &stack_pointer[-oparg];
|
args = &stack_pointer[-oparg];
|
||||||
self_or_null = stack_pointer[-1 - oparg];
|
self_or_null = stack_pointer[-1 - oparg];
|
||||||
callable = stack_pointer[-2 - oparg];
|
|
||||||
int argcount = oparg;
|
int argcount = oparg;
|
||||||
(void)callable;
|
|
||||||
PyCodeObject *co = NULL;
|
PyCodeObject *co = NULL;
|
||||||
assert((this_instr + 2)->opcode == _PUSH_FRAME);
|
assert((this_instr + 2)->opcode == _PUSH_FRAME);
|
||||||
stack_pointer += -2 - oparg;
|
stack_pointer += -2 - oparg;
|
||||||
|
@ -2010,18 +1912,12 @@
|
||||||
|
|
||||||
case _CHECK_AND_ALLOCATE_OBJECT: {
|
case _CHECK_AND_ALLOCATE_OBJECT: {
|
||||||
JitOptSymbol **args;
|
JitOptSymbol **args;
|
||||||
JitOptSymbol *null;
|
|
||||||
JitOptSymbol *callable;
|
|
||||||
JitOptSymbol *self;
|
JitOptSymbol *self;
|
||||||
JitOptSymbol *init;
|
JitOptSymbol *init;
|
||||||
args = &stack_pointer[-oparg];
|
args = &stack_pointer[-oparg];
|
||||||
null = stack_pointer[-1 - oparg];
|
|
||||||
callable = stack_pointer[-2 - oparg];
|
|
||||||
args = &stack_pointer[-oparg];
|
args = &stack_pointer[-oparg];
|
||||||
uint32_t type_version = (uint32_t)this_instr->operand0;
|
uint32_t type_version = (uint32_t)this_instr->operand0;
|
||||||
(void)type_version;
|
(void)type_version;
|
||||||
(void)callable;
|
|
||||||
(void)null;
|
|
||||||
(void)args;
|
(void)args;
|
||||||
self = sym_new_not_null(ctx);
|
self = sym_new_not_null(ctx);
|
||||||
init = sym_new_not_null(ctx);
|
init = sym_new_not_null(ctx);
|
||||||
|
@ -2031,16 +1927,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
case _CREATE_INIT_FRAME: {
|
case _CREATE_INIT_FRAME: {
|
||||||
JitOptSymbol **args;
|
|
||||||
JitOptSymbol *init;
|
|
||||||
JitOptSymbol *self;
|
|
||||||
_Py_UOpsAbstractFrame *init_frame;
|
_Py_UOpsAbstractFrame *init_frame;
|
||||||
args = &stack_pointer[-oparg];
|
|
||||||
init = stack_pointer[-1 - oparg];
|
|
||||||
self = stack_pointer[-2 - oparg];
|
|
||||||
(void)self;
|
|
||||||
(void)init;
|
|
||||||
(void)args;
|
|
||||||
init_frame = NULL;
|
init_frame = NULL;
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
stack_pointer[-2 - oparg] = (JitOptSymbol *)init_frame;
|
stack_pointer[-2 - oparg] = (JitOptSymbol *)init_frame;
|
||||||
|
@ -2174,19 +2061,7 @@
|
||||||
/* _DO_CALL_KW is not a viable micro-op for tier 2 */
|
/* _DO_CALL_KW is not a viable micro-op for tier 2 */
|
||||||
|
|
||||||
case _PY_FRAME_KW: {
|
case _PY_FRAME_KW: {
|
||||||
JitOptSymbol *kwnames;
|
|
||||||
JitOptSymbol **args;
|
|
||||||
JitOptSymbol *self_or_null;
|
|
||||||
JitOptSymbol *callable;
|
|
||||||
_Py_UOpsAbstractFrame *new_frame;
|
_Py_UOpsAbstractFrame *new_frame;
|
||||||
kwnames = stack_pointer[-1];
|
|
||||||
args = &stack_pointer[-1 - oparg];
|
|
||||||
self_or_null = stack_pointer[-2 - oparg];
|
|
||||||
callable = stack_pointer[-3 - oparg];
|
|
||||||
(void)callable;
|
|
||||||
(void)self_or_null;
|
|
||||||
(void)args;
|
|
||||||
(void)kwnames;
|
|
||||||
new_frame = NULL;
|
new_frame = NULL;
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
stack_pointer[-3 - oparg] = (JitOptSymbol *)new_frame;
|
stack_pointer[-3 - oparg] = (JitOptSymbol *)new_frame;
|
||||||
|
|
|
@ -621,6 +621,7 @@ NON_ESCAPING_FUNCTIONS = (
|
||||||
"_PyErr_Occurred",
|
"_PyErr_Occurred",
|
||||||
"_PyEval_FrameClearAndPop",
|
"_PyEval_FrameClearAndPop",
|
||||||
"_PyFloat_FromDouble_ConsumeInputs",
|
"_PyFloat_FromDouble_ConsumeInputs",
|
||||||
|
"_PyFrame_GetBytecode",
|
||||||
"_PyFrame_GetCode",
|
"_PyFrame_GetCode",
|
||||||
"_PyFrame_IsIncomplete",
|
"_PyFrame_IsIncomplete",
|
||||||
"_PyFrame_PushUnchecked",
|
"_PyFrame_PushUnchecked",
|
||||||
|
|
|
@ -2,3 +2,7 @@
|
||||||
// pointer with __attribute__((preserve_none)), since this attribute may not be
|
// pointer with __attribute__((preserve_none)), since this attribute may not be
|
||||||
// supported by the compiler used to build the rest of the interpreter.
|
// supported by the compiler used to build the rest of the interpreter.
|
||||||
typedef jit_func __attribute__((preserve_none)) jit_func_preserve_none;
|
typedef jit_func __attribute__((preserve_none)) jit_func_preserve_none;
|
||||||
|
|
||||||
|
#define PATCH_VALUE(TYPE, NAME, ALIAS) \
|
||||||
|
PyAPI_DATA(void) ALIAS; \
|
||||||
|
TYPE NAME = (TYPE)(uintptr_t)&ALIAS;
|
||||||
|
|
|
@ -9,16 +9,7 @@
|
||||||
_Py_CODEUNIT *
|
_Py_CODEUNIT *
|
||||||
_JIT_ENTRY(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate)
|
_JIT_ENTRY(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate)
|
||||||
{
|
{
|
||||||
// This is subtle. The actual trace will return to us once it exits, so we
|
|
||||||
// need to make sure that we stay alive until then. If our trace side-exits
|
|
||||||
// into another trace, and this trace is then invalidated, the code for
|
|
||||||
// *this function* will be freed and we'll crash upon return:
|
|
||||||
PyAPI_DATA(void) _JIT_EXECUTOR;
|
|
||||||
PyObject *executor = (PyObject *)(uintptr_t)&_JIT_EXECUTOR;
|
|
||||||
Py_INCREF(executor);
|
|
||||||
// Note that this is *not* a tail call:
|
// Note that this is *not* a tail call:
|
||||||
PyAPI_DATA(void) _JIT_CONTINUE;
|
PATCH_VALUE(jit_func_preserve_none, call, _JIT_CONTINUE);
|
||||||
_Py_CODEUNIT *target = ((jit_func_preserve_none)&_JIT_CONTINUE)(frame, stack_pointer, tstate);
|
return call(frame, stack_pointer, tstate);
|
||||||
Py_SETREF(tstate->previous_executor, executor);
|
|
||||||
return target;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,28 +32,22 @@
|
||||||
#undef CURRENT_OPERAND1
|
#undef CURRENT_OPERAND1
|
||||||
#define CURRENT_OPERAND1() (_operand1)
|
#define CURRENT_OPERAND1() (_operand1)
|
||||||
|
|
||||||
#undef ENABLE_SPECIALIZATION
|
#undef CURRENT_TARGET
|
||||||
#define ENABLE_SPECIALIZATION (0)
|
#define CURRENT_TARGET() (_target)
|
||||||
|
|
||||||
#undef GOTO_ERROR
|
|
||||||
#define GOTO_ERROR(LABEL) \
|
|
||||||
do { \
|
|
||||||
goto LABEL ## _tier_two; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#undef GOTO_TIER_TWO
|
#undef GOTO_TIER_TWO
|
||||||
#define GOTO_TIER_TWO(EXECUTOR) \
|
#define GOTO_TIER_TWO(EXECUTOR) \
|
||||||
do { \
|
do { \
|
||||||
OPT_STAT_INC(traces_executed); \
|
OPT_STAT_INC(traces_executed); \
|
||||||
__attribute__((musttail)) \
|
jit_func_preserve_none jitted = (EXECUTOR)->jit_side_entry; \
|
||||||
return ((jit_func_preserve_none)((EXECUTOR)->jit_side_entry))(frame, stack_pointer, tstate); \
|
__attribute__((musttail)) return jitted(frame, stack_pointer, tstate); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#undef GOTO_TIER_ONE
|
#undef GOTO_TIER_ONE
|
||||||
#define GOTO_TIER_ONE(TARGET) \
|
#define GOTO_TIER_ONE(TARGET) \
|
||||||
do { \
|
do { \
|
||||||
_PyFrame_SetStackPointer(frame, stack_pointer); \
|
_PyFrame_SetStackPointer(frame, stack_pointer); \
|
||||||
return TARGET; \
|
return TARGET; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#undef LOAD_IP
|
#undef LOAD_IP
|
||||||
|
@ -61,15 +55,15 @@ do { \
|
||||||
do { \
|
do { \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define PATCH_VALUE(TYPE, NAME, ALIAS) \
|
#undef LLTRACE_RESUME_FRAME
|
||||||
PyAPI_DATA(void) ALIAS; \
|
#define LLTRACE_RESUME_FRAME() \
|
||||||
TYPE NAME = (TYPE)(uintptr_t)&ALIAS;
|
do { \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define PATCH_JUMP(ALIAS) \
|
#define PATCH_JUMP(ALIAS) \
|
||||||
do { \
|
do { \
|
||||||
PyAPI_DATA(void) ALIAS; \
|
PATCH_VALUE(jit_func_preserve_none, jump, ALIAS); \
|
||||||
__attribute__((musttail)) \
|
__attribute__((musttail)) return jump(frame, stack_pointer, tstate); \
|
||||||
return ((jit_func_preserve_none)&ALIAS)(frame, stack_pointer, tstate); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#undef JUMP_TO_JUMP_TARGET
|
#undef JUMP_TO_JUMP_TARGET
|
||||||
|
@ -78,14 +72,6 @@ do { \
|
||||||
#undef JUMP_TO_ERROR
|
#undef JUMP_TO_ERROR
|
||||||
#define JUMP_TO_ERROR() PATCH_JUMP(_JIT_ERROR_TARGET)
|
#define JUMP_TO_ERROR() PATCH_JUMP(_JIT_ERROR_TARGET)
|
||||||
|
|
||||||
#undef WITHIN_STACK_BOUNDS
|
|
||||||
#define WITHIN_STACK_BOUNDS() 1
|
|
||||||
|
|
||||||
#undef LLTRACE_RESUME_FRAME
|
|
||||||
#define LLTRACE_RESUME_FRAME() \
|
|
||||||
do { \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define TIER_TWO 2
|
#define TIER_TWO 2
|
||||||
|
|
||||||
__attribute__((preserve_none)) _Py_CODEUNIT *
|
__attribute__((preserve_none)) _Py_CODEUNIT *
|
||||||
|
@ -106,16 +92,13 @@ _JIT_ENTRY(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState
|
||||||
PATCH_VALUE(uint32_t, _operand0_hi, _JIT_OPERAND0_HI)
|
PATCH_VALUE(uint32_t, _operand0_hi, _JIT_OPERAND0_HI)
|
||||||
PATCH_VALUE(uint32_t, _operand0_lo, _JIT_OPERAND0_LO)
|
PATCH_VALUE(uint32_t, _operand0_lo, _JIT_OPERAND0_LO)
|
||||||
uint64_t _operand0 = ((uint64_t)_operand0_hi << 32) | _operand0_lo;
|
uint64_t _operand0 = ((uint64_t)_operand0_hi << 32) | _operand0_lo;
|
||||||
|
|
||||||
PATCH_VALUE(uint32_t, _operand1_hi, _JIT_OPERAND1_HI)
|
PATCH_VALUE(uint32_t, _operand1_hi, _JIT_OPERAND1_HI)
|
||||||
PATCH_VALUE(uint32_t, _operand1_lo, _JIT_OPERAND1_LO)
|
PATCH_VALUE(uint32_t, _operand1_lo, _JIT_OPERAND1_LO)
|
||||||
uint64_t _operand1 = ((uint64_t)_operand1_hi << 32) | _operand1_lo;
|
uint64_t _operand1 = ((uint64_t)_operand1_hi << 32) | _operand1_lo;
|
||||||
#endif
|
#endif
|
||||||
PATCH_VALUE(uint32_t, _target, _JIT_TARGET)
|
PATCH_VALUE(uint32_t, _target, _JIT_TARGET)
|
||||||
|
|
||||||
OPT_STAT_INC(uops_executed);
|
OPT_STAT_INC(uops_executed);
|
||||||
UOP_STAT_INC(uopcode, execution_count);
|
UOP_STAT_INC(uopcode, execution_count);
|
||||||
|
|
||||||
switch (uopcode) {
|
switch (uopcode) {
|
||||||
// The actual instruction definition gets inserted here:
|
// The actual instruction definition gets inserted here:
|
||||||
CASE
|
CASE
|
||||||
|
@ -123,15 +106,4 @@ _JIT_ENTRY(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState
|
||||||
Py_UNREACHABLE();
|
Py_UNREACHABLE();
|
||||||
}
|
}
|
||||||
PATCH_JUMP(_JIT_CONTINUE);
|
PATCH_JUMP(_JIT_CONTINUE);
|
||||||
// Labels that the instruction implementations expect to exist:
|
|
||||||
|
|
||||||
error_tier_two:
|
|
||||||
tstate->previous_executor = (PyObject *)current_executor;
|
|
||||||
GOTO_TIER_ONE(NULL);
|
|
||||||
exit_to_tier1:
|
|
||||||
tstate->previous_executor = (PyObject *)current_executor;
|
|
||||||
GOTO_TIER_ONE(_PyCode_CODE(_PyFrame_GetCode(frame)) + _target);
|
|
||||||
exit_to_tier1_dynamic:
|
|
||||||
tstate->previous_executor = (PyObject *)current_executor;
|
|
||||||
GOTO_TIER_ONE(frame->instr_ptr);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue