mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
GH-128682: Mark two more macros as escaping. (GH-129645)
Expand out SETLOCAL so that code generator can see the decref. Mark Py_CLEAR as escaping
This commit is contained in:
parent
2effea4dab
commit
96ff4c2486
6 changed files with 127 additions and 46 deletions
|
@ -272,7 +272,6 @@ dummy_func(
|
||||||
|
|
||||||
inst(LOAD_FAST_AND_CLEAR, (-- value)) {
|
inst(LOAD_FAST_AND_CLEAR, (-- value)) {
|
||||||
value = GETLOCAL(oparg);
|
value = GETLOCAL(oparg);
|
||||||
// do not use SETLOCAL here, it decrefs the old value
|
|
||||||
GETLOCAL(oparg) = PyStackRef_NULL;
|
GETLOCAL(oparg) = PyStackRef_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,8 +327,10 @@ dummy_func(
|
||||||
}
|
}
|
||||||
|
|
||||||
replicate(8) inst(STORE_FAST, (value --)) {
|
replicate(8) inst(STORE_FAST, (value --)) {
|
||||||
SETLOCAL(oparg, value);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = value;
|
||||||
DEAD(value);
|
DEAD(value);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
pseudo(STORE_FAST_MAYBE_NULL, (unused --)) = {
|
pseudo(STORE_FAST_MAYBE_NULL, (unused --)) = {
|
||||||
|
@ -339,18 +340,24 @@ dummy_func(
|
||||||
inst(STORE_FAST_LOAD_FAST, (value1 -- value2)) {
|
inst(STORE_FAST_LOAD_FAST, (value1 -- value2)) {
|
||||||
uint32_t oparg1 = oparg >> 4;
|
uint32_t oparg1 = oparg >> 4;
|
||||||
uint32_t oparg2 = oparg & 15;
|
uint32_t oparg2 = oparg & 15;
|
||||||
SETLOCAL(oparg1, value1);
|
_PyStackRef tmp = GETLOCAL(oparg1);
|
||||||
|
GETLOCAL(oparg1) = value1;
|
||||||
DEAD(value1);
|
DEAD(value1);
|
||||||
value2 = PyStackRef_DUP(GETLOCAL(oparg2));
|
value2 = PyStackRef_DUP(GETLOCAL(oparg2));
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(STORE_FAST_STORE_FAST, (value2, value1 --)) {
|
inst(STORE_FAST_STORE_FAST, (value2, value1 --)) {
|
||||||
uint32_t oparg1 = oparg >> 4;
|
uint32_t oparg1 = oparg >> 4;
|
||||||
uint32_t oparg2 = oparg & 15;
|
uint32_t oparg2 = oparg & 15;
|
||||||
SETLOCAL(oparg1, value1);
|
_PyStackRef tmp = GETLOCAL(oparg1);
|
||||||
|
GETLOCAL(oparg1) = value1;
|
||||||
DEAD(value1);
|
DEAD(value1);
|
||||||
SETLOCAL(oparg2, value2);
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
tmp = GETLOCAL(oparg2);
|
||||||
|
GETLOCAL(oparg2) = value2;
|
||||||
DEAD(value2);
|
DEAD(value2);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
pure inst(POP_TOP, (value --)) {
|
pure inst(POP_TOP, (value --)) {
|
||||||
|
@ -1775,7 +1782,9 @@ dummy_func(
|
||||||
);
|
);
|
||||||
ERROR_IF(1, error);
|
ERROR_IF(1, error);
|
||||||
}
|
}
|
||||||
SETLOCAL(oparg, PyStackRef_NULL);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = PyStackRef_NULL;
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(MAKE_CELL, (--)) {
|
inst(MAKE_CELL, (--)) {
|
||||||
|
@ -1786,7 +1795,9 @@ dummy_func(
|
||||||
if (cell == NULL) {
|
if (cell == NULL) {
|
||||||
ERROR_NO_POP();
|
ERROR_NO_POP();
|
||||||
}
|
}
|
||||||
SETLOCAL(oparg, PyStackRef_FromPyObjectSteal(cell));
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = PyStackRef_FromPyObjectSteal(cell);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(DELETE_DEREF, (--)) {
|
inst(DELETE_DEREF, (--)) {
|
||||||
|
|
|
@ -194,6 +194,7 @@ lltrace_instruction(_PyInterpreterFrame *frame,
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lltrace_resume_frame(_PyInterpreterFrame *frame)
|
lltrace_resume_frame(_PyInterpreterFrame *frame)
|
||||||
{
|
{
|
||||||
|
|
|
@ -221,15 +221,6 @@ GETITEM(PyObject *v, Py_ssize_t i) {
|
||||||
#define LOCALS_ARRAY (frame->localsplus)
|
#define LOCALS_ARRAY (frame->localsplus)
|
||||||
#define GETLOCAL(i) (frame->localsplus[i])
|
#define GETLOCAL(i) (frame->localsplus[i])
|
||||||
|
|
||||||
/* The SETLOCAL() macro must not DECREF the local variable in-place and
|
|
||||||
then store the new value; it must copy the old value to a temporary
|
|
||||||
value, then store the new value, and then DECREF the temporary value.
|
|
||||||
This is because it is possible that during the DECREF the frame is
|
|
||||||
accessed by other code (e.g. a __del__ method or gc.collect()) and the
|
|
||||||
variable would be pointing to already-freed memory. */
|
|
||||||
#define SETLOCAL(i, value) do { _PyStackRef tmp = GETLOCAL(i); \
|
|
||||||
GETLOCAL(i) = value; \
|
|
||||||
PyStackRef_XCLOSE(tmp); } while (0)
|
|
||||||
|
|
||||||
#ifdef Py_STATS
|
#ifdef Py_STATS
|
||||||
#define UPDATE_MISS_STATS(INSTNAME) \
|
#define UPDATE_MISS_STATS(INSTNAME) \
|
||||||
|
|
69
Python/executor_cases.c.h
generated
69
Python/executor_cases.c.h
generated
|
@ -205,7 +205,6 @@
|
||||||
_PyStackRef value;
|
_PyStackRef value;
|
||||||
oparg = CURRENT_OPARG();
|
oparg = CURRENT_OPARG();
|
||||||
value = GETLOCAL(oparg);
|
value = GETLOCAL(oparg);
|
||||||
// do not use SETLOCAL here, it decrefs the old value
|
|
||||||
GETLOCAL(oparg) = PyStackRef_NULL;
|
GETLOCAL(oparg) = PyStackRef_NULL;
|
||||||
stack_pointer[0] = value;
|
stack_pointer[0] = value;
|
||||||
stack_pointer += 1;
|
stack_pointer += 1;
|
||||||
|
@ -307,9 +306,13 @@
|
||||||
oparg = 0;
|
oparg = 0;
|
||||||
assert(oparg == CURRENT_OPARG());
|
assert(oparg == CURRENT_OPARG());
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
SETLOCAL(oparg, value);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = value;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,9 +321,13 @@
|
||||||
oparg = 1;
|
oparg = 1;
|
||||||
assert(oparg == CURRENT_OPARG());
|
assert(oparg == CURRENT_OPARG());
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
SETLOCAL(oparg, value);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = value;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,9 +336,13 @@
|
||||||
oparg = 2;
|
oparg = 2;
|
||||||
assert(oparg == CURRENT_OPARG());
|
assert(oparg == CURRENT_OPARG());
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
SETLOCAL(oparg, value);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = value;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,9 +351,13 @@
|
||||||
oparg = 3;
|
oparg = 3;
|
||||||
assert(oparg == CURRENT_OPARG());
|
assert(oparg == CURRENT_OPARG());
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
SETLOCAL(oparg, value);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = value;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,9 +366,13 @@
|
||||||
oparg = 4;
|
oparg = 4;
|
||||||
assert(oparg == CURRENT_OPARG());
|
assert(oparg == CURRENT_OPARG());
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
SETLOCAL(oparg, value);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = value;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,9 +381,13 @@
|
||||||
oparg = 5;
|
oparg = 5;
|
||||||
assert(oparg == CURRENT_OPARG());
|
assert(oparg == CURRENT_OPARG());
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
SETLOCAL(oparg, value);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = value;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,9 +396,13 @@
|
||||||
oparg = 6;
|
oparg = 6;
|
||||||
assert(oparg == CURRENT_OPARG());
|
assert(oparg == CURRENT_OPARG());
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
SETLOCAL(oparg, value);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = value;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,9 +411,13 @@
|
||||||
oparg = 7;
|
oparg = 7;
|
||||||
assert(oparg == CURRENT_OPARG());
|
assert(oparg == CURRENT_OPARG());
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
SETLOCAL(oparg, value);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = value;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,9 +425,13 @@
|
||||||
_PyStackRef value;
|
_PyStackRef value;
|
||||||
oparg = CURRENT_OPARG();
|
oparg = CURRENT_OPARG();
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
SETLOCAL(oparg, value);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = value;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2255,7 +2290,11 @@
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
JUMP_TO_ERROR();
|
JUMP_TO_ERROR();
|
||||||
}
|
}
|
||||||
SETLOCAL(oparg, PyStackRef_NULL);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = PyStackRef_NULL;
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2268,7 +2307,11 @@
|
||||||
if (cell == NULL) {
|
if (cell == NULL) {
|
||||||
JUMP_TO_ERROR();
|
JUMP_TO_ERROR();
|
||||||
}
|
}
|
||||||
SETLOCAL(oparg, PyStackRef_FromPyObjectSteal(cell));
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = PyStackRef_FromPyObjectSteal(cell);
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6314,7 +6357,9 @@
|
||||||
#endif
|
#endif
|
||||||
if (exit->executor && !exit->executor->vm_data.valid) {
|
if (exit->executor && !exit->executor->vm_data.valid) {
|
||||||
exit->temperature = initial_temperature_backoff_counter();
|
exit->temperature = initial_temperature_backoff_counter();
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
Py_CLEAR(exit->executor);
|
Py_CLEAR(exit->executor);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
if (exit->executor == NULL) {
|
if (exit->executor == NULL) {
|
||||||
_Py_BackoffCounter temperature = exit->temperature;
|
_Py_BackoffCounter temperature = exit->temperature;
|
||||||
|
|
57
Python/generated_cases.c.h
generated
57
Python/generated_cases.c.h
generated
|
@ -1082,7 +1082,9 @@
|
||||||
frame, this_instr, callable_o, arg);
|
frame, this_instr, callable_o, arg);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
Py_CLEAR(res_o);
|
Py_CLEAR(res_o);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1842,7 +1844,9 @@
|
||||||
frame, this_instr, func, arg);
|
frame, this_instr, func, arg);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
Py_CLEAR(result_o);
|
Py_CLEAR(result_o);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2163,7 +2167,9 @@
|
||||||
frame, this_instr, callable_o, arg);
|
frame, this_instr, callable_o, arg);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
Py_CLEAR(res_o);
|
Py_CLEAR(res_o);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3837,7 +3843,11 @@
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
SETLOCAL(oparg, PyStackRef_NULL);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = PyStackRef_NULL;
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4781,7 +4791,9 @@
|
||||||
frame, this_instr, callable_o, arg);
|
frame, this_instr, callable_o, arg);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
Py_CLEAR(res_o);
|
Py_CLEAR(res_o);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4920,7 +4932,9 @@
|
||||||
frame, this_instr, func, arg);
|
frame, this_instr, func, arg);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
Py_CLEAR(result_o);
|
Py_CLEAR(result_o);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5155,7 +5169,9 @@
|
||||||
frame, this_instr, callable_o, arg);
|
frame, this_instr, callable_o, arg);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
Py_CLEAR(res_o);
|
Py_CLEAR(res_o);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5421,7 +5437,9 @@
|
||||||
frame, this_instr, global_super, arg);
|
frame, this_instr, global_super, arg);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
Py_CLEAR(super);
|
Py_CLEAR(super);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6858,7 +6876,6 @@
|
||||||
INSTRUCTION_STATS(LOAD_FAST_AND_CLEAR);
|
INSTRUCTION_STATS(LOAD_FAST_AND_CLEAR);
|
||||||
_PyStackRef value;
|
_PyStackRef value;
|
||||||
value = GETLOCAL(oparg);
|
value = GETLOCAL(oparg);
|
||||||
// do not use SETLOCAL here, it decrefs the old value
|
|
||||||
GETLOCAL(oparg) = PyStackRef_NULL;
|
GETLOCAL(oparg) = PyStackRef_NULL;
|
||||||
stack_pointer[0] = value;
|
stack_pointer[0] = value;
|
||||||
stack_pointer += 1;
|
stack_pointer += 1;
|
||||||
|
@ -7338,7 +7355,9 @@
|
||||||
frame, this_instr, global_super, arg);
|
frame, this_instr, global_super, arg);
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
Py_CLEAR(super);
|
Py_CLEAR(super);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7472,7 +7491,11 @@
|
||||||
if (cell == NULL) {
|
if (cell == NULL) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
SETLOCAL(oparg, PyStackRef_FromPyObjectSteal(cell));
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = PyStackRef_FromPyObjectSteal(cell);
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8545,9 +8568,13 @@
|
||||||
INSTRUCTION_STATS(STORE_FAST);
|
INSTRUCTION_STATS(STORE_FAST);
|
||||||
_PyStackRef value;
|
_PyStackRef value;
|
||||||
value = stack_pointer[-1];
|
value = stack_pointer[-1];
|
||||||
SETLOCAL(oparg, value);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
|
GETLOCAL(oparg) = value;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8560,9 +8587,13 @@
|
||||||
value1 = stack_pointer[-1];
|
value1 = stack_pointer[-1];
|
||||||
uint32_t oparg1 = oparg >> 4;
|
uint32_t oparg1 = oparg >> 4;
|
||||||
uint32_t oparg2 = oparg & 15;
|
uint32_t oparg2 = oparg & 15;
|
||||||
SETLOCAL(oparg1, value1);
|
_PyStackRef tmp = GETLOCAL(oparg1);
|
||||||
|
GETLOCAL(oparg1) = value1;
|
||||||
value2 = PyStackRef_DUP(GETLOCAL(oparg2));
|
value2 = PyStackRef_DUP(GETLOCAL(oparg2));
|
||||||
stack_pointer[-1] = value2;
|
stack_pointer[-1] = value2;
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8576,10 +8607,20 @@
|
||||||
value2 = stack_pointer[-2];
|
value2 = stack_pointer[-2];
|
||||||
uint32_t oparg1 = oparg >> 4;
|
uint32_t oparg1 = oparg >> 4;
|
||||||
uint32_t oparg2 = oparg & 15;
|
uint32_t oparg2 = oparg & 15;
|
||||||
SETLOCAL(oparg1, value1);
|
_PyStackRef tmp = GETLOCAL(oparg1);
|
||||||
SETLOCAL(oparg2, value2);
|
GETLOCAL(oparg1) = value1;
|
||||||
stack_pointer += -2;
|
stack_pointer += -1;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
|
tmp = GETLOCAL(oparg2);
|
||||||
|
GETLOCAL(oparg2) = value2;
|
||||||
|
stack_pointer += -1;
|
||||||
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||||
|
PyStackRef_XCLOSE(tmp);
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -607,7 +607,6 @@ NON_ESCAPING_FUNCTIONS = (
|
||||||
"PyUnicode_GET_LENGTH",
|
"PyUnicode_GET_LENGTH",
|
||||||
"PyUnicode_READ_CHAR",
|
"PyUnicode_READ_CHAR",
|
||||||
"Py_ARRAY_LENGTH",
|
"Py_ARRAY_LENGTH",
|
||||||
"Py_CLEAR",
|
|
||||||
"Py_FatalError",
|
"Py_FatalError",
|
||||||
"Py_INCREF",
|
"Py_INCREF",
|
||||||
"Py_IS_TYPE",
|
"Py_IS_TYPE",
|
||||||
|
@ -859,13 +858,7 @@ def compute_properties(op: parser.CodeDef) -> Properties:
|
||||||
)
|
)
|
||||||
error_with_pop = has_error_with_pop(op)
|
error_with_pop = has_error_with_pop(op)
|
||||||
error_without_pop = has_error_without_pop(op)
|
error_without_pop = has_error_without_pop(op)
|
||||||
escapes = (
|
escapes = bool(escaping_calls)
|
||||||
bool(escaping_calls) or
|
|
||||||
variable_used(op, "Py_DECREF") or
|
|
||||||
variable_used(op, "Py_XDECREF") or
|
|
||||||
variable_used(op, "Py_CLEAR") or
|
|
||||||
variable_used(op, "SETLOCAL")
|
|
||||||
)
|
|
||||||
pure = False if isinstance(op, parser.LabelDef) else "pure" in op.annotations
|
pure = False if isinstance(op, parser.LabelDef) else "pure" in op.annotations
|
||||||
no_save_ip = False if isinstance(op, parser.LabelDef) else "no_save_ip" in op.annotations
|
no_save_ip = False if isinstance(op, parser.LabelDef) else "no_save_ip" in op.annotations
|
||||||
return Properties(
|
return Properties(
|
||||||
|
@ -883,8 +876,7 @@ def compute_properties(op: parser.CodeDef) -> Properties:
|
||||||
stores_sp=variable_used(op, "SYNC_SP"),
|
stores_sp=variable_used(op, "SYNC_SP"),
|
||||||
uses_co_consts=variable_used(op, "FRAME_CO_CONSTS"),
|
uses_co_consts=variable_used(op, "FRAME_CO_CONSTS"),
|
||||||
uses_co_names=variable_used(op, "FRAME_CO_NAMES"),
|
uses_co_names=variable_used(op, "FRAME_CO_NAMES"),
|
||||||
uses_locals=(variable_used(op, "GETLOCAL") or variable_used(op, "SETLOCAL"))
|
uses_locals=variable_used(op, "GETLOCAL") and not has_free,
|
||||||
and not has_free,
|
|
||||||
uses_opcode=variable_used(op, "opcode"),
|
uses_opcode=variable_used(op, "opcode"),
|
||||||
has_free=has_free,
|
has_free=has_free,
|
||||||
pure=pure,
|
pure=pure,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue