gh-116760: Fix pystats for trace attempts (GH-116761)

There are now at least two bytecodes that may attempt to optimize,
JUMP_BACK, and more recently, COLD_EXIT.

Only the JUMP_BACK was counting the attempt in the stats.
This moves that counter to uop_optimize itself so it should
always happen no matter where it is called from.
This commit is contained in:
Michael Droettboom 2024-03-13 18:13:33 -04:00 committed by GitHub
parent 8c6db45ce3
commit cef0ec1a3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 2 deletions

View file

@ -1003,6 +1003,7 @@ uop_optimize(
_PyBloomFilter dependencies;
_Py_BloomFilter_Init(&dependencies);
_PyUOpInstruction buffer[UOP_MAX_TRACE_LENGTH];
OPT_STAT_INC(attempts);
int err = translate_bytecode_to_trace(frame, instr, buffer, UOP_MAX_TRACE_LENGTH, &dependencies);
if (err <= 0) {
// Error or nothing translated