mirror of https://github.com/python/cpython.git
Get rid of ERROR_IF's "label" parameter (GH-132654)
This commit is contained in:
parent
b329096cfb
commit
732d1b0241
|
@ -419,7 +419,7 @@ def test_pep7_condition(self):
|
||||||
def test_error_if_plain(self):
|
def test_error_if_plain(self):
|
||||||
input = """
|
input = """
|
||||||
inst(OP, (--)) {
|
inst(OP, (--)) {
|
||||||
ERROR_IF(cond, label);
|
ERROR_IF(cond);
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
output = """
|
output = """
|
||||||
|
@ -432,7 +432,7 @@ def test_error_if_plain(self):
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(OP);
|
INSTRUCTION_STATS(OP);
|
||||||
if (cond) {
|
if (cond) {
|
||||||
JUMP_TO_LABEL(label);
|
JUMP_TO_LABEL(error);
|
||||||
}
|
}
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ def test_error_if_plain(self):
|
||||||
def test_error_if_plain_with_comment(self):
|
def test_error_if_plain_with_comment(self):
|
||||||
input = """
|
input = """
|
||||||
inst(OP, (--)) {
|
inst(OP, (--)) {
|
||||||
ERROR_IF(cond, label); // Comment is ok
|
ERROR_IF(cond); // Comment is ok
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
output = """
|
output = """
|
||||||
|
@ -455,7 +455,7 @@ def test_error_if_plain_with_comment(self):
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(OP);
|
INSTRUCTION_STATS(OP);
|
||||||
if (cond) {
|
if (cond) {
|
||||||
JUMP_TO_LABEL(label);
|
JUMP_TO_LABEL(error);
|
||||||
}
|
}
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,7 @@ def test_error_if_pop(self):
|
||||||
inst(OP, (left, right -- res)) {
|
inst(OP, (left, right -- res)) {
|
||||||
SPAM(left, right);
|
SPAM(left, right);
|
||||||
INPUTS_DEAD();
|
INPUTS_DEAD();
|
||||||
ERROR_IF(cond, label);
|
ERROR_IF(cond);
|
||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
@ -487,7 +487,7 @@ def test_error_if_pop(self):
|
||||||
left = stack_pointer[-2];
|
left = stack_pointer[-2];
|
||||||
SPAM(left, right);
|
SPAM(left, right);
|
||||||
if (cond) {
|
if (cond) {
|
||||||
JUMP_TO_LABEL(pop_2_label);
|
JUMP_TO_LABEL(pop_2_error);
|
||||||
}
|
}
|
||||||
res = 0;
|
res = 0;
|
||||||
stack_pointer[-2] = res;
|
stack_pointer[-2] = res;
|
||||||
|
@ -503,7 +503,7 @@ def test_error_if_pop_with_result(self):
|
||||||
inst(OP, (left, right -- res)) {
|
inst(OP, (left, right -- res)) {
|
||||||
res = SPAM(left, right);
|
res = SPAM(left, right);
|
||||||
INPUTS_DEAD();
|
INPUTS_DEAD();
|
||||||
ERROR_IF(cond, label);
|
ERROR_IF(cond);
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
output = """
|
output = """
|
||||||
|
@ -522,7 +522,7 @@ def test_error_if_pop_with_result(self):
|
||||||
left = stack_pointer[-2];
|
left = stack_pointer[-2];
|
||||||
res = SPAM(left, right);
|
res = SPAM(left, right);
|
||||||
if (cond) {
|
if (cond) {
|
||||||
JUMP_TO_LABEL(pop_2_label);
|
JUMP_TO_LABEL(pop_2_error);
|
||||||
}
|
}
|
||||||
stack_pointer[-2] = res;
|
stack_pointer[-2] = res;
|
||||||
stack_pointer += -1;
|
stack_pointer += -1;
|
||||||
|
@ -903,7 +903,7 @@ def test_array_error_if(self):
|
||||||
inst(OP, (extra, values[oparg] --)) {
|
inst(OP, (extra, values[oparg] --)) {
|
||||||
DEAD(extra);
|
DEAD(extra);
|
||||||
DEAD(values);
|
DEAD(values);
|
||||||
ERROR_IF(oparg == 0, somewhere);
|
ERROR_IF(oparg == 0);
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
output = """
|
output = """
|
||||||
|
@ -922,7 +922,7 @@ def test_array_error_if(self):
|
||||||
if (oparg == 0) {
|
if (oparg == 0) {
|
||||||
stack_pointer += -1 - oparg;
|
stack_pointer += -1 - oparg;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
JUMP_TO_LABEL(somewhere);
|
JUMP_TO_LABEL(error);
|
||||||
}
|
}
|
||||||
stack_pointer += -1 - oparg;
|
stack_pointer += -1 - oparg;
|
||||||
assert(WITHIN_STACK_BOUNDS());
|
assert(WITHIN_STACK_BOUNDS());
|
||||||
|
@ -1319,7 +1319,7 @@ def test_pop_on_error_peeks(self):
|
||||||
|
|
||||||
op(THIRD, (j, k --)) {
|
op(THIRD, (j, k --)) {
|
||||||
INPUTS_DEAD(); // Mark j and k as used
|
INPUTS_DEAD(); // Mark j and k as used
|
||||||
ERROR_IF(cond, error);
|
ERROR_IF(cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro(TEST) = FIRST + SECOND + THIRD;
|
macro(TEST) = FIRST + SECOND + THIRD;
|
||||||
|
@ -1369,7 +1369,7 @@ def test_push_then_error(self):
|
||||||
|
|
||||||
op(SECOND, (a -- a, b)) {
|
op(SECOND, (a -- a, b)) {
|
||||||
b = 1;
|
b = 1;
|
||||||
ERROR_IF(cond, error);
|
ERROR_IF(cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro(TEST) = FIRST + SECOND;
|
macro(TEST) = FIRST + SECOND;
|
||||||
|
@ -1414,10 +1414,10 @@ def test_error_if_true(self):
|
||||||
|
|
||||||
input = """
|
input = """
|
||||||
inst(OP1, ( --)) {
|
inst(OP1, ( --)) {
|
||||||
ERROR_IF(true, here);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
inst(OP2, ( --)) {
|
inst(OP2, ( --)) {
|
||||||
ERROR_IF(1, there);
|
ERROR_IF(1);
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
output = """
|
output = """
|
||||||
|
@ -1429,7 +1429,7 @@ def test_error_if_true(self):
|
||||||
frame->instr_ptr = next_instr;
|
frame->instr_ptr = next_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(OP1);
|
INSTRUCTION_STATS(OP1);
|
||||||
JUMP_TO_LABEL(here);
|
JUMP_TO_LABEL(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(OP2) {
|
TARGET(OP2) {
|
||||||
|
@ -1440,7 +1440,7 @@ def test_error_if_true(self):
|
||||||
frame->instr_ptr = next_instr;
|
frame->instr_ptr = next_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(OP2);
|
INSTRUCTION_STATS(OP2);
|
||||||
JUMP_TO_LABEL(there);
|
JUMP_TO_LABEL(error);
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
self.run_cases_test(input, output)
|
self.run_cases_test(input, output)
|
||||||
|
@ -1716,7 +1716,7 @@ def test_no_escaping_calls_in_branching_macros(self):
|
||||||
|
|
||||||
input = """
|
input = """
|
||||||
inst(OP, ( -- )) {
|
inst(OP, ( -- )) {
|
||||||
ERROR_IF(escaping_call(), error);
|
ERROR_IF(escaping_call());
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
with self.assertRaises(SyntaxError):
|
with self.assertRaises(SyntaxError):
|
||||||
|
|
|
@ -156,7 +156,7 @@ dummy_func(
|
||||||
QSBR_QUIESCENT_STATE(tstate);
|
QSBR_QUIESCENT_STATE(tstate);
|
||||||
if (_Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & _PY_EVAL_EVENTS_MASK) {
|
if (_Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & _PY_EVAL_EVENTS_MASK) {
|
||||||
int err = _Py_HandlePending(tstate);
|
int err = _Py_HandlePending(tstate);
|
||||||
ERROR_IF(err != 0, error);
|
ERROR_IF(err != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ dummy_func(
|
||||||
QSBR_QUIESCENT_STATE(tstate);
|
QSBR_QUIESCENT_STATE(tstate);
|
||||||
if (_Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & _PY_EVAL_EVENTS_MASK) {
|
if (_Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & _PY_EVAL_EVENTS_MASK) {
|
||||||
int err = _Py_HandlePending(tstate);
|
int err = _Py_HandlePending(tstate);
|
||||||
ERROR_IF(err != 0, error);
|
ERROR_IF(err != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ dummy_func(
|
||||||
((_PyThreadStateImpl *)tstate)->tlbc_index) {
|
((_PyThreadStateImpl *)tstate)->tlbc_index) {
|
||||||
_Py_CODEUNIT *bytecode =
|
_Py_CODEUNIT *bytecode =
|
||||||
_PyEval_GetExecutableCode(tstate, _PyFrame_GetCode(frame));
|
_PyEval_GetExecutableCode(tstate, _PyFrame_GetCode(frame));
|
||||||
ERROR_IF(bytecode == NULL, error);
|
ERROR_IF(bytecode == NULL);
|
||||||
ptrdiff_t off = this_instr - _PyFrame_GetBytecode(frame);
|
ptrdiff_t off = this_instr - _PyFrame_GetBytecode(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;
|
||||||
|
@ -236,7 +236,7 @@ dummy_func(
|
||||||
op(_MONITOR_RESUME, (--)) {
|
op(_MONITOR_RESUME, (--)) {
|
||||||
int err = _Py_call_instrumentation(
|
int err = _Py_call_instrumentation(
|
||||||
tstate, oparg > 0, frame, this_instr);
|
tstate, oparg > 0, frame, this_instr);
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
if (frame->instr_ptr != this_instr) {
|
if (frame->instr_ptr != this_instr) {
|
||||||
/* Instrumentation has jumped */
|
/* Instrumentation has jumped */
|
||||||
next_instr = frame->instr_ptr;
|
next_instr = frame->instr_ptr;
|
||||||
|
@ -260,7 +260,7 @@ dummy_func(
|
||||||
UNBOUNDLOCAL_ERROR_MSG,
|
UNBOUNDLOCAL_ERROR_MSG,
|
||||||
PyTuple_GetItem(_PyFrame_GetCode(frame)->co_localsplusnames, oparg)
|
PyTuple_GetItem(_PyFrame_GetCode(frame)->co_localsplusnames, oparg)
|
||||||
);
|
);
|
||||||
ERROR_IF(1, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
value = PyStackRef_DUP(value_s);
|
value = PyStackRef_DUP(value_s);
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ dummy_func(
|
||||||
inst(UNARY_NEGATIVE, (value -- res)) {
|
inst(UNARY_NEGATIVE, (value -- res)) {
|
||||||
PyObject *res_o = PyNumber_Negative(PyStackRef_AsPyObjectBorrow(value));
|
PyObject *res_o = PyNumber_Negative(PyStackRef_AsPyObjectBorrow(value));
|
||||||
PyStackRef_CLOSE(value);
|
PyStackRef_CLOSE(value);
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ dummy_func(
|
||||||
op(_TO_BOOL, (value -- res)) {
|
op(_TO_BOOL, (value -- res)) {
|
||||||
int err = PyObject_IsTrue(PyStackRef_AsPyObjectBorrow(value));
|
int err = PyObject_IsTrue(PyStackRef_AsPyObjectBorrow(value));
|
||||||
PyStackRef_CLOSE(value);
|
PyStackRef_CLOSE(value);
|
||||||
ERROR_IF(err < 0, error);
|
ERROR_IF(err < 0);
|
||||||
res = err ? PyStackRef_True : PyStackRef_False;
|
res = err ? PyStackRef_True : PyStackRef_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ dummy_func(
|
||||||
inst(UNARY_INVERT, (value -- res)) {
|
inst(UNARY_INVERT, (value -- res)) {
|
||||||
PyObject *res_o = PyNumber_Invert(PyStackRef_AsPyObjectBorrow(value));
|
PyObject *res_o = PyNumber_Invert(PyStackRef_AsPyObjectBorrow(value));
|
||||||
PyStackRef_CLOSE(value);
|
PyStackRef_CLOSE(value);
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,7 +618,7 @@ dummy_func(
|
||||||
PyStackRef_CLOSE_SPECIALIZED(right, _PyLong_ExactDealloc);
|
PyStackRef_CLOSE_SPECIALIZED(right, _PyLong_ExactDealloc);
|
||||||
PyStackRef_CLOSE_SPECIALIZED(left, _PyLong_ExactDealloc);
|
PyStackRef_CLOSE_SPECIALIZED(left, _PyLong_ExactDealloc);
|
||||||
INPUTS_DEAD();
|
INPUTS_DEAD();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,7 +633,7 @@ dummy_func(
|
||||||
PyStackRef_CLOSE_SPECIALIZED(right, _PyLong_ExactDealloc);
|
PyStackRef_CLOSE_SPECIALIZED(right, _PyLong_ExactDealloc);
|
||||||
PyStackRef_CLOSE_SPECIALIZED(left, _PyLong_ExactDealloc);
|
PyStackRef_CLOSE_SPECIALIZED(left, _PyLong_ExactDealloc);
|
||||||
INPUTS_DEAD();
|
INPUTS_DEAD();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,7 +648,7 @@ dummy_func(
|
||||||
PyStackRef_CLOSE_SPECIALIZED(right, _PyLong_ExactDealloc);
|
PyStackRef_CLOSE_SPECIALIZED(right, _PyLong_ExactDealloc);
|
||||||
PyStackRef_CLOSE_SPECIALIZED(left, _PyLong_ExactDealloc);
|
PyStackRef_CLOSE_SPECIALIZED(left, _PyLong_ExactDealloc);
|
||||||
INPUTS_DEAD();
|
INPUTS_DEAD();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,7 +681,7 @@ dummy_func(
|
||||||
((PyFloatObject *)right_o)->ob_fval;
|
((PyFloatObject *)right_o)->ob_fval;
|
||||||
res = _PyFloat_FromDouble_ConsumeInputs(left, right, dres);
|
res = _PyFloat_FromDouble_ConsumeInputs(left, right, dres);
|
||||||
INPUTS_DEAD();
|
INPUTS_DEAD();
|
||||||
ERROR_IF(PyStackRef_IsNull(res), error);
|
ERROR_IF(PyStackRef_IsNull(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
pure op(_BINARY_OP_ADD_FLOAT, (left, right -- res)) {
|
pure op(_BINARY_OP_ADD_FLOAT, (left, right -- res)) {
|
||||||
|
@ -696,7 +696,7 @@ dummy_func(
|
||||||
((PyFloatObject *)right_o)->ob_fval;
|
((PyFloatObject *)right_o)->ob_fval;
|
||||||
res = _PyFloat_FromDouble_ConsumeInputs(left, right, dres);
|
res = _PyFloat_FromDouble_ConsumeInputs(left, right, dres);
|
||||||
INPUTS_DEAD();
|
INPUTS_DEAD();
|
||||||
ERROR_IF(PyStackRef_IsNull(res), error);
|
ERROR_IF(PyStackRef_IsNull(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
pure op(_BINARY_OP_SUBTRACT_FLOAT, (left, right -- res)) {
|
pure op(_BINARY_OP_SUBTRACT_FLOAT, (left, right -- res)) {
|
||||||
|
@ -711,7 +711,7 @@ dummy_func(
|
||||||
((PyFloatObject *)right_o)->ob_fval;
|
((PyFloatObject *)right_o)->ob_fval;
|
||||||
res = _PyFloat_FromDouble_ConsumeInputs(left, right, dres);
|
res = _PyFloat_FromDouble_ConsumeInputs(left, right, dres);
|
||||||
INPUTS_DEAD();
|
INPUTS_DEAD();
|
||||||
ERROR_IF(PyStackRef_IsNull(res), error);
|
ERROR_IF(PyStackRef_IsNull(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
macro(BINARY_OP_MULTIPLY_FLOAT) =
|
macro(BINARY_OP_MULTIPLY_FLOAT) =
|
||||||
|
@ -732,7 +732,7 @@ dummy_func(
|
||||||
PyStackRef_CLOSE_SPECIALIZED(right, _PyUnicode_ExactDealloc);
|
PyStackRef_CLOSE_SPECIALIZED(right, _PyUnicode_ExactDealloc);
|
||||||
PyStackRef_CLOSE_SPECIALIZED(left, _PyUnicode_ExactDealloc);
|
PyStackRef_CLOSE_SPECIALIZED(left, _PyUnicode_ExactDealloc);
|
||||||
INPUTS_DEAD();
|
INPUTS_DEAD();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,7 +780,7 @@ dummy_func(
|
||||||
PyUnicode_Append(&temp, right_o);
|
PyUnicode_Append(&temp, right_o);
|
||||||
*target_local = PyStackRef_FromPyObjectSteal(temp);
|
*target_local = PyStackRef_FromPyObjectSteal(temp);
|
||||||
Py_DECREF(right_o);
|
Py_DECREF(right_o);
|
||||||
ERROR_IF(PyStackRef_IsNull(*target_local), error);
|
ERROR_IF(PyStackRef_IsNull(*target_local));
|
||||||
#if TIER_ONE
|
#if TIER_ONE
|
||||||
// The STORE_FAST is already done. This is done here in tier one,
|
// The STORE_FAST is already done. This is done here in tier one,
|
||||||
// and during trace projection in tier two:
|
// and during trace projection in tier two:
|
||||||
|
@ -839,7 +839,7 @@ dummy_func(
|
||||||
Py_DECREF(slice);
|
Py_DECREF(slice);
|
||||||
}
|
}
|
||||||
PyStackRef_CLOSE(container);
|
PyStackRef_CLOSE(container);
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -864,7 +864,7 @@ dummy_func(
|
||||||
Py_DECREF(slice);
|
Py_DECREF(slice);
|
||||||
}
|
}
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro(STORE_SLICE) = _SPECIALIZE_STORE_SLICE + _STORE_SLICE;
|
macro(STORE_SLICE) = _SPECIALIZE_STORE_SLICE + _STORE_SLICE;
|
||||||
|
@ -978,7 +978,7 @@ dummy_func(
|
||||||
_PyErr_SetKeyError(sub);
|
_PyErr_SetKeyError(sub);
|
||||||
}
|
}
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(rc <= 0, error); // not found or error
|
ERROR_IF(rc <= 0); // not found or error
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,13 +1016,13 @@ dummy_func(
|
||||||
inst(LIST_APPEND, (list, unused[oparg-1], v -- list, unused[oparg-1])) {
|
inst(LIST_APPEND, (list, unused[oparg-1], v -- list, unused[oparg-1])) {
|
||||||
int err = _PyList_AppendTakeRef((PyListObject *)PyStackRef_AsPyObjectBorrow(list),
|
int err = _PyList_AppendTakeRef((PyListObject *)PyStackRef_AsPyObjectBorrow(list),
|
||||||
PyStackRef_AsPyObjectSteal(v));
|
PyStackRef_AsPyObjectSteal(v));
|
||||||
ERROR_IF(err < 0, error);
|
ERROR_IF(err < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(SET_ADD, (set, unused[oparg-1], v -- set, unused[oparg-1])) {
|
inst(SET_ADD, (set, unused[oparg-1], v -- set, unused[oparg-1])) {
|
||||||
int err = _PySet_AddTakeRef((PySetObject *)PyStackRef_AsPyObjectBorrow(set),
|
int err = _PySet_AddTakeRef((PySetObject *)PyStackRef_AsPyObjectBorrow(set),
|
||||||
PyStackRef_AsPyObjectSteal(v));
|
PyStackRef_AsPyObjectSteal(v));
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
family(STORE_SUBSCR, INLINE_CACHE_ENTRIES_STORE_SUBSCR) = {
|
family(STORE_SUBSCR, INLINE_CACHE_ENTRIES_STORE_SUBSCR) = {
|
||||||
|
@ -1046,7 +1046,7 @@ dummy_func(
|
||||||
/* container[sub] = v */
|
/* container[sub] = v */
|
||||||
int err = PyObject_SetItem(PyStackRef_AsPyObjectBorrow(container), PyStackRef_AsPyObjectBorrow(sub), PyStackRef_AsPyObjectBorrow(v));
|
int err = PyObject_SetItem(PyStackRef_AsPyObjectBorrow(container), PyStackRef_AsPyObjectBorrow(sub), PyStackRef_AsPyObjectBorrow(v));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro(STORE_SUBSCR) = _SPECIALIZE_STORE_SUBSCR + _STORE_SUBSCR;
|
macro(STORE_SUBSCR) = _SPECIALIZE_STORE_SUBSCR + _STORE_SUBSCR;
|
||||||
|
@ -1095,7 +1095,7 @@ dummy_func(
|
||||||
PyStackRef_AsPyObjectSteal(sub),
|
PyStackRef_AsPyObjectSteal(sub),
|
||||||
PyStackRef_AsPyObjectSteal(value));
|
PyStackRef_AsPyObjectSteal(value));
|
||||||
PyStackRef_CLOSE(dict_st);
|
PyStackRef_CLOSE(dict_st);
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(DELETE_SUBSCR, (container, sub --)) {
|
inst(DELETE_SUBSCR, (container, sub --)) {
|
||||||
|
@ -1103,14 +1103,14 @@ dummy_func(
|
||||||
int err = PyObject_DelItem(PyStackRef_AsPyObjectBorrow(container),
|
int err = PyObject_DelItem(PyStackRef_AsPyObjectBorrow(container),
|
||||||
PyStackRef_AsPyObjectBorrow(sub));
|
PyStackRef_AsPyObjectBorrow(sub));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(CALL_INTRINSIC_1, (value -- res)) {
|
inst(CALL_INTRINSIC_1, (value -- res)) {
|
||||||
assert(oparg <= MAX_INTRINSIC_1);
|
assert(oparg <= MAX_INTRINSIC_1);
|
||||||
PyObject *res_o = _PyIntrinsics_UnaryFunctions[oparg].func(tstate, PyStackRef_AsPyObjectBorrow(value));
|
PyObject *res_o = _PyIntrinsics_UnaryFunctions[oparg].func(tstate, PyStackRef_AsPyObjectBorrow(value));
|
||||||
PyStackRef_CLOSE(value);
|
PyStackRef_CLOSE(value);
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1121,7 +1121,7 @@ dummy_func(
|
||||||
|
|
||||||
PyObject *res_o = _PyIntrinsics_BinaryFunctions[oparg].func(tstate, value2, value1);
|
PyObject *res_o = _PyIntrinsics_BinaryFunctions[oparg].func(tstate, value2, value1);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1135,7 +1135,7 @@ dummy_func(
|
||||||
monitor_reraise(tstate, frame, this_instr);
|
monitor_reraise(tstate, frame, this_instr);
|
||||||
goto exception_unwind;
|
goto exception_unwind;
|
||||||
}
|
}
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
tier1 inst(INTERPRETER_EXIT, (retval --)) {
|
tier1 inst(INTERPRETER_EXIT, (retval --)) {
|
||||||
|
@ -1173,7 +1173,7 @@ dummy_func(
|
||||||
int err = _Py_call_instrumentation_arg(
|
int err = _Py_call_instrumentation_arg(
|
||||||
tstate, PY_MONITORING_EVENT_PY_RETURN,
|
tstate, PY_MONITORING_EVENT_PY_RETURN,
|
||||||
frame, this_instr, PyStackRef_AsPyObjectBorrow(val));
|
frame, this_instr, PyStackRef_AsPyObjectBorrow(val));
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro(INSTRUMENTED_RETURN_VALUE) =
|
macro(INSTRUMENTED_RETURN_VALUE) =
|
||||||
|
@ -1196,12 +1196,12 @@ dummy_func(
|
||||||
"__aiter__ method, got %.100s",
|
"__aiter__ method, got %.100s",
|
||||||
type->tp_name);
|
type->tp_name);
|
||||||
PyStackRef_CLOSE(obj);
|
PyStackRef_CLOSE(obj);
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
iter_o = (*getter)(obj_o);
|
iter_o = (*getter)(obj_o);
|
||||||
PyStackRef_CLOSE(obj);
|
PyStackRef_CLOSE(obj);
|
||||||
ERROR_IF(iter_o == NULL, error);
|
ERROR_IF(iter_o == NULL);
|
||||||
|
|
||||||
if (Py_TYPE(iter_o)->tp_as_async == NULL ||
|
if (Py_TYPE(iter_o)->tp_as_async == NULL ||
|
||||||
Py_TYPE(iter_o)->tp_as_async->am_anext == NULL) {
|
Py_TYPE(iter_o)->tp_as_async->am_anext == NULL) {
|
||||||
|
@ -1211,7 +1211,7 @@ dummy_func(
|
||||||
"that does not implement __anext__: %.100s",
|
"that does not implement __anext__: %.100s",
|
||||||
Py_TYPE(iter_o)->tp_name);
|
Py_TYPE(iter_o)->tp_name);
|
||||||
Py_DECREF(iter_o);
|
Py_DECREF(iter_o);
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
iter = PyStackRef_FromPyObjectSteal(iter_o);
|
iter = PyStackRef_FromPyObjectSteal(iter_o);
|
||||||
}
|
}
|
||||||
|
@ -1227,7 +1227,7 @@ dummy_func(
|
||||||
inst(GET_AWAITABLE, (iterable -- iter)) {
|
inst(GET_AWAITABLE, (iterable -- iter)) {
|
||||||
PyObject *iter_o = _PyEval_GetAwaitable(PyStackRef_AsPyObjectBorrow(iterable), oparg);
|
PyObject *iter_o = _PyEval_GetAwaitable(PyStackRef_AsPyObjectBorrow(iterable), oparg);
|
||||||
PyStackRef_CLOSE(iterable);
|
PyStackRef_CLOSE(iterable);
|
||||||
ERROR_IF(iter_o == NULL, error);
|
ERROR_IF(iter_o == NULL);
|
||||||
iter = PyStackRef_FromPyObjectSteal(iter_o);
|
iter = PyStackRef_FromPyObjectSteal(iter_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1289,7 +1289,7 @@ dummy_func(
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyStackRef_CLOSE(v);
|
PyStackRef_CLOSE(v);
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PyStackRef_CLOSE(v);
|
PyStackRef_CLOSE(v);
|
||||||
|
@ -1450,11 +1450,11 @@ dummy_func(
|
||||||
inst(LOAD_BUILD_CLASS, ( -- bc)) {
|
inst(LOAD_BUILD_CLASS, ( -- bc)) {
|
||||||
PyObject *bc_o;
|
PyObject *bc_o;
|
||||||
int err = PyMapping_GetOptionalItem(BUILTINS(), &_Py_ID(__build_class__), &bc_o);
|
int err = PyMapping_GetOptionalItem(BUILTINS(), &_Py_ID(__build_class__), &bc_o);
|
||||||
ERROR_IF(err < 0, error);
|
ERROR_IF(err < 0);
|
||||||
if (bc_o == NULL) {
|
if (bc_o == NULL) {
|
||||||
_PyErr_SetString(tstate, PyExc_NameError,
|
_PyErr_SetString(tstate, PyExc_NameError,
|
||||||
"__build_class__ not found");
|
"__build_class__ not found");
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
bc = PyStackRef_FromPyObjectSteal(bc_o);
|
bc = PyStackRef_FromPyObjectSteal(bc_o);
|
||||||
}
|
}
|
||||||
|
@ -1467,7 +1467,7 @@ dummy_func(
|
||||||
_PyErr_Format(tstate, PyExc_SystemError,
|
_PyErr_Format(tstate, PyExc_SystemError,
|
||||||
"no locals found when storing %R", name);
|
"no locals found when storing %R", name);
|
||||||
PyStackRef_CLOSE(v);
|
PyStackRef_CLOSE(v);
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
if (PyDict_CheckExact(ns)) {
|
if (PyDict_CheckExact(ns)) {
|
||||||
err = PyDict_SetItem(ns, name, PyStackRef_AsPyObjectBorrow(v));
|
err = PyDict_SetItem(ns, name, PyStackRef_AsPyObjectBorrow(v));
|
||||||
|
@ -1476,7 +1476,7 @@ dummy_func(
|
||||||
err = PyObject_SetItem(ns, name, PyStackRef_AsPyObjectBorrow(v));
|
err = PyObject_SetItem(ns, name, PyStackRef_AsPyObjectBorrow(v));
|
||||||
}
|
}
|
||||||
PyStackRef_CLOSE(v);
|
PyStackRef_CLOSE(v);
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(DELETE_NAME, (--)) {
|
inst(DELETE_NAME, (--)) {
|
||||||
|
@ -1522,7 +1522,7 @@ dummy_func(
|
||||||
PyObject *seq_o = PyStackRef_AsPyObjectSteal(seq);
|
PyObject *seq_o = PyStackRef_AsPyObjectSteal(seq);
|
||||||
int res = _PyEval_UnpackIterableStackRef(tstate, seq_o, oparg, -1, top);
|
int res = _PyEval_UnpackIterableStackRef(tstate, seq_o, oparg, -1, top);
|
||||||
Py_DECREF(seq_o);
|
Py_DECREF(seq_o);
|
||||||
ERROR_IF(res == 0, error);
|
ERROR_IF(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro(UNPACK_SEQUENCE) = _SPECIALIZE_UNPACK_SEQUENCE + _UNPACK_SEQUENCE;
|
macro(UNPACK_SEQUENCE) = _SPECIALIZE_UNPACK_SEQUENCE + _UNPACK_SEQUENCE;
|
||||||
|
@ -1580,7 +1580,7 @@ dummy_func(
|
||||||
PyObject *seq_o = PyStackRef_AsPyObjectSteal(seq);
|
PyObject *seq_o = PyStackRef_AsPyObjectSteal(seq);
|
||||||
int res = _PyEval_UnpackIterableStackRef(tstate, seq_o, oparg & 0xFF, oparg >> 8, top);
|
int res = _PyEval_UnpackIterableStackRef(tstate, seq_o, oparg & 0xFF, oparg >> 8, top);
|
||||||
Py_DECREF(seq_o);
|
Py_DECREF(seq_o);
|
||||||
ERROR_IF(res == 0, error);
|
ERROR_IF(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
family(STORE_ATTR, INLINE_CACHE_ENTRIES_STORE_ATTR) = {
|
family(STORE_ATTR, INLINE_CACHE_ENTRIES_STORE_ATTR) = {
|
||||||
|
@ -1607,7 +1607,7 @@ dummy_func(
|
||||||
int err = PyObject_SetAttr(PyStackRef_AsPyObjectBorrow(owner),
|
int err = PyObject_SetAttr(PyStackRef_AsPyObjectBorrow(owner),
|
||||||
name, PyStackRef_AsPyObjectBorrow(v));
|
name, PyStackRef_AsPyObjectBorrow(v));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro(STORE_ATTR) = _SPECIALIZE_STORE_ATTR + unused/3 + _STORE_ATTR;
|
macro(STORE_ATTR) = _SPECIALIZE_STORE_ATTR + unused/3 + _STORE_ATTR;
|
||||||
|
@ -1616,14 +1616,14 @@ dummy_func(
|
||||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
||||||
int err = PyObject_DelAttr(PyStackRef_AsPyObjectBorrow(owner), name);
|
int err = PyObject_DelAttr(PyStackRef_AsPyObjectBorrow(owner), name);
|
||||||
PyStackRef_CLOSE(owner);
|
PyStackRef_CLOSE(owner);
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(STORE_GLOBAL, (v --)) {
|
inst(STORE_GLOBAL, (v --)) {
|
||||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
||||||
int err = PyDict_SetItem(GLOBALS(), name, PyStackRef_AsPyObjectBorrow(v));
|
int err = PyDict_SetItem(GLOBALS(), name, PyStackRef_AsPyObjectBorrow(v));
|
||||||
PyStackRef_CLOSE(v);
|
PyStackRef_CLOSE(v);
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(DELETE_GLOBAL, (--)) {
|
inst(DELETE_GLOBAL, (--)) {
|
||||||
|
@ -1645,7 +1645,7 @@ dummy_func(
|
||||||
if (l == NULL) {
|
if (l == NULL) {
|
||||||
_PyErr_SetString(tstate, PyExc_SystemError,
|
_PyErr_SetString(tstate, PyExc_SystemError,
|
||||||
"no locals found");
|
"no locals found");
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
locals = PyStackRef_FromPyObjectNew(l);
|
locals = PyStackRef_FromPyObjectNew(l);
|
||||||
}
|
}
|
||||||
|
@ -1655,7 +1655,7 @@ dummy_func(
|
||||||
PyObject *v_o;
|
PyObject *v_o;
|
||||||
int err = PyMapping_GetOptionalItem(PyStackRef_AsPyObjectBorrow(mod_or_class_dict), name, &v_o);
|
int err = PyMapping_GetOptionalItem(PyStackRef_AsPyObjectBorrow(mod_or_class_dict), name, &v_o);
|
||||||
PyStackRef_CLOSE(mod_or_class_dict);
|
PyStackRef_CLOSE(mod_or_class_dict);
|
||||||
ERROR_IF(err < 0, error);
|
ERROR_IF(err < 0);
|
||||||
if (v_o == NULL) {
|
if (v_o == NULL) {
|
||||||
if (PyDict_CheckExact(GLOBALS())
|
if (PyDict_CheckExact(GLOBALS())
|
||||||
&& PyDict_CheckExact(BUILTINS()))
|
&& PyDict_CheckExact(BUILTINS()))
|
||||||
|
@ -1677,16 +1677,16 @@ dummy_func(
|
||||||
/* Slow-path if globals or builtins is not a dict */
|
/* Slow-path if globals or builtins is not a dict */
|
||||||
/* namespace 1: globals */
|
/* namespace 1: globals */
|
||||||
int err = PyMapping_GetOptionalItem(GLOBALS(), name, &v_o);
|
int err = PyMapping_GetOptionalItem(GLOBALS(), name, &v_o);
|
||||||
ERROR_IF(err < 0, error);
|
ERROR_IF(err < 0);
|
||||||
if (v_o == NULL) {
|
if (v_o == NULL) {
|
||||||
/* namespace 2: builtins */
|
/* namespace 2: builtins */
|
||||||
int err = PyMapping_GetOptionalItem(BUILTINS(), name, &v_o);
|
int err = PyMapping_GetOptionalItem(BUILTINS(), name, &v_o);
|
||||||
ERROR_IF(err < 0, error);
|
ERROR_IF(err < 0);
|
||||||
if (v_o == NULL) {
|
if (v_o == NULL) {
|
||||||
_PyEval_FormatExcCheckArg(
|
_PyEval_FormatExcCheckArg(
|
||||||
tstate, PyExc_NameError,
|
tstate, PyExc_NameError,
|
||||||
NAME_ERROR_MSG, name);
|
NAME_ERROR_MSG, name);
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1697,7 +1697,7 @@ dummy_func(
|
||||||
inst(LOAD_NAME, (-- v)) {
|
inst(LOAD_NAME, (-- v)) {
|
||||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
||||||
PyObject *v_o = _PyEval_LoadName(tstate, frame, name);
|
PyObject *v_o = _PyEval_LoadName(tstate, frame, name);
|
||||||
ERROR_IF(v_o == NULL, error);
|
ERROR_IF(v_o == NULL);
|
||||||
v = PyStackRef_FromPyObjectSteal(v_o);
|
v = PyStackRef_FromPyObjectSteal(v_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1723,7 +1723,7 @@ dummy_func(
|
||||||
op(_LOAD_GLOBAL, ( -- res[1])) {
|
op(_LOAD_GLOBAL, ( -- res[1])) {
|
||||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1);
|
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1);
|
||||||
_PyEval_LoadGlobalStackRef(GLOBALS(), BUILTINS(), name, res);
|
_PyEval_LoadGlobalStackRef(GLOBALS(), BUILTINS(), name, res);
|
||||||
ERROR_IF(PyStackRef_IsNull(*res), error);
|
ERROR_IF(PyStackRef_IsNull(*res));
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_PUSH_NULL_CONDITIONAL, ( -- null[oparg & 1])) {
|
op(_PUSH_NULL_CONDITIONAL, ( -- null[oparg & 1])) {
|
||||||
|
@ -1806,7 +1806,7 @@ dummy_func(
|
||||||
UNBOUNDLOCAL_ERROR_MSG,
|
UNBOUNDLOCAL_ERROR_MSG,
|
||||||
PyTuple_GetItem(_PyFrame_GetCode(frame)->co_localsplusnames, oparg)
|
PyTuple_GetItem(_PyFrame_GetCode(frame)->co_localsplusnames, oparg)
|
||||||
);
|
);
|
||||||
ERROR_IF(1, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
_PyStackRef tmp = GETLOCAL(oparg);
|
_PyStackRef tmp = GETLOCAL(oparg);
|
||||||
GETLOCAL(oparg) = PyStackRef_NULL;
|
GETLOCAL(oparg) = PyStackRef_NULL;
|
||||||
|
@ -1867,7 +1867,7 @@ dummy_func(
|
||||||
value = _PyCell_GetStackRef(cell);
|
value = _PyCell_GetStackRef(cell);
|
||||||
if (PyStackRef_IsNull(value)) {
|
if (PyStackRef_IsNull(value)) {
|
||||||
_PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg);
|
_PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg);
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1894,12 +1894,12 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS(pieces, oparg, pieces_o);
|
STACKREFS_TO_PYOBJECTS(pieces, oparg, pieces_o);
|
||||||
if (CONVERSION_FAILED(pieces_o)) {
|
if (CONVERSION_FAILED(pieces_o)) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyObject *str_o = _PyUnicode_JoinArray(&_Py_STR(empty), pieces_o, oparg);
|
PyObject *str_o = _PyUnicode_JoinArray(&_Py_STR(empty), pieces_o, oparg);
|
||||||
STACKREFS_TO_PYOBJECTS_CLEANUP(pieces_o);
|
STACKREFS_TO_PYOBJECTS_CLEANUP(pieces_o);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(str_o == NULL, error);
|
ERROR_IF(str_o == NULL);
|
||||||
str = PyStackRef_FromPyObjectSteal(str_o);
|
str = PyStackRef_FromPyObjectSteal(str_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1937,7 +1937,7 @@ dummy_func(
|
||||||
Py_TYPE(iterable)->tp_name);
|
Py_TYPE(iterable)->tp_name);
|
||||||
}
|
}
|
||||||
PyStackRef_CLOSE(iterable_st);
|
PyStackRef_CLOSE(iterable_st);
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
assert(Py_IsNone(none_val));
|
assert(Py_IsNone(none_val));
|
||||||
PyStackRef_CLOSE(iterable_st);
|
PyStackRef_CLOSE(iterable_st);
|
||||||
|
@ -1947,14 +1947,14 @@ dummy_func(
|
||||||
int err = _PySet_Update(PyStackRef_AsPyObjectBorrow(set),
|
int err = _PySet_Update(PyStackRef_AsPyObjectBorrow(set),
|
||||||
PyStackRef_AsPyObjectBorrow(iterable));
|
PyStackRef_AsPyObjectBorrow(iterable));
|
||||||
PyStackRef_CLOSE(iterable);
|
PyStackRef_CLOSE(iterable);
|
||||||
ERROR_IF(err < 0, error);
|
ERROR_IF(err < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(BUILD_SET, (values[oparg] -- set)) {
|
inst(BUILD_SET, (values[oparg] -- set)) {
|
||||||
PyObject *set_o = PySet_New(NULL);
|
PyObject *set_o = PySet_New(NULL);
|
||||||
if (set_o == NULL) {
|
if (set_o == NULL) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
@ -1971,7 +1971,7 @@ dummy_func(
|
||||||
DEAD(values);
|
DEAD(values);
|
||||||
if (err) {
|
if (err) {
|
||||||
Py_DECREF(set_o);
|
Py_DECREF(set_o);
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
INPUTS_DEAD();
|
INPUTS_DEAD();
|
||||||
|
@ -1982,7 +1982,7 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS(values, oparg*2, values_o);
|
STACKREFS_TO_PYOBJECTS(values, oparg*2, values_o);
|
||||||
if (CONVERSION_FAILED(values_o)) {
|
if (CONVERSION_FAILED(values_o)) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyObject *map_o = _PyDict_FromItems(
|
PyObject *map_o = _PyDict_FromItems(
|
||||||
values_o, 2,
|
values_o, 2,
|
||||||
|
@ -1990,7 +1990,7 @@ dummy_func(
|
||||||
oparg);
|
oparg);
|
||||||
STACKREFS_TO_PYOBJECTS_CLEANUP(values_o);
|
STACKREFS_TO_PYOBJECTS_CLEANUP(values_o);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(map_o == NULL, error);
|
ERROR_IF(map_o == NULL);
|
||||||
map = PyStackRef_FromPyObjectStealMortal(map_o);
|
map = PyStackRef_FromPyObjectStealMortal(map_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1999,18 +1999,18 @@ dummy_func(
|
||||||
if (LOCALS() == NULL) {
|
if (LOCALS() == NULL) {
|
||||||
_PyErr_Format(tstate, PyExc_SystemError,
|
_PyErr_Format(tstate, PyExc_SystemError,
|
||||||
"no locals found when setting up annotations");
|
"no locals found when setting up annotations");
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
/* check if __annotations__ in locals()... */
|
/* check if __annotations__ in locals()... */
|
||||||
int err = PyMapping_GetOptionalItem(LOCALS(), &_Py_ID(__annotations__), &ann_dict);
|
int err = PyMapping_GetOptionalItem(LOCALS(), &_Py_ID(__annotations__), &ann_dict);
|
||||||
ERROR_IF(err < 0, error);
|
ERROR_IF(err < 0);
|
||||||
if (ann_dict == NULL) {
|
if (ann_dict == NULL) {
|
||||||
ann_dict = PyDict_New();
|
ann_dict = PyDict_New();
|
||||||
ERROR_IF(ann_dict == NULL, error);
|
ERROR_IF(ann_dict == NULL);
|
||||||
err = PyObject_SetItem(LOCALS(), &_Py_ID(__annotations__),
|
err = PyObject_SetItem(LOCALS(), &_Py_ID(__annotations__),
|
||||||
ann_dict);
|
ann_dict);
|
||||||
Py_DECREF(ann_dict);
|
Py_DECREF(ann_dict);
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Py_DECREF(ann_dict);
|
Py_DECREF(ann_dict);
|
||||||
|
@ -2034,7 +2034,7 @@ dummy_func(
|
||||||
Py_TYPE(update_o)->tp_name);
|
Py_TYPE(update_o)->tp_name);
|
||||||
}
|
}
|
||||||
PyStackRef_CLOSE(update);
|
PyStackRef_CLOSE(update);
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyStackRef_CLOSE(update);
|
PyStackRef_CLOSE(update);
|
||||||
}
|
}
|
||||||
|
@ -2048,7 +2048,7 @@ dummy_func(
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
_PyEval_FormatKwargsError(tstate, callable_o, update_o);
|
_PyEval_FormatKwargsError(tstate, callable_o, update_o);
|
||||||
PyStackRef_CLOSE(update);
|
PyStackRef_CLOSE(update);
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyStackRef_CLOSE(update);
|
PyStackRef_CLOSE(update);
|
||||||
}
|
}
|
||||||
|
@ -2063,7 +2063,7 @@ dummy_func(
|
||||||
PyStackRef_AsPyObjectSteal(key),
|
PyStackRef_AsPyObjectSteal(key),
|
||||||
PyStackRef_AsPyObjectSteal(value)
|
PyStackRef_AsPyObjectSteal(value)
|
||||||
);
|
);
|
||||||
ERROR_IF(err != 0, error);
|
ERROR_IF(err != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro(INSTRUMENTED_LOAD_SUPER_ATTR) =
|
macro(INSTRUMENTED_LOAD_SUPER_ATTR) =
|
||||||
|
@ -2101,7 +2101,7 @@ dummy_func(
|
||||||
frame, this_instr, global_super, arg);
|
frame, this_instr, global_super, arg);
|
||||||
if (err) {
|
if (err) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// we make no attempt to optimize here; specializations should
|
// we make no attempt to optimize here; specializations should
|
||||||
|
@ -2125,11 +2125,11 @@ dummy_func(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(super == NULL, error);
|
ERROR_IF(super == NULL);
|
||||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2);
|
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2);
|
||||||
PyObject *attr_o = PyObject_GetAttr(super, name);
|
PyObject *attr_o = PyObject_GetAttr(super, name);
|
||||||
Py_DECREF(super);
|
Py_DECREF(super);
|
||||||
ERROR_IF(attr_o == NULL, error);
|
ERROR_IF(attr_o == NULL);
|
||||||
attr = PyStackRef_FromPyObjectSteal(attr_o);
|
attr = PyStackRef_FromPyObjectSteal(attr_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2150,7 +2150,7 @@ dummy_func(
|
||||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2);
|
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2);
|
||||||
PyObject *attr = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL);
|
PyObject *attr = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(attr == NULL, error);
|
ERROR_IF(attr == NULL);
|
||||||
attr_st = PyStackRef_FromPyObjectSteal(attr);
|
attr_st = PyStackRef_FromPyObjectSteal(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2236,7 +2236,7 @@ dummy_func(
|
||||||
meth | NULL | arg1 | ... | argN
|
meth | NULL | arg1 | ... | argN
|
||||||
*/
|
*/
|
||||||
PyStackRef_CLOSE(owner);
|
PyStackRef_CLOSE(owner);
|
||||||
ERROR_IF(attr_o == NULL, error);
|
ERROR_IF(attr_o == NULL);
|
||||||
self_or_null[0] = PyStackRef_NULL;
|
self_or_null[0] = PyStackRef_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2244,7 +2244,7 @@ dummy_func(
|
||||||
/* Classic, pushes one value. */
|
/* Classic, pushes one value. */
|
||||||
attr_o = PyObject_GetAttr(PyStackRef_AsPyObjectBorrow(owner), name);
|
attr_o = PyObject_GetAttr(PyStackRef_AsPyObjectBorrow(owner), name);
|
||||||
PyStackRef_CLOSE(owner);
|
PyStackRef_CLOSE(owner);
|
||||||
ERROR_IF(attr_o == NULL, error);
|
ERROR_IF(attr_o == NULL);
|
||||||
}
|
}
|
||||||
attr = PyStackRef_FromPyObjectSteal(attr_o);
|
attr = PyStackRef_FromPyObjectSteal(attr_o);
|
||||||
}
|
}
|
||||||
|
@ -2608,11 +2608,11 @@ dummy_func(
|
||||||
assert((oparg >> 5) <= Py_GE);
|
assert((oparg >> 5) <= Py_GE);
|
||||||
PyObject *res_o = PyObject_RichCompare(left_o, right_o, oparg >> 5);
|
PyObject *res_o = PyObject_RichCompare(left_o, right_o, oparg >> 5);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
if (oparg & 16) {
|
if (oparg & 16) {
|
||||||
int res_bool = PyObject_IsTrue(res_o);
|
int res_bool = PyObject_IsTrue(res_o);
|
||||||
Py_DECREF(res_o);
|
Py_DECREF(res_o);
|
||||||
ERROR_IF(res_bool < 0, error);
|
ERROR_IF(res_bool < 0);
|
||||||
res = res_bool ? PyStackRef_True : PyStackRef_False;
|
res = res_bool ? PyStackRef_True : PyStackRef_False;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2706,7 +2706,7 @@ dummy_func(
|
||||||
|
|
||||||
int res = PySequence_Contains(right_o, left_o);
|
int res = PySequence_Contains(right_o, left_o);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res < 0, error);
|
ERROR_IF(res < 0);
|
||||||
b = (res ^ oparg) ? PyStackRef_True : PyStackRef_False;
|
b = (res ^ oparg) ? PyStackRef_True : PyStackRef_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2740,7 +2740,7 @@ dummy_func(
|
||||||
// Note: both set and frozenset use the same seq_contains method!
|
// Note: both set and frozenset use the same seq_contains method!
|
||||||
int res = _PySet_Contains((PySetObject *)right_o, left_o);
|
int res = _PySet_Contains((PySetObject *)right_o, left_o);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res < 0, error);
|
ERROR_IF(res < 0);
|
||||||
b = (res ^ oparg) ? PyStackRef_True : PyStackRef_False;
|
b = (res ^ oparg) ? PyStackRef_True : PyStackRef_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2754,7 +2754,7 @@ dummy_func(
|
||||||
STAT_INC(CONTAINS_OP, hit);
|
STAT_INC(CONTAINS_OP, hit);
|
||||||
int res = PyDict_Contains(right_o, left_o);
|
int res = PyDict_Contains(right_o, left_o);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res < 0, error);
|
ERROR_IF(res < 0);
|
||||||
b = (res ^ oparg) ? PyStackRef_True : PyStackRef_False;
|
b = (res ^ oparg) ? PyStackRef_True : PyStackRef_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2764,7 +2764,7 @@ dummy_func(
|
||||||
int err = _PyEval_CheckExceptStarTypeValid(tstate, match_type);
|
int err = _PyEval_CheckExceptStarTypeValid(tstate, match_type);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *match_o = NULL;
|
PyObject *match_o = NULL;
|
||||||
|
@ -2772,10 +2772,10 @@ dummy_func(
|
||||||
int res = _PyEval_ExceptionGroupMatch(frame, exc_value, match_type,
|
int res = _PyEval_ExceptionGroupMatch(frame, exc_value, match_type,
|
||||||
&match_o, &rest_o);
|
&match_o, &rest_o);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res < 0, error);
|
ERROR_IF(res < 0);
|
||||||
|
|
||||||
assert((match_o == NULL) == (rest_o == NULL));
|
assert((match_o == NULL) == (rest_o == NULL));
|
||||||
ERROR_IF(match_o == NULL, error);
|
ERROR_IF(match_o == NULL);
|
||||||
|
|
||||||
if (!Py_IsNone(match_o)) {
|
if (!Py_IsNone(match_o)) {
|
||||||
PyErr_SetHandledException(match_o);
|
PyErr_SetHandledException(match_o);
|
||||||
|
@ -2805,14 +2805,14 @@ dummy_func(
|
||||||
PyStackRef_AsPyObjectBorrow(fromlist),
|
PyStackRef_AsPyObjectBorrow(fromlist),
|
||||||
PyStackRef_AsPyObjectBorrow(level));
|
PyStackRef_AsPyObjectBorrow(level));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
inst(IMPORT_FROM, (from -- from, res)) {
|
inst(IMPORT_FROM, (from -- from, res)) {
|
||||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
||||||
PyObject *res_o = _PyEval_ImportFrom(tstate, PyStackRef_AsPyObjectBorrow(from), name);
|
PyObject *res_o = _PyEval_ImportFrom(tstate, PyStackRef_AsPyObjectBorrow(from), name);
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2850,7 +2850,7 @@ dummy_func(
|
||||||
int optimized = _PyOptimizer_Optimize(frame, start, &executor, 0);
|
int optimized = _PyOptimizer_Optimize(frame, start, &executor, 0);
|
||||||
if (optimized <= 0) {
|
if (optimized <= 0) {
|
||||||
this_instr[1].counter = restart_backoff_counter(counter);
|
this_instr[1].counter = restart_backoff_counter(counter);
|
||||||
ERROR_IF(optimized < 0, error);
|
ERROR_IF(optimized < 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this_instr[1].counter = initial_jump_backoff_counter();
|
this_instr[1].counter = initial_jump_backoff_counter();
|
||||||
|
@ -2976,9 +2976,9 @@ dummy_func(
|
||||||
inst(GET_LEN, (obj -- obj, len)) {
|
inst(GET_LEN, (obj -- obj, len)) {
|
||||||
// PUSH(len(TOS))
|
// PUSH(len(TOS))
|
||||||
Py_ssize_t len_i = PyObject_Length(PyStackRef_AsPyObjectBorrow(obj));
|
Py_ssize_t len_i = PyObject_Length(PyStackRef_AsPyObjectBorrow(obj));
|
||||||
ERROR_IF(len_i < 0, error);
|
ERROR_IF(len_i < 0);
|
||||||
PyObject *len_o = PyLong_FromSsize_t(len_i);
|
PyObject *len_o = PyLong_FromSsize_t(len_i);
|
||||||
ERROR_IF(len_o == NULL, error);
|
ERROR_IF(len_o == NULL);
|
||||||
len = PyStackRef_FromPyObjectSteal(len_o);
|
len = PyStackRef_FromPyObjectSteal(len_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2996,7 +2996,7 @@ dummy_func(
|
||||||
attrs = PyStackRef_FromPyObjectSteal(attrs_o);
|
attrs = PyStackRef_FromPyObjectSteal(attrs_o);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ERROR_IF(_PyErr_Occurred(tstate), error); // Error!
|
ERROR_IF(_PyErr_Occurred(tstate)); // Error!
|
||||||
attrs = PyStackRef_None; // Failure!
|
attrs = PyStackRef_None; // Failure!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3015,7 +3015,7 @@ dummy_func(
|
||||||
// On successful match, PUSH(values). Otherwise, PUSH(None).
|
// On successful match, PUSH(values). Otherwise, PUSH(None).
|
||||||
PyObject *values_or_none_o = _PyEval_MatchKeys(tstate,
|
PyObject *values_or_none_o = _PyEval_MatchKeys(tstate,
|
||||||
PyStackRef_AsPyObjectBorrow(subject), PyStackRef_AsPyObjectBorrow(keys));
|
PyStackRef_AsPyObjectBorrow(subject), PyStackRef_AsPyObjectBorrow(keys));
|
||||||
ERROR_IF(values_or_none_o == NULL, error);
|
ERROR_IF(values_or_none_o == NULL);
|
||||||
values_or_none = PyStackRef_FromPyObjectSteal(values_or_none_o);
|
values_or_none = PyStackRef_FromPyObjectSteal(values_or_none_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3026,7 +3026,7 @@ dummy_func(
|
||||||
/* before: [obj]; after [getiter(obj)] */
|
/* before: [obj]; after [getiter(obj)] */
|
||||||
PyObject *iter_o = PyObject_GetIter(PyStackRef_AsPyObjectBorrow(iterable));
|
PyObject *iter_o = PyObject_GetIter(PyStackRef_AsPyObjectBorrow(iterable));
|
||||||
PyStackRef_CLOSE(iterable);
|
PyStackRef_CLOSE(iterable);
|
||||||
ERROR_IF(iter_o == NULL, error);
|
ERROR_IF(iter_o == NULL);
|
||||||
iter = PyStackRef_FromPyObjectSteal(iter_o);
|
iter = PyStackRef_FromPyObjectSteal(iter_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3377,7 +3377,7 @@ dummy_func(
|
||||||
r->start = value + r->step;
|
r->start = value + r->step;
|
||||||
r->len--;
|
r->len--;
|
||||||
PyObject *res = PyLong_FromLong(value);
|
PyObject *res = PyLong_FromLong(value);
|
||||||
ERROR_IF(res == NULL, error);
|
ERROR_IF(res == NULL);
|
||||||
next = PyStackRef_FromPyObjectSteal(res);
|
next = PyStackRef_FromPyObjectSteal(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3470,7 +3470,7 @@ dummy_func(
|
||||||
PyObject *res_o = PyObject_Vectorcall(exit_func_o, stack + 2 - has_self,
|
PyObject *res_o = PyObject_Vectorcall(exit_func_o, stack + 2 - has_self,
|
||||||
(3 + has_self) | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
|
(3 + has_self) | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
|
||||||
Py_XDECREF(original_tb);
|
Py_XDECREF(original_tb);
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3704,7 +3704,7 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||||
if (CONVERSION_FAILED(args_o)) {
|
if (CONVERSION_FAILED(args_o)) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyObject *res_o = PyObject_Vectorcall(
|
PyObject *res_o = PyObject_Vectorcall(
|
||||||
callable_o, args_o,
|
callable_o, args_o,
|
||||||
|
@ -3730,7 +3730,7 @@ dummy_func(
|
||||||
}
|
}
|
||||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3752,7 +3752,7 @@ dummy_func(
|
||||||
tstate, PY_MONITORING_EVENT_CALL,
|
tstate, PY_MONITORING_EVENT_CALL,
|
||||||
frame, this_instr, function, arg0
|
frame, this_instr, function, arg0
|
||||||
);
|
);
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro(CALL) = _SPECIALIZE_CALL + unused/2 + _MAYBE_EXPAND_METHOD + _DO_CALL + _CHECK_PERIODIC;
|
macro(CALL) = _SPECIALIZE_CALL + unused/2 + _MAYBE_EXPAND_METHOD + _DO_CALL + _CHECK_PERIODIC;
|
||||||
|
@ -3857,7 +3857,7 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||||
if (CONVERSION_FAILED(args_o)) {
|
if (CONVERSION_FAILED(args_o)) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyObject *res_o = PyObject_Vectorcall(
|
PyObject *res_o = PyObject_Vectorcall(
|
||||||
callable_o, args_o,
|
callable_o, args_o,
|
||||||
|
@ -3866,7 +3866,7 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4009,7 +4009,7 @@ dummy_func(
|
||||||
(void)callable; // Silence compiler warnings about unused variables
|
(void)callable; // Silence compiler warnings about unused variables
|
||||||
(void)null;
|
(void)null;
|
||||||
PyStackRef_CLOSE(arg);
|
PyStackRef_CLOSE(arg);
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4037,7 +4037,7 @@ dummy_func(
|
||||||
(void)callable; // Silence compiler warnings about unused variables
|
(void)callable; // Silence compiler warnings about unused variables
|
||||||
(void)null;
|
(void)null;
|
||||||
PyStackRef_CLOSE(arg);
|
PyStackRef_CLOSE(arg);
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4130,12 +4130,12 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||||
if (CONVERSION_FAILED(args_o)) {
|
if (CONVERSION_FAILED(args_o)) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyObject *res_o = tp->tp_vectorcall((PyObject *)tp, args_o, total_args, NULL);
|
PyObject *res_o = tp->tp_vectorcall((PyObject *)tp, args_o, total_args, NULL);
|
||||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4170,7 +4170,7 @@ dummy_func(
|
||||||
DEAD(args);
|
DEAD(args);
|
||||||
DEAD(self_or_null);
|
DEAD(self_or_null);
|
||||||
PyStackRef_CLOSE(callable);
|
PyStackRef_CLOSE(callable);
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4198,7 +4198,7 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||||
if (CONVERSION_FAILED(args_o)) {
|
if (CONVERSION_FAILED(args_o)) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyObject *res_o = _PyCFunctionFast_CAST(cfunc)(
|
PyObject *res_o = _PyCFunctionFast_CAST(cfunc)(
|
||||||
PyCFunction_GET_SELF(callable_o),
|
PyCFunction_GET_SELF(callable_o),
|
||||||
|
@ -4207,7 +4207,7 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4237,13 +4237,13 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||||
if (CONVERSION_FAILED(args_o)) {
|
if (CONVERSION_FAILED(args_o)) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyObject *res_o = cfunc(PyCFunction_GET_SELF(callable_o), args_o, total_args, NULL);
|
PyObject *res_o = cfunc(PyCFunction_GET_SELF(callable_o), args_o, total_args, NULL);
|
||||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4325,7 +4325,7 @@ dummy_func(
|
||||||
UNLOCK_OBJECT(self_o);
|
UNLOCK_OBJECT(self_o);
|
||||||
PyStackRef_CLOSE(self);
|
PyStackRef_CLOSE(self);
|
||||||
PyStackRef_CLOSE(callable);
|
PyStackRef_CLOSE(callable);
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
#if TIER_ONE
|
#if TIER_ONE
|
||||||
// Skip the following POP_TOP. This is done here in tier one, and
|
// Skip the following POP_TOP. This is done here in tier one, and
|
||||||
// during trace projection in tier two:
|
// during trace projection in tier two:
|
||||||
|
@ -4363,7 +4363,7 @@ dummy_func(
|
||||||
_Py_LeaveRecursiveCallTstate(tstate);
|
_Py_LeaveRecursiveCallTstate(tstate);
|
||||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4397,7 +4397,7 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||||
if (CONVERSION_FAILED(args_o)) {
|
if (CONVERSION_FAILED(args_o)) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyCFunctionFastWithKeywords cfunc =
|
PyCFunctionFastWithKeywords cfunc =
|
||||||
_PyCFunctionFastWithKeywords_CAST(meth->ml_meth);
|
_PyCFunctionFastWithKeywords_CAST(meth->ml_meth);
|
||||||
|
@ -4405,7 +4405,7 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4443,7 +4443,7 @@ dummy_func(
|
||||||
DEAD(args);
|
DEAD(args);
|
||||||
DEAD(self_or_null);
|
DEAD(self_or_null);
|
||||||
PyStackRef_CLOSE(callable);
|
PyStackRef_CLOSE(callable);
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4477,14 +4477,14 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||||
if (CONVERSION_FAILED(args_o)) {
|
if (CONVERSION_FAILED(args_o)) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(meth->ml_meth);
|
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(meth->ml_meth);
|
||||||
PyObject *res_o = cfunc(self, (args_o + 1), nargs);
|
PyObject *res_o = cfunc(self, (args_o + 1), nargs);
|
||||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4517,7 +4517,7 @@ dummy_func(
|
||||||
int err = _Py_call_instrumentation_2args(
|
int err = _Py_call_instrumentation_2args(
|
||||||
tstate, PY_MONITORING_EVENT_CALL,
|
tstate, PY_MONITORING_EVENT_CALL,
|
||||||
frame, this_instr, function, arg);
|
frame, this_instr, function, arg);
|
||||||
ERROR_IF(err, error);
|
ERROR_IF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
op(_MAYBE_EXPAND_METHOD_KW, (callable, self_or_null, unused[oparg], unused -- callable, self_or_null, unused[oparg], unused)) {
|
op(_MAYBE_EXPAND_METHOD_KW, (callable, self_or_null, unused[oparg], unused -- callable, self_or_null, unused[oparg], unused)) {
|
||||||
|
@ -4574,7 +4574,7 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||||
if (CONVERSION_FAILED(args_o)) {
|
if (CONVERSION_FAILED(args_o)) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyObject *res_o = PyObject_Vectorcall(
|
PyObject *res_o = PyObject_Vectorcall(
|
||||||
callable_o, args_o,
|
callable_o, args_o,
|
||||||
|
@ -4599,7 +4599,7 @@ dummy_func(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4629,7 +4629,7 @@ dummy_func(
|
||||||
DEAD(self_or_null);
|
DEAD(self_or_null);
|
||||||
DEAD(callable);
|
DEAD(callable);
|
||||||
SYNC_SP();
|
SYNC_SP();
|
||||||
ERROR_IF(temp == NULL, error);
|
ERROR_IF(temp == NULL);
|
||||||
new_frame = temp;
|
new_frame = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4727,7 +4727,7 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
|
||||||
if (CONVERSION_FAILED(args_o)) {
|
if (CONVERSION_FAILED(args_o)) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
PyObject *kwnames_o = PyStackRef_AsPyObjectBorrow(kwnames);
|
PyObject *kwnames_o = PyStackRef_AsPyObjectBorrow(kwnames);
|
||||||
int positional_args = total_args - (int)PyTuple_GET_SIZE(kwnames_o);
|
int positional_args = total_args - (int)PyTuple_GET_SIZE(kwnames_o);
|
||||||
|
@ -4739,7 +4739,7 @@ dummy_func(
|
||||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4842,7 +4842,7 @@ dummy_func(
|
||||||
PyStackRef_CLOSE(callargs_st);
|
PyStackRef_CLOSE(callargs_st);
|
||||||
DEAD(null);
|
DEAD(null);
|
||||||
PyStackRef_CLOSE(func_st);
|
PyStackRef_CLOSE(func_st);
|
||||||
ERROR_IF(result_o == NULL, error);
|
ERROR_IF(result_o == NULL);
|
||||||
result = PyStackRef_FromPyObjectSteal(result_o);
|
result = PyStackRef_FromPyObjectSteal(result_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4863,7 +4863,7 @@ dummy_func(
|
||||||
PyFunction_New(codeobj, GLOBALS());
|
PyFunction_New(codeobj, GLOBALS());
|
||||||
|
|
||||||
PyStackRef_CLOSE(codeobj_st);
|
PyStackRef_CLOSE(codeobj_st);
|
||||||
ERROR_IF(func_obj == NULL, error);
|
ERROR_IF(func_obj == NULL);
|
||||||
|
|
||||||
_PyFunction_SetVersion(
|
_PyFunction_SetVersion(
|
||||||
func_obj, ((PyCodeObject *)codeobj)->co_version);
|
func_obj, ((PyCodeObject *)codeobj)->co_version);
|
||||||
|
@ -4887,7 +4887,7 @@ dummy_func(
|
||||||
assert(PyStackRef_FunctionCheck(frame->f_funcobj));
|
assert(PyStackRef_FunctionCheck(frame->f_funcobj));
|
||||||
PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj);
|
PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj);
|
||||||
PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func);
|
PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func);
|
||||||
ERROR_IF(gen == NULL, error);
|
ERROR_IF(gen == NULL);
|
||||||
assert(STACK_LEVEL() == 0);
|
assert(STACK_LEVEL() == 0);
|
||||||
SAVE_STACK();
|
SAVE_STACK();
|
||||||
_PyInterpreterFrame *gen_frame = &gen->gi_iframe;
|
_PyInterpreterFrame *gen_frame = &gen->gi_iframe;
|
||||||
|
@ -4912,7 +4912,7 @@ dummy_func(
|
||||||
PyObject *step_o = oparg == 3 ? PyStackRef_AsPyObjectBorrow(args[2]) : NULL;
|
PyObject *step_o = oparg == 3 ? PyStackRef_AsPyObjectBorrow(args[2]) : NULL;
|
||||||
PyObject *slice_o = PySlice_New(start_o, stop_o, step_o);
|
PyObject *slice_o = PySlice_New(start_o, stop_o, step_o);
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(slice_o == NULL, error);
|
ERROR_IF(slice_o == NULL);
|
||||||
slice = PyStackRef_FromPyObjectStealMortal(slice_o);
|
slice = PyStackRef_FromPyObjectStealMortal(slice_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4922,7 +4922,7 @@ dummy_func(
|
||||||
conv_fn = _PyEval_ConversionFuncs[oparg];
|
conv_fn = _PyEval_ConversionFuncs[oparg];
|
||||||
PyObject *result_o = conv_fn(PyStackRef_AsPyObjectBorrow(value));
|
PyObject *result_o = conv_fn(PyStackRef_AsPyObjectBorrow(value));
|
||||||
PyStackRef_CLOSE(value);
|
PyStackRef_CLOSE(value);
|
||||||
ERROR_IF(result_o == NULL, error);
|
ERROR_IF(result_o == NULL);
|
||||||
result = PyStackRef_FromPyObjectSteal(result_o);
|
result = PyStackRef_FromPyObjectSteal(result_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4933,7 +4933,7 @@ dummy_func(
|
||||||
if (!PyUnicode_CheckExact(value_o)) {
|
if (!PyUnicode_CheckExact(value_o)) {
|
||||||
PyObject *res_o = PyObject_Format(value_o, NULL);
|
PyObject *res_o = PyObject_Format(value_o, NULL);
|
||||||
PyStackRef_CLOSE(value);
|
PyStackRef_CLOSE(value);
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -4945,7 +4945,7 @@ dummy_func(
|
||||||
inst(FORMAT_WITH_SPEC, (value, fmt_spec -- res)) {
|
inst(FORMAT_WITH_SPEC, (value, fmt_spec -- res)) {
|
||||||
PyObject *res_o = PyObject_Format(PyStackRef_AsPyObjectBorrow(value), PyStackRef_AsPyObjectBorrow(fmt_spec));
|
PyObject *res_o = PyObject_Format(PyStackRef_AsPyObjectBorrow(value), PyStackRef_AsPyObjectBorrow(fmt_spec));
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(res_o == NULL, error);
|
ERROR_IF(res_o == NULL);
|
||||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5024,7 +5024,7 @@ dummy_func(
|
||||||
inst(INSTRUMENTED_INSTRUCTION, ( -- )) {
|
inst(INSTRUMENTED_INSTRUCTION, ( -- )) {
|
||||||
int next_opcode = _Py_call_instrumentation_instruction(
|
int next_opcode = _Py_call_instrumentation_instruction(
|
||||||
tstate, frame, this_instr);
|
tstate, frame, this_instr);
|
||||||
ERROR_IF(next_opcode < 0, error);
|
ERROR_IF(next_opcode < 0);
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
if (_PyOpcode_Caches[next_opcode]) {
|
if (_PyOpcode_Caches[next_opcode]) {
|
||||||
PAUSE_ADAPTIVE_COUNTER(next_instr[1].counter);
|
PAUSE_ADAPTIVE_COUNTER(next_instr[1].counter);
|
||||||
|
|
|
@ -28,7 +28,6 @@ static PyObject *
|
||||||
print_expr(PyThreadState* Py_UNUSED(ignored), PyObject *value)
|
print_expr(PyThreadState* Py_UNUSED(ignored), PyObject *value)
|
||||||
{
|
{
|
||||||
PyObject *hook = _PySys_GetRequiredAttr(&_Py_ID(displayhook));
|
PyObject *hook = _PySys_GetRequiredAttr(&_Py_ID(displayhook));
|
||||||
// Can't use ERROR_IF here.
|
|
||||||
if (hook == NULL) {
|
if (hook == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -543,7 +543,6 @@ def tier_variable(node: parser.CodeDef) -> int | None:
|
||||||
def has_error_with_pop(op: parser.CodeDef) -> bool:
|
def has_error_with_pop(op: parser.CodeDef) -> bool:
|
||||||
return (
|
return (
|
||||||
variable_used(op, "ERROR_IF")
|
variable_used(op, "ERROR_IF")
|
||||||
or variable_used(op, "pop_1_error")
|
|
||||||
or variable_used(op, "exception_unwind")
|
or variable_used(op, "exception_unwind")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -551,7 +550,6 @@ def has_error_with_pop(op: parser.CodeDef) -> bool:
|
||||||
def has_error_without_pop(op: parser.CodeDef) -> bool:
|
def has_error_without_pop(op: parser.CodeDef) -> bool:
|
||||||
return (
|
return (
|
||||||
variable_used(op, "ERROR_NO_POP")
|
variable_used(op, "ERROR_NO_POP")
|
||||||
or variable_used(op, "pop_1_error")
|
|
||||||
or variable_used(op, "exception_unwind")
|
or variable_used(op, "exception_unwind")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -170,12 +170,12 @@ def deopt_if(
|
||||||
|
|
||||||
exit_if = deopt_if
|
exit_if = deopt_if
|
||||||
|
|
||||||
def goto_error(self, offset: int, label: str, storage: Storage) -> str:
|
def goto_error(self, offset: int, storage: Storage) -> str:
|
||||||
if offset > 0:
|
if offset > 0:
|
||||||
return f"JUMP_TO_LABEL(pop_{offset}_{label});"
|
return f"JUMP_TO_LABEL(pop_{offset}_error);"
|
||||||
if offset < 0:
|
if offset < 0:
|
||||||
storage.copy().flush(self.out)
|
storage.copy().flush(self.out)
|
||||||
return f"JUMP_TO_LABEL({label});"
|
return f"JUMP_TO_LABEL(error);"
|
||||||
|
|
||||||
def error_if(
|
def error_if(
|
||||||
self,
|
self,
|
||||||
|
@ -191,17 +191,13 @@ def error_if(
|
||||||
unconditional = always_true(first_tkn)
|
unconditional = always_true(first_tkn)
|
||||||
if unconditional:
|
if unconditional:
|
||||||
next(tkn_iter)
|
next(tkn_iter)
|
||||||
comma = next(tkn_iter)
|
next(tkn_iter) # RPAREN
|
||||||
if comma.kind != "COMMA":
|
|
||||||
raise analysis_error(f"Expected comma, got '{comma.text}'", comma)
|
|
||||||
self.out.start_line()
|
self.out.start_line()
|
||||||
else:
|
else:
|
||||||
self.out.emit_at("if ", tkn)
|
self.out.emit_at("if ", tkn)
|
||||||
self.emit(lparen)
|
self.emit(lparen)
|
||||||
emit_to(self.out, tkn_iter, "COMMA")
|
emit_to(self.out, tkn_iter, "RPAREN")
|
||||||
self.out.emit(") {\n")
|
self.out.emit(") {\n")
|
||||||
label = next(tkn_iter).text
|
|
||||||
next(tkn_iter) # RPAREN
|
|
||||||
next(tkn_iter) # Semi colon
|
next(tkn_iter) # Semi colon
|
||||||
storage.clear_inputs("at ERROR_IF")
|
storage.clear_inputs("at ERROR_IF")
|
||||||
|
|
||||||
|
@ -210,7 +206,7 @@ def error_if(
|
||||||
offset = int(c_offset)
|
offset = int(c_offset)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
offset = -1
|
offset = -1
|
||||||
self.out.emit(self.goto_error(offset, label, storage))
|
self.out.emit(self.goto_error(offset, storage))
|
||||||
self.out.emit("\n")
|
self.out.emit("\n")
|
||||||
if not unconditional:
|
if not unconditional:
|
||||||
self.out.emit("}\n")
|
self.out.emit("}\n")
|
||||||
|
@ -227,7 +223,7 @@ def error_no_pop(
|
||||||
next(tkn_iter) # LPAREN
|
next(tkn_iter) # LPAREN
|
||||||
next(tkn_iter) # RPAREN
|
next(tkn_iter) # RPAREN
|
||||||
next(tkn_iter) # Semi colon
|
next(tkn_iter) # Semi colon
|
||||||
self.out.emit_at(self.goto_error(0, "error", storage), tkn)
|
self.out.emit_at(self.goto_error(0, storage), tkn)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def decref_inputs(
|
def decref_inputs(
|
||||||
|
|
|
@ -184,7 +184,7 @@ ### Special functions/macros
|
||||||
Those include:
|
Those include:
|
||||||
|
|
||||||
* `DEOPT_IF(cond, instruction)`. Deoptimize if `cond` is met.
|
* `DEOPT_IF(cond, instruction)`. Deoptimize if `cond` is met.
|
||||||
* `ERROR_IF(cond, label)`. Jump to error handler at `label` if `cond` is true.
|
* `ERROR_IF(cond)`. Jump to error handler if `cond` is true.
|
||||||
* `DECREF_INPUTS()`. Generate `Py_DECREF()` calls for the input stack effects.
|
* `DECREF_INPUTS()`. Generate `Py_DECREF()` calls for the input stack effects.
|
||||||
* `SYNC_SP()`. Synchronizes the physical stack pointer with the stack effects.
|
* `SYNC_SP()`. Synchronizes the physical stack pointer with the stack effects.
|
||||||
* `INSTRUCTION_SIZE`. Replaced with the size of the instruction which is equal
|
* `INSTRUCTION_SIZE`. Replaced with the size of the instruction which is equal
|
||||||
|
@ -209,7 +209,7 @@ ### Special functions/macros
|
||||||
2. Before the first `ERROR_IF`, all input values must be `DECREF`ed,
|
2. Before the first `ERROR_IF`, all input values must be `DECREF`ed,
|
||||||
and no objects may be allocated or `INCREF`ed, with the exception
|
and no objects may be allocated or `INCREF`ed, with the exception
|
||||||
of attempting to create an object and checking for success using
|
of attempting to create an object and checking for success using
|
||||||
`ERROR_IF(result == NULL, label)`. (TODO: Unclear what to do with
|
`ERROR_IF(result == NULL)`. (TODO: Unclear what to do with
|
||||||
intermediate results.)
|
intermediate results.)
|
||||||
3. No `DEOPT_IF` may follow an `ERROR_IF` in the same block.
|
3. No `DEOPT_IF` may follow an `ERROR_IF` in the same block.
|
||||||
|
|
||||||
|
@ -221,14 +221,14 @@ ### Special functions/macros
|
||||||
|
|
||||||
- Use `goto error`.
|
- Use `goto error`.
|
||||||
- Use a block containing the appropriate `DECREF` calls ending in
|
- Use a block containing the appropriate `DECREF` calls ending in
|
||||||
`ERROR_IF(true, error)`.
|
`ERROR_IF(true)`.
|
||||||
|
|
||||||
An example of the latter would be:
|
An example of the latter would be:
|
||||||
```cc
|
```cc
|
||||||
res = PyObject_Add(left, right);
|
res = PyObject_Add(left, right);
|
||||||
if (res == NULL) {
|
if (res == NULL) {
|
||||||
DECREF_INPUTS();
|
DECREF_INPUTS();
|
||||||
ERROR_IF(true, error);
|
ERROR_IF(true);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ ### More examples
|
||||||
```C
|
```C
|
||||||
inst ( BUILD_TUPLE, (items[oparg] -- tuple) ) {
|
inst ( BUILD_TUPLE, (items[oparg] -- tuple) ) {
|
||||||
tuple = _PyTuple_FromArraySteal(items, oparg);
|
tuple = _PyTuple_FromArraySteal(items, oparg);
|
||||||
ERROR_IF(tuple == NULL, error);
|
ERROR_IF(tuple == NULL);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
```C
|
```C
|
||||||
|
|
|
@ -64,7 +64,7 @@ def __init__(self, out: CWriter, labels: dict[str, Label]):
|
||||||
super().__init__(out, labels)
|
super().__init__(out, labels)
|
||||||
self._replacers["oparg"] = self.oparg
|
self._replacers["oparg"] = self.oparg
|
||||||
|
|
||||||
def goto_error(self, offset: int, label: str, storage: Storage) -> str:
|
def goto_error(self, offset: int, storage: Storage) -> str:
|
||||||
# To do: Add jump targets for popping values.
|
# To do: Add jump targets for popping values.
|
||||||
if offset != 0:
|
if offset != 0:
|
||||||
storage.copy().flush(self.out)
|
storage.copy().flush(self.out)
|
||||||
|
|
Loading…
Reference in New Issue