diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2022-11-02 10:42:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-02 10:42:57 -0700 |
commit | 276d77724f2373cc03838448a3e62977aa28bf0d (patch) | |
tree | aeb2f83a896f02a3f38ace9d6ecb65b9620be8e3 /Python/specialize.c | |
parent | 18fc232e07c14536d99f07821e338ebddfd8cb63 (diff) | |
download | cpython-git-276d77724f2373cc03838448a3e62977aa28bf0d.tar.gz |
GH-98686: Quicken everything (GH-98687)
Diffstat (limited to 'Python/specialize.c')
-rw-r--r-- | Python/specialize.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/Python/specialize.c b/Python/specialize.c index 6e2fa4e25f..70a456cf0b 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -31,7 +31,6 @@ uint8_t _PyOpcode_Adaptive[256] = { [FOR_ITER] = FOR_ITER_ADAPTIVE, }; -Py_ssize_t _Py_QuickenedCount = 0; #ifdef Py_STATS PyStats _py_stats_struct = { 0 }; PyStats *_py_stats = &_py_stats_struct; @@ -280,16 +279,14 @@ do { \ void _PyCode_Quicken(PyCodeObject *code) { - _Py_QuickenedCount++; int previous_opcode = -1; _Py_CODEUNIT *instructions = _PyCode_CODE(code); for (int i = 0; i < Py_SIZE(code); i++) { - int opcode = _Py_OPCODE(instructions[i]); + int opcode = _PyOpcode_Deopt[_Py_OPCODE(instructions[i])]; uint8_t adaptive_opcode = _PyOpcode_Adaptive[opcode]; if (adaptive_opcode) { _Py_SET_OPCODE(instructions[i], adaptive_opcode); - // Make sure the adaptive counter is zero: - assert(instructions[i + 1] == 0); + instructions[i + 1] = adaptive_counter_start(); previous_opcode = -1; i += _PyOpcode_Caches[opcode]; } @@ -299,12 +296,6 @@ _PyCode_Quicken(PyCodeObject *code) case EXTENDED_ARG: _Py_SET_OPCODE(instructions[i], EXTENDED_ARG_QUICK); break; - case JUMP_BACKWARD: - _Py_SET_OPCODE(instructions[i], JUMP_BACKWARD_QUICK); - break; - case RESUME: - _Py_SET_OPCODE(instructions[i], RESUME_QUICK); - break; case LOAD_FAST: switch(previous_opcode) { case LOAD_FAST: |