GH-104584: Plugin optimizer API (GH-105100)

This commit is contained in:
Mark Shannon 2023-06-02 11:46:18 +01:00 • committed by GitHub
parent 601ae09f0c
commit 4bfa01b9d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 950 additions and 501 deletions

View file

@ -487,6 +487,7 @@ extern int _Py_Instrument(PyCodeObject *co, PyInterpreterState *interp);
extern int _Py_GetBaseOpcode(PyCodeObject *code, int offset);
extern int _PyInstruction_GetLength(PyCodeObject *code, int offset);
#ifdef __cplusplus
}

View file

@ -160,6 +160,9 @@ struct _is {
struct types_state types;
struct callable_cache callable_cache;
PyCodeObject *interpreter_trampoline;
_PyOptimizerObject *optimizer;
uint16_t optimizer_resume_threshold;
uint16_t optimizer_backedge_threshold;
_Py_Monitors monitors;
bool f_opcode_trace_set;

View file

@ -42,6 +42,7 @@ const uint8_t _PyOpcode_Caches[256] = {
[LOAD_GLOBAL] = 4,
[BINARY_OP] = 1,
[SEND] = 1,
[JUMP_BACKWARD] = 1,
[LOAD_SUPER_ATTR] = 1,
[CALL] = 3,
};
@ -114,6 +115,7 @@ const uint8_t _PyOpcode_Deopt[256] = {
[END_ASYNC_FOR] = END_ASYNC_FOR,
[END_FOR] = END_FOR,
[END_SEND] = END_SEND,
[ENTER_EXECUTOR] = ENTER_EXECUTOR,
[EXTENDED_ARG] = EXTENDED_ARG,
[FORMAT_VALUE] = FORMAT_VALUE,
[FOR_ITER] = FOR_ITER,
@ -475,7 +477,7 @@ static const char *const _PyOpcode_OpName[267] = {
[227] = "<227>",
[228] = "<228>",
[229] = "<229>",
[230] = "<230>",
[ENTER_EXECUTOR] = "ENTER_EXECUTOR",
[231] = "<231>",
[232] = "<232>",
[233] = "<233>",
@ -571,7 +573,6 @@ static const char *const _PyOpcode_OpName[267] = {
case 227: \
case 228: \
case 229: \
case 230: \
case 231: \
case 232: \
case 233: \