@@ -1290,13 +1290,17 @@ eval_frame_handle_pending(PyThreadState *tstate)
1290
1290
#define USE_COMPUTED_GOTOS 0
1291
1291
#endif
1292
1292
1293
- #define INSTRUCTION_START () frame->f_lasti = INSTR_OFFSET(); next_instr++
1293
+ #ifdef Py_STATS
1294
+ #define INSTRUCTION_START (op ) frame->f_lasti = INSTR_OFFSET(); next_instr++; OPCODE_EXE_INC(op);
1295
+ #else
1296
+ #define INSTRUCTION_START (op ) frame->f_lasti = INSTR_OFFSET(); next_instr++
1297
+ #endif
1294
1298
1295
1299
#if USE_COMPUTED_GOTOS
1296
- #define TARGET (op ) TARGET_##op: INSTRUCTION_START();
1300
+ #define TARGET (op ) TARGET_##op: INSTRUCTION_START(op );
1297
1301
#define DISPATCH_GOTO () goto *opcode_targets[opcode]
1298
1302
#else
1299
- #define TARGET (op ) case op: INSTRUCTION_START();
1303
+ #define TARGET (op ) case op: INSTRUCTION_START(op );
1300
1304
#define DISPATCH_GOTO () goto dispatch_opcode
1301
1305
#endif
1302
1306
@@ -1416,7 +1420,7 @@ eval_frame_handle_pending(PyThreadState *tstate)
1416
1420
opcode = _Py_OPCODE(word) | cframe.use_tracing OR_DTRACE_LINE; \
1417
1421
if (opcode == op) { \
1418
1422
oparg = _Py_OPARG(word); \
1419
- INSTRUCTION_START(); \
1423
+ INSTRUCTION_START(op ); \
1420
1424
goto PREDICT_ID(op); \
1421
1425
} \
1422
1426
} while(0)
@@ -2186,7 +2190,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
2186
2190
2187
2191
TARGET (BINARY_SUBSCR ) {
2188
2192
PREDICTED (BINARY_SUBSCR );
2189
- STAT_INC (BINARY_SUBSCR , unquickened );
2190
2193
PyObject * sub = POP ();
2191
2194
PyObject * container = TOP ();
2192
2195
PyObject * res = PyObject_GetItem (container , sub );
@@ -2214,7 +2217,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
2214
2217
cache -> adaptive .counter -- ;
2215
2218
assert (cache -> adaptive .original_oparg == 0 );
2216
2219
/* No need to set oparg here; it isn't used by BINARY_SUBSCR */
2217
- STAT_DEC (BINARY_SUBSCR , unquickened );
2218
2220
JUMP_TO_INSTRUCTION (BINARY_SUBSCR );
2219
2221
}
2220
2222
}
@@ -2339,7 +2341,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
2339
2341
2340
2342
TARGET (STORE_SUBSCR ) {
2341
2343
PREDICTED (STORE_SUBSCR );
2342
- STAT_INC (STORE_SUBSCR , unquickened );
2343
2344
PyObject * sub = TOP ();
2344
2345
PyObject * container = SECOND ();
2345
2346
PyObject * v = THIRD ();
@@ -2369,7 +2370,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
2369
2370
STAT_INC (STORE_SUBSCR , deferred );
2370
2371
// oparg is the adaptive cache counter
2371
2372
UPDATE_PREV_INSTR_OPARG (next_instr , oparg - 1 );
2372
- STAT_DEC (STORE_SUBSCR , unquickened );
2373
2373
JUMP_TO_INSTRUCTION (STORE_SUBSCR );
2374
2374
}
2375
2375
}
@@ -2933,7 +2933,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
2933
2933
2934
2934
TARGET (STORE_ATTR ) {
2935
2935
PREDICTED (STORE_ATTR );
2936
- STAT_INC (STORE_ATTR , unquickened );
2937
2936
PyObject * name = GETITEM (names , oparg );
2938
2937
PyObject * owner = TOP ();
2939
2938
PyObject * v = SECOND ();
@@ -3049,7 +3048,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
3049
3048
3050
3049
TARGET (LOAD_GLOBAL ) {
3051
3050
PREDICTED (LOAD_GLOBAL );
3052
- STAT_INC (LOAD_GLOBAL , unquickened );
3053
3051
PyObject * name = GETITEM (names , oparg );
3054
3052
PyObject * v ;
3055
3053
if (PyDict_CheckExact (GLOBALS ())
@@ -3112,7 +3110,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
3112
3110
STAT_INC (LOAD_GLOBAL , deferred );
3113
3111
cache -> adaptive .counter -- ;
3114
3112
oparg = cache -> adaptive .original_oparg ;
3115
- STAT_DEC (LOAD_GLOBAL , unquickened );
3116
3113
JUMP_TO_INSTRUCTION (LOAD_GLOBAL );
3117
3114
}
3118
3115
}
@@ -3532,7 +3529,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
3532
3529
3533
3530
TARGET (LOAD_ATTR ) {
3534
3531
PREDICTED (LOAD_ATTR );
3535
- STAT_INC (LOAD_ATTR , unquickened );
3536
3532
PyObject * name = GETITEM (names , oparg );
3537
3533
PyObject * owner = TOP ();
3538
3534
PyObject * res = PyObject_GetAttr (owner , name );
@@ -3560,7 +3556,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
3560
3556
STAT_INC (LOAD_ATTR , deferred );
3561
3557
cache -> adaptive .counter -- ;
3562
3558
oparg = cache -> adaptive .original_oparg ;
3563
- STAT_DEC (LOAD_ATTR , unquickened );
3564
3559
JUMP_TO_INSTRUCTION (LOAD_ATTR );
3565
3560
}
3566
3561
}
@@ -3663,7 +3658,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
3663
3658
STAT_INC (STORE_ATTR , deferred );
3664
3659
cache -> adaptive .counter -- ;
3665
3660
oparg = cache -> adaptive .original_oparg ;
3666
- STAT_DEC (STORE_ATTR , unquickened );
3667
3661
JUMP_TO_INSTRUCTION (STORE_ATTR );
3668
3662
}
3669
3663
}
@@ -3754,7 +3748,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
3754
3748
3755
3749
TARGET (COMPARE_OP ) {
3756
3750
PREDICTED (COMPARE_OP );
3757
- STAT_INC (COMPARE_OP , unquickened );
3758
3751
assert (oparg <= Py_GE );
3759
3752
PyObject * right = POP ();
3760
3753
PyObject * left = TOP ();
@@ -3783,7 +3776,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
3783
3776
STAT_INC (COMPARE_OP , deferred );
3784
3777
cache -> adaptive .counter -- ;
3785
3778
oparg = cache -> adaptive .original_oparg ;
3786
- STAT_DEC (COMPARE_OP , unquickened );
3787
3779
JUMP_TO_INSTRUCTION (COMPARE_OP );
3788
3780
}
3789
3781
}
@@ -4438,7 +4430,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4438
4430
4439
4431
TARGET (LOAD_METHOD ) {
4440
4432
PREDICTED (LOAD_METHOD );
4441
- STAT_INC (LOAD_METHOD , unquickened );
4442
4433
/* Designed to work in tandem with CALL_METHOD. */
4443
4434
PyObject * name = GETITEM (names , oparg );
4444
4435
PyObject * obj = TOP ();
@@ -4491,7 +4482,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4491
4482
STAT_INC (LOAD_METHOD , deferred );
4492
4483
cache -> adaptive .counter -- ;
4493
4484
oparg = cache -> adaptive .original_oparg ;
4494
- STAT_DEC (LOAD_METHOD , unquickened );
4495
4485
JUMP_TO_INSTRUCTION (LOAD_METHOD );
4496
4486
}
4497
4487
}
@@ -4617,7 +4607,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4617
4607
TARGET (CALL_NO_KW ) {
4618
4608
PyObject * function ;
4619
4609
PREDICTED (CALL_NO_KW );
4620
- STAT_INC (CALL_NO_KW , unquickened );
4621
4610
kwnames = NULL ;
4622
4611
oparg += extra_args ;
4623
4612
nargs = oparg ;
@@ -5186,7 +5175,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
5186
5175
5187
5176
TARGET (BINARY_OP ) {
5188
5177
PREDICTED (BINARY_OP );
5189
- STAT_INC (BINARY_OP , unquickened );
5190
5178
PyObject * rhs = POP ();
5191
5179
PyObject * lhs = TOP ();
5192
5180
assert (0 <= oparg );
@@ -5216,7 +5204,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
5216
5204
STAT_INC (BINARY_OP , deferred );
5217
5205
cache -> adaptive .counter -- ;
5218
5206
oparg = cache -> adaptive .original_oparg ;
5219
- STAT_DEC (BINARY_OP , unquickened );
5220
5207
JUMP_TO_INSTRUCTION (BINARY_OP );
5221
5208
}
5222
5209
}
@@ -5301,7 +5288,6 @@ opname ## _miss: \
5301
5288
cache_backoff(cache); \
5302
5289
} \
5303
5290
oparg = cache->original_oparg; \
5304
- STAT_DEC(opname, unquickened); \
5305
5291
JUMP_TO_INSTRUCTION(opname); \
5306
5292
}
5307
5293
@@ -5317,7 +5303,6 @@ opname ## _miss: \
5317
5303
next_instr [-1 ] = _Py_MAKECODEUNIT (opname ## _ADAPTIVE , oparg ); \
5318
5304
STAT_INC (opname , deopt ); \
5319
5305
} \
5320
- STAT_DEC (opname , unquickened ); \
5321
5306
JUMP_TO_INSTRUCTION (opname ); \
5322
5307
}
5323
5308
0 commit comments