gh-106320: Use _PyInterpreterState_GET() (#106336)

Replace PyInterpreterState_Get() with inlined
_PyInterpreterState_GET().
This commit is contained in:
Victor Stinner 2023-07-02 18:37:37 +02:00 committed by GitHub
parent 9a51a41961
commit bc7eb17084
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 34 additions and 35 deletions

View file

@ -1,10 +1,9 @@
#include "Python.h"
#include "opcode.h"
#include "pycore_interp.h"
#include "pycore_opcode.h"
#include "opcode_metadata.h"
#include "pycore_pystate.h"
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "pycore_uops.h"
#include "cpython/optimizer.h"
#include <stdbool.h>
@ -125,7 +124,7 @@ _PyOptimizerObject _PyOptimizer_Default = {
_PyOptimizerObject *
PyUnstable_GetOptimizer(void)
{
PyInterpreterState *interp = PyInterpreterState_Get();
PyInterpreterState *interp = _PyInterpreterState_GET();
if (interp->optimizer == &_PyOptimizer_Default) {
return NULL;
}
@ -138,7 +137,7 @@ PyUnstable_GetOptimizer(void)
void
PyUnstable_SetOptimizer(_PyOptimizerObject *optimizer)
{
PyInterpreterState *interp = PyInterpreterState_Get();
PyInterpreterState *interp = _PyInterpreterState_GET();
if (optimizer == NULL) {
optimizer = &_PyOptimizer_Default;
}
@ -155,7 +154,7 @@ _PyOptimizer_BackEdge(_PyInterpreterFrame *frame, _Py_CODEUNIT *src, _Py_CODEUNI
{
PyCodeObject *code = (PyCodeObject *)frame->f_executable;
assert(PyCode_Check(code));
PyInterpreterState *interp = PyInterpreterState_Get();
PyInterpreterState *interp = _PyInterpreterState_GET();
if (!has_space_for_executor(code, src)) {
goto jump_to_destination;
}