Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Generate MIN_SPECIALIZED_OPCODE and use it in asserts
  • Loading branch information
markshannon committed Aug 13, 2024
commit 3ef3cffd249e9312e8f74981f5ea6b1499ce2cb9
1 change: 1 addition & 0 deletions Include/opcode_ids.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1631,7 +1631,7 @@ deopt_code(PyCodeObject *code, _Py_CODEUNIT *instructions)
Py_ssize_t len = Py_SIZE(code);
for (int i = 0; i < len; i++) {
_Py_CODEUNIT inst = _Py_GetBaseCodeUnit(code, i);
assert(inst.op.code <= RESUME);
assert(inst.op.code < MIN_SPECIALIZED_OPCODE);
int caches = _PyOpcode_Caches[inst.op.code];
instructions[i] = inst;
for (int j = 1; j <= caches; j++) {
Expand Down
2 changes: 1 addition & 1 deletion Python/instrumentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ _Py_GetBaseCodeUnit(PyCodeObject *code, int i)
else {
inst.op.code = _PyOpcode_Deopt[opcode];
}
assert(inst.op.code <= RESUME);
assert(inst.op.code < MIN_SPECIALIZED_OPCODE);
return inst;
}

Expand Down
1 change: 1 addition & 0 deletions Tools/cases_generator/opcode_id_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def write_define(name: str, op: int) -> None:

out.emit("\n")
write_define("HAVE_ARGUMENT", analysis.have_arg)
write_define("MIN_SPECIALIZED_OPCODE", analysis.opmap["RESUME"]+1)
write_define("MIN_INSTRUMENTED_OPCODE", analysis.min_instrumented)


Expand Down