gh-125039: Make `this_instr`/`prev_instr` const in cases generator (GH-125071)

This commit is contained in:
Tomas R. 2024-10-09 14:54:39 +02:00 committed by GitHub
parent 3024b16d51
commit 6b533a659b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 79 additions and 78 deletions

View File

@ -450,7 +450,7 @@ def test_cache_effect(self):
"""
output = """
TARGET(OP) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 4;
INSTRUCTION_STATS(OP);
@ -503,7 +503,7 @@ def test_macro_instruction(self):
next_instr += 6;
INSTRUCTION_STATS(OP);
PREDICTED(OP);
_Py_CODEUNIT *this_instr = next_instr - 6;
_Py_CODEUNIT* const this_instr = next_instr - 6;
(void)this_instr;
_PyStackRef left;
_PyStackRef right;
@ -536,7 +536,7 @@ def test_macro_instruction(self):
}
TARGET(OP1) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(OP1);

View File

@ -0,0 +1 @@
Make ``this_instr`` and ``prev_instr`` const in cases generator.

View File

@ -14,7 +14,7 @@
next_instr += 2;
INSTRUCTION_STATS(BINARY_OP);
PREDICTED(BINARY_OP);
_Py_CODEUNIT *this_instr = next_instr - 2;
_Py_CODEUNIT* const this_instr = next_instr - 2;
(void)this_instr;
_PyStackRef lhs;
_PyStackRef rhs;
@ -422,7 +422,7 @@
next_instr += 2;
INSTRUCTION_STATS(BINARY_SUBSCR);
PREDICTED(BINARY_SUBSCR);
_Py_CODEUNIT *this_instr = next_instr - 2;
_Py_CODEUNIT* const this_instr = next_instr - 2;
(void)this_instr;
_PyStackRef container;
_PyStackRef sub;
@ -858,7 +858,7 @@
next_instr += 4;
INSTRUCTION_STATS(CALL);
PREDICTED(CALL);
_Py_CODEUNIT *this_instr = next_instr - 4;
_Py_CODEUNIT* const this_instr = next_instr - 4;
(void)this_instr;
_PyStackRef *callable;
_PyStackRef *self_or_null;
@ -1012,7 +1012,7 @@
}
TARGET(CALL_ALLOC_AND_ENTER_INIT) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 4;
INSTRUCTION_STATS(CALL_ALLOC_AND_ENTER_INIT);
static_assert(INLINE_CACHE_ENTRIES_CALL == 3, "incorrect cache size");
@ -1107,7 +1107,7 @@
}
TARGET(CALL_BOUND_METHOD_EXACT_ARGS) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 4;
INSTRUCTION_STATS(CALL_BOUND_METHOD_EXACT_ARGS);
static_assert(INLINE_CACHE_ENTRIES_CALL == 3, "incorrect cache size");
@ -1210,7 +1210,7 @@
}
TARGET(CALL_BOUND_METHOD_GENERAL) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 4;
INSTRUCTION_STATS(CALL_BOUND_METHOD_GENERAL);
static_assert(INLINE_CACHE_ENTRIES_CALL == 3, "incorrect cache size");
@ -1625,7 +1625,7 @@
next_instr += 1;
INSTRUCTION_STATS(CALL_FUNCTION_EX);
PREDICTED(CALL_FUNCTION_EX);
_Py_CODEUNIT *this_instr = next_instr - 1;
_Py_CODEUNIT* const this_instr = next_instr - 1;
(void)this_instr;
_PyStackRef func;
_PyStackRef callargs;
@ -1871,7 +1871,7 @@
next_instr += 4;
INSTRUCTION_STATS(CALL_KW);
PREDICTED(CALL_KW);
_Py_CODEUNIT *this_instr = next_instr - 4;
_Py_CODEUNIT* const this_instr = next_instr - 4;
(void)this_instr;
_PyStackRef *callable;
_PyStackRef *self_or_null;
@ -2024,7 +2024,7 @@
}
TARGET(CALL_KW_BOUND_METHOD) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 4;
INSTRUCTION_STATS(CALL_KW_BOUND_METHOD);
static_assert(INLINE_CACHE_ENTRIES_CALL_KW == 3, "incorrect cache size");
@ -2223,7 +2223,7 @@
}
TARGET(CALL_KW_PY) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 4;
INSTRUCTION_STATS(CALL_KW_PY);
static_assert(INLINE_CACHE_ENTRIES_CALL_KW == 3, "incorrect cache size");
@ -2795,7 +2795,7 @@
}
TARGET(CALL_PY_EXACT_ARGS) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 4;
INSTRUCTION_STATS(CALL_PY_EXACT_ARGS);
static_assert(INLINE_CACHE_ENTRIES_CALL == 3, "incorrect cache size");
@ -2876,7 +2876,7 @@
}
TARGET(CALL_PY_GENERAL) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 4;
INSTRUCTION_STATS(CALL_PY_GENERAL);
static_assert(INLINE_CACHE_ENTRIES_CALL == 3, "incorrect cache size");
@ -3157,7 +3157,7 @@
}
TARGET(CLEANUP_THROW) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(CLEANUP_THROW);
@ -3201,7 +3201,7 @@
next_instr += 2;
INSTRUCTION_STATS(COMPARE_OP);
PREDICTED(COMPARE_OP);
_Py_CODEUNIT *this_instr = next_instr - 2;
_Py_CODEUNIT* const this_instr = next_instr - 2;
(void)this_instr;
_PyStackRef left;
_PyStackRef right;
@ -3381,7 +3381,7 @@
next_instr += 2;
INSTRUCTION_STATS(CONTAINS_OP);
PREDICTED(CONTAINS_OP);
_Py_CODEUNIT *this_instr = next_instr - 2;
_Py_CODEUNIT* const this_instr = next_instr - 2;
(void)this_instr;
_PyStackRef left;
_PyStackRef right;
@ -3720,7 +3720,7 @@
}
TARGET(END_ASYNC_FOR) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(END_ASYNC_FOR);
@ -3781,7 +3781,7 @@
}
TARGET(ENTER_EXECUTOR) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(ENTER_EXECUTOR);
@ -3896,7 +3896,7 @@
next_instr += 2;
INSTRUCTION_STATS(FOR_ITER);
PREDICTED(FOR_ITER);
_Py_CODEUNIT *this_instr = next_instr - 2;
_Py_CODEUNIT* const this_instr = next_instr - 2;
(void)this_instr;
_PyStackRef iter;
_PyStackRef next;
@ -4357,7 +4357,7 @@
}
TARGET(INSTRUMENTED_CALL) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 4;
INSTRUCTION_STATS(INSTRUMENTED_CALL);
@ -4530,7 +4530,7 @@
}
TARGET(INSTRUMENTED_CALL_KW) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 4;
INSTRUCTION_STATS(INSTRUMENTED_CALL_KW);
@ -4554,7 +4554,7 @@
}
TARGET(INSTRUMENTED_END_FOR) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(INSTRUMENTED_END_FOR);
@ -4579,7 +4579,7 @@
}
TARGET(INSTRUMENTED_END_SEND) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(INSTRUMENTED_END_SEND);
@ -4606,7 +4606,7 @@
}
TARGET(INSTRUMENTED_FOR_ITER) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(INSTRUMENTED_FOR_ITER);
@ -4647,7 +4647,7 @@
}
TARGET(INSTRUMENTED_INSTRUCTION) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(INSTRUMENTED_INSTRUCTION);
@ -4666,7 +4666,7 @@
}
TARGET(INSTRUMENTED_JUMP_BACKWARD) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(INSTRUMENTED_JUMP_BACKWARD);
@ -4690,7 +4690,7 @@
}
TARGET(INSTRUMENTED_JUMP_FORWARD) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(INSTRUMENTED_JUMP_FORWARD);
@ -4699,8 +4699,8 @@
}
TARGET(INSTRUMENTED_LINE) {
_Py_CODEUNIT *prev_instr = frame->instr_ptr;
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const prev_instr = frame->instr_ptr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(INSTRUMENTED_LINE);
@ -4734,7 +4734,7 @@
}
TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(INSTRUMENTED_LOAD_SUPER_ATTR);
@ -4748,7 +4748,7 @@
}
TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_FALSE);
@ -4765,7 +4765,7 @@
}
TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_NONE);
@ -4788,7 +4788,7 @@
}
TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_NOT_NONE);
@ -4811,7 +4811,7 @@
}
TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_TRUE);
@ -4828,7 +4828,7 @@
}
TARGET(INSTRUMENTED_RESUME) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(INSTRUMENTED_RESUME);
@ -4878,7 +4878,7 @@
}
TARGET(INSTRUMENTED_RETURN_CONST) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(INSTRUMENTED_RETURN_CONST);
@ -4931,7 +4931,7 @@
}
TARGET(INSTRUMENTED_RETURN_VALUE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(INSTRUMENTED_RETURN_VALUE);
@ -4976,7 +4976,7 @@
}
TARGET(INSTRUMENTED_YIELD_VALUE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(INSTRUMENTED_YIELD_VALUE);
@ -5087,7 +5087,7 @@
}
TARGET(JUMP_BACKWARD) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(JUMP_BACKWARD);
@ -5220,7 +5220,7 @@
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR);
PREDICTED(LOAD_ATTR);
_Py_CODEUNIT *this_instr = next_instr - 10;
_Py_CODEUNIT* const this_instr = next_instr - 10;
(void)this_instr;
_PyStackRef owner;
_PyStackRef attr;
@ -5294,7 +5294,7 @@
}
TARGET(LOAD_ATTR_CLASS) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_CLASS);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5329,7 +5329,7 @@
}
TARGET(LOAD_ATTR_CLASS_WITH_METACLASS_CHECK) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_CLASS_WITH_METACLASS_CHECK);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5370,7 +5370,7 @@
}
TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5406,7 +5406,7 @@
}
TARGET(LOAD_ATTR_INSTANCE_VALUE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_INSTANCE_VALUE);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5451,7 +5451,7 @@
}
TARGET(LOAD_ATTR_METHOD_LAZY_DICT) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_METHOD_LAZY_DICT);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5494,7 +5494,7 @@
}
TARGET(LOAD_ATTR_METHOD_NO_DICT) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_METHOD_NO_DICT);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5530,7 +5530,7 @@
}
TARGET(LOAD_ATTR_METHOD_WITH_VALUES) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_METHOD_WITH_VALUES);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5578,7 +5578,7 @@
}
TARGET(LOAD_ATTR_MODULE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_MODULE);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5621,7 +5621,7 @@
}
TARGET(LOAD_ATTR_NONDESCRIPTOR_NO_DICT) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_NONDESCRIPTOR_NO_DICT);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5652,7 +5652,7 @@
}
TARGET(LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5694,7 +5694,7 @@
}
TARGET(LOAD_ATTR_PROPERTY) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_PROPERTY);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5759,7 +5759,7 @@
}
TARGET(LOAD_ATTR_SLOT) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_SLOT);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -5796,7 +5796,7 @@
}
TARGET(LOAD_ATTR_WITH_HINT) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 10;
INSTRUCTION_STATS(LOAD_ATTR_WITH_HINT);
static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size");
@ -6101,7 +6101,7 @@
next_instr += 5;
INSTRUCTION_STATS(LOAD_GLOBAL);
PREDICTED(LOAD_GLOBAL);
_Py_CODEUNIT *this_instr = next_instr - 5;
_Py_CODEUNIT* const this_instr = next_instr - 5;
(void)this_instr;
_PyStackRef *res;
_PyStackRef null = PyStackRef_NULL;
@ -6142,7 +6142,7 @@
}
TARGET(LOAD_GLOBAL_BUILTIN) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 5;
INSTRUCTION_STATS(LOAD_GLOBAL_BUILTIN);
static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size");
@ -6185,7 +6185,7 @@
}
TARGET(LOAD_GLOBAL_MODULE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 5;
INSTRUCTION_STATS(LOAD_GLOBAL_MODULE);
static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size");
@ -6299,7 +6299,7 @@
next_instr += 2;
INSTRUCTION_STATS(LOAD_SUPER_ATTR);
PREDICTED(LOAD_SUPER_ATTR);
_Py_CODEUNIT *this_instr = next_instr - 2;
_Py_CODEUNIT* const this_instr = next_instr - 2;
(void)this_instr;
_PyStackRef global_super_st;
_PyStackRef class_st;
@ -6654,7 +6654,7 @@
}
TARGET(POP_JUMP_IF_FALSE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(POP_JUMP_IF_FALSE);
@ -6673,7 +6673,7 @@
}
TARGET(POP_JUMP_IF_NONE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(POP_JUMP_IF_NONE);
@ -6708,7 +6708,7 @@
}
TARGET(POP_JUMP_IF_NOT_NONE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(POP_JUMP_IF_NOT_NONE);
@ -6743,7 +6743,7 @@
}
TARGET(POP_JUMP_IF_TRUE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(POP_JUMP_IF_TRUE);
@ -6811,7 +6811,7 @@
}
TARGET(RAISE_VARARGS) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(RAISE_VARARGS);
@ -6836,7 +6836,7 @@
}
TARGET(RERAISE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
(void)this_instr;
next_instr += 1;
INSTRUCTION_STATS(RERAISE);
@ -6886,7 +6886,7 @@
next_instr += 1;
INSTRUCTION_STATS(RESUME);
PREDICTED(RESUME);
_Py_CODEUNIT *this_instr = next_instr - 1;
_Py_CODEUNIT* const this_instr = next_instr - 1;
(void)this_instr;
// _MAYBE_INSTRUMENT
{
@ -7049,7 +7049,7 @@
next_instr += 2;
INSTRUCTION_STATS(SEND);
PREDICTED(SEND);
_Py_CODEUNIT *this_instr = next_instr - 2;
_Py_CODEUNIT* const this_instr = next_instr - 2;
(void)this_instr;
_PyStackRef receiver;
_PyStackRef v;
@ -7288,7 +7288,7 @@
next_instr += 5;
INSTRUCTION_STATS(STORE_ATTR);
PREDICTED(STORE_ATTR);
_Py_CODEUNIT *this_instr = next_instr - 5;
_Py_CODEUNIT* const this_instr = next_instr - 5;
(void)this_instr;
_PyStackRef owner;
_PyStackRef v;
@ -7329,7 +7329,7 @@
}
TARGET(STORE_ATTR_INSTANCE_VALUE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 5;
INSTRUCTION_STATS(STORE_ATTR_INSTANCE_VALUE);
static_assert(INLINE_CACHE_ENTRIES_STORE_ATTR == 4, "incorrect cache size");
@ -7378,7 +7378,7 @@
}
TARGET(STORE_ATTR_SLOT) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 5;
INSTRUCTION_STATS(STORE_ATTR_SLOT);
static_assert(INLINE_CACHE_ENTRIES_STORE_ATTR == 4, "incorrect cache size");
@ -7411,7 +7411,7 @@
}
TARGET(STORE_ATTR_WITH_HINT) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 5;
INSTRUCTION_STATS(STORE_ATTR_WITH_HINT);
static_assert(INLINE_CACHE_ENTRIES_STORE_ATTR == 4, "incorrect cache size");
@ -7625,7 +7625,7 @@
next_instr += 2;
INSTRUCTION_STATS(STORE_SUBSCR);
PREDICTED(STORE_SUBSCR);
_Py_CODEUNIT *this_instr = next_instr - 2;
_Py_CODEUNIT* const this_instr = next_instr - 2;
(void)this_instr;
_PyStackRef container;
_PyStackRef sub;
@ -7748,7 +7748,7 @@
next_instr += 4;
INSTRUCTION_STATS(TO_BOOL);
PREDICTED(TO_BOOL);
_Py_CODEUNIT *this_instr = next_instr - 4;
_Py_CODEUNIT* const this_instr = next_instr - 4;
(void)this_instr;
_PyStackRef value;
_PyStackRef res;
@ -7784,7 +7784,7 @@
}
TARGET(TO_BOOL_ALWAYS_TRUE) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;
next_instr += 4;
INSTRUCTION_STATS(TO_BOOL_ALWAYS_TRUE);
static_assert(INLINE_CACHE_ENTRIES_TO_BOOL == 3, "incorrect cache size");
@ -7984,7 +7984,7 @@
next_instr += 2;
INSTRUCTION_STATS(UNPACK_SEQUENCE);
PREDICTED(UNPACK_SEQUENCE);
_Py_CODEUNIT *this_instr = next_instr - 2;
_Py_CODEUNIT* const this_instr = next_instr - 2;
(void)this_instr;
_PyStackRef seq;
_PyStackRef *output;

View File

@ -150,9 +150,9 @@ def generate_tier1(
out.emit(f"TARGET({name}) {{\n")
unused_guard = "(void)this_instr;\n" if inst.family is None else ""
if inst.properties.needs_prev:
out.emit(f"_Py_CODEUNIT *prev_instr = frame->instr_ptr;\n")
out.emit(f"_Py_CODEUNIT* const prev_instr = frame->instr_ptr;\n")
if needs_this and not inst.is_target:
out.emit(f"_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;\n")
out.emit(f"_Py_CODEUNIT* const this_instr = frame->instr_ptr = next_instr;\n")
out.emit(unused_guard)
else:
out.emit(f"frame->instr_ptr = next_instr;\n")
@ -161,7 +161,7 @@ def generate_tier1(
if inst.is_target:
out.emit(f"PREDICTED({name});\n")
if needs_this:
out.emit(f"_Py_CODEUNIT *this_instr = next_instr - {inst.size};\n")
out.emit(f"_Py_CODEUNIT* const this_instr = next_instr - {inst.size};\n")
out.emit(unused_guard)
if inst.family is not None:
out.emit(