|
6446 | 6446 | _PyFrame_SetStackPointer(frame, stack_pointer); |
6447 | 6447 | specialize_with_value(next_instr, func, INVOKE_FUNCTION_CACHED, 0, 0); |
6448 | 6448 | stack_pointer = _PyFrame_GetStackPointer(frame); |
6449 | | - } else { |
| 6449 | + } else if (_Py_IsImmortal(container)) { |
6450 | 6450 | _PyFrame_SetStackPointer(frame, stack_pointer); |
6451 | 6451 | PyObject** funcptr = _PyClassLoader_ResolveIndirectPtr(target); |
6452 | 6452 | stack_pointer = _PyFrame_GetStackPointer(frame); |
@@ -11009,21 +11009,36 @@ |
11009 | 11009 | assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); |
11010 | 11010 | JUMP_TO_PREDICTED(LOAD_GLOBAL); |
11011 | 11011 | } |
11012 | | - #ifdef META_PYTHON |
11013 | | - if (PyLazyImport_CheckExact(res_o)) { |
| 11012 | + #if Py_GIL_DISABLED |
| 11013 | + int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); |
| 11014 | + if (!increfed) { |
11014 | 11015 | UPDATE_MISS_STATS(LOAD_GLOBAL); |
11015 | 11016 | assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); |
11016 | 11017 | JUMP_TO_PREDICTED(LOAD_GLOBAL); |
11017 | 11018 | } |
| 11019 | + #ifdef META_PYTHON |
| 11020 | + if (PyLazyImport_CheckExact(PyStackRef_AsPyObjectBorrow(res))) { |
| 11021 | + stack_pointer[0] = res; |
| 11022 | + stack_pointer += 1; |
| 11023 | + assert(WITHIN_STACK_BOUNDS()); |
| 11024 | + _PyFrame_SetStackPointer(frame, stack_pointer); |
| 11025 | + PyStackRef_CLOSE(res); |
| 11026 | + stack_pointer = _PyFrame_GetStackPointer(frame); |
| 11027 | + if (true) { |
| 11028 | + UPDATE_MISS_STATS(LOAD_GLOBAL); |
| 11029 | + assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); |
| 11030 | + JUMP_TO_PREDICTED(LOAD_GLOBAL); |
| 11031 | + } |
| 11032 | + } |
11018 | 11033 | #endif |
11019 | | - #if Py_GIL_DISABLED |
11020 | | - int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); |
11021 | | - if (!increfed) { |
| 11034 | + #else |
| 11035 | + #ifdef META_PYTHON |
| 11036 | + if (PyLazyImport_CheckExact(res_o)) { |
11022 | 11037 | UPDATE_MISS_STATS(LOAD_GLOBAL); |
11023 | 11038 | assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); |
11024 | 11039 | JUMP_TO_PREDICTED(LOAD_GLOBAL); |
11025 | 11040 | } |
11026 | | - #else |
| 11041 | + #endif |
11027 | 11042 | res = PyStackRef_FromPyObjectNew(res_o); |
11028 | 11043 | #endif |
11029 | 11044 | STAT_INC(LOAD_GLOBAL, hit); |
@@ -11083,21 +11098,36 @@ |
11083 | 11098 | assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); |
11084 | 11099 | JUMP_TO_PREDICTED(LOAD_GLOBAL); |
11085 | 11100 | } |
11086 | | - #ifdef META_PYTHON |
11087 | | - if (PyLazyImport_CheckExact(res_o)) { |
| 11101 | + #if Py_GIL_DISABLED |
| 11102 | + int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); |
| 11103 | + if (!increfed) { |
11088 | 11104 | UPDATE_MISS_STATS(LOAD_GLOBAL); |
11089 | 11105 | assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); |
11090 | 11106 | JUMP_TO_PREDICTED(LOAD_GLOBAL); |
11091 | 11107 | } |
| 11108 | + #ifdef META_PYTHON |
| 11109 | + if (PyLazyImport_CheckExact(PyStackRef_AsPyObjectBorrow(res))) { |
| 11110 | + stack_pointer[0] = res; |
| 11111 | + stack_pointer += 1; |
| 11112 | + assert(WITHIN_STACK_BOUNDS()); |
| 11113 | + _PyFrame_SetStackPointer(frame, stack_pointer); |
| 11114 | + PyStackRef_CLOSE(res); |
| 11115 | + stack_pointer = _PyFrame_GetStackPointer(frame); |
| 11116 | + if (true) { |
| 11117 | + UPDATE_MISS_STATS(LOAD_GLOBAL); |
| 11118 | + assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); |
| 11119 | + JUMP_TO_PREDICTED(LOAD_GLOBAL); |
| 11120 | + } |
| 11121 | + } |
11092 | 11122 | #endif |
11093 | | - #if Py_GIL_DISABLED |
11094 | | - int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res); |
11095 | | - if (!increfed) { |
| 11123 | + #else |
| 11124 | + #ifdef META_PYTHON |
| 11125 | + if (PyLazyImport_CheckExact(res_o)) { |
11096 | 11126 | UPDATE_MISS_STATS(LOAD_GLOBAL); |
11097 | 11127 | assert(_PyOpcode_Deopt[opcode] == (LOAD_GLOBAL)); |
11098 | 11128 | JUMP_TO_PREDICTED(LOAD_GLOBAL); |
11099 | 11129 | } |
11100 | | - #else |
| 11130 | + #endif |
11101 | 11131 | res = PyStackRef_FromPyObjectNew(res_o); |
11102 | 11132 | #endif |
11103 | 11133 | STAT_INC(LOAD_GLOBAL, hit); |
|
0 commit comments