mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-106320: Use _PyInterpreterState_GET() (#106336)
Replace PyInterpreterState_Get() with inlined _PyInterpreterState_GET().
This commit is contained in:
parent
9a51a41961
commit
bc7eb17084
11 changed files with 34 additions and 35 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue