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

@ -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(